KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > schemas > view > perspectives > Perspective


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.schemas.view.perspectives;
22
23
24 import org.apache.directory.ldapstudio.schemas.Activator;
25 import org.apache.directory.ldapstudio.schemas.view.views.HierarchyView;
26 import org.apache.directory.ldapstudio.schemas.view.views.SchemaElementsView;
27 import org.apache.directory.ldapstudio.schemas.view.views.SchemasView;
28 import org.apache.directory.ldapstudio.schemas.view.views.SearchView;
29 import org.eclipse.ui.IFolderLayout;
30 import org.eclipse.ui.IPageLayout;
31 import org.eclipse.ui.IPerspectiveFactory;
32
33
34 /**
35  * This is the standard perspective with Schema Elements View on the top left, Schemas View on bottom left,
36  * editor in top right, Search View on bottom right.
37  *
38  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
39  * @version $Rev$, $Date$
40  */

41 public class Perspective implements IPerspectiveFactory
42 {
43     /** The ID of the view */
44     public static final String JavaDoc ID = Activator.PLUGIN_ID + ".perspective"; //$NON-NLS-1$
45

46
47     /* (non-Javadoc)
48      * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
49      */

50     public void createInitialLayout( IPageLayout layout )
51     {
52         String JavaDoc placeHolderId = "org.apache.directory.ldapstudio.schemas.placeholder"; //$NON-NLS-1$
53

54         layout.setEditorAreaVisible( true );
55         String JavaDoc editorAreaId = layout.getEditorArea();
56
57         // Creating top left folder
58
IFolderLayout topLeftFolder = layout.createFolder( placeHolderId, IPageLayout.LEFT, 0.3f, editorAreaId );
59         layout.addPlaceholder( placeHolderId, IPageLayout.LEFT, 0.3f, editorAreaId );
60
61         // Adding views
62
topLeftFolder.addView( SchemaElementsView.ID );
63         topLeftFolder.addView( HierarchyView.ID );
64         layout.addStandaloneView( SchemasView.ID, true, IPageLayout.BOTTOM, 0.5f, placeHolderId );
65         layout.addStandaloneView( SearchView.ID, true, IPageLayout.BOTTOM, 0.7f, editorAreaId );
66
67         // Setting up non-closeable views
68
layout.getViewLayout( SchemaElementsView.ID ).setCloseable( false );
69         layout.getViewLayout( SchemasView.ID ).setCloseable( false );
70         layout.getViewLayout( SearchView.ID ).setCloseable( false );
71
72         // Adding Perspective shortcuts
73
layout.addPerspectiveShortcut( "org.apache.directory.ldapstudio.browser.ui.perspective.BrowserPerspective" ); //$NON-NLS-1$
74
layout.addPerspectiveShortcut( Perspective.ID );
75
76         // Adding View shortcuts
77
layout.addShowViewShortcut( HierarchyView.ID );
78         layout.addShowViewShortcut( SchemaElementsView.ID );
79         layout.addShowViewShortcut( SchemasView.ID );
80         layout.addShowViewShortcut( SearchView.ID );
81     }
82 }
83
Popular Tags