View Javadoc

1   /*
2    * $Id: OWLPerspective.java,v 1.18 2005/09/07 19:05:34 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8   package com.bbn.swede.ui;
9   
10  import org.eclipse.ui.IFolderLayout;
11  import org.eclipse.ui.IPageLayout;
12  import org.eclipse.ui.IPerspectiveFactory;
13  import org.eclipse.ui.IPlaceholderFolderLayout;
14  
15  /***
16   * Implements initial setup operations for the Semantic Web perspective.
17   * @author jlerner
18   */
19  public class OWLPerspective implements IPerspectiveFactory
20  {
21     /*
22      *  (non-Javadoc)
23      * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
24      */
25     public void createInitialLayout(IPageLayout layout)
26     {
27        defineActions(layout);
28        defineLayout(layout);
29     }
30  
31     /***
32      * Creates and positions actions for the Semantic Web perspective.  This 
33      * includes the the Validate and OWL element creation actions as well
34      * as populating the Window->Show View menu and installing New Wizard 
35      * shortcuts for OWL documents and Semantic Web projects.
36      * @param layout The page layout
37      */
38     public void defineActions(IPageLayout layout)
39     {
40        layout.addActionSet(
41           "com.bbn.swede.ui.wizards.action.OWLElementCreationSet");
42        layout.addActionSet("com.bbn.swede.ui.action.ODEActionSet");
43  
44        layout.addShowViewShortcut("com.bbn.swede.view.uriexplorer");
45        layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
46        layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
47        layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
48        layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
49        layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
50        layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
51        
52        layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective");
53        layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective");
54  
55        layout.addNewWizardShortcut(
56           "com.bbn.swede.ui.wizards.newOWLProjectWizard");
57        layout.addNewWizardShortcut(
58           "com.bbn.swede.ui.wizards.newOWLDocumentWizard");
59        layout.addNewWizardShortcut(
60           "com.bbn.swede.ui.wizards.libraries.new");
61     }
62  
63     /***
64      * Creates and positions views for the Semantic Web perspective.  The 
65      * initial arrangement places URI Explorer to the left of the editor area
66      * and problem and task view below it.  Outline View is initially hidden,
67      * but a placeholder is created to locate it to the right of the editor area.
68      * @param layout The page layout
69      */
70     public void defineLayout(IPageLayout layout)
71     {
72        // Editors are placed for free.
73        String editorArea = layout.getEditorArea();
74  
75        // Top left.
76        IFolderLayout topLeft =
77           layout.createFolder("topLeft", IPageLayout.LEFT, 0.26f, editorArea);
78        topLeft.addView("com.bbn.swede.view.uriexplorer");
79        topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
80        topLeft.addPlaceholder(IPageLayout.ID_RES_NAV);
81  
82        // Bottom right.
83        // Looks like this is where views will show up by default if you
84        // don't explicitly create a placeholder for them elsewhere.
85        IFolderLayout bottomRight =
86           layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.8f, editorArea);
87        bottomRight.addView(IPageLayout.ID_PROBLEM_VIEW);
88        bottomRight.addView(IPageLayout.ID_TASK_LIST);
89  
90        // Top right.
91        IFolderLayout topRight =
92           layout.createFolder(
93              "topRight",
94              IPageLayout.RIGHT,
95              0.8f,
96              editorArea);
97        topRight.addView(IPageLayout.ID_OUTLINE);
98  
99        // Bottom left.
100       IPlaceholderFolderLayout bottomLeft =
101          layout.createPlaceholderFolder(
102             "bottomLeft",
103             IPageLayout.BOTTOM,
104             0.66f,
105             "topLeft");
106       bottomLeft.addPlaceholder(IPageLayout.ID_PROP_SHEET);
107 
108    }
109 }