1 | /* |
---|
2 | * This file is part of Modelica Development Tooling. |
---|
3 | * |
---|
4 | * Copyright (c) 2005, Linköpings universitet, Department of |
---|
5 | * Computer and Information Science, PELAB |
---|
6 | * |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * (The new BSD license, see also |
---|
10 | * http://www.opensource.org/licenses/bsd-license.php) |
---|
11 | * |
---|
12 | * |
---|
13 | * Redistribution and use in source and binary forms, with or without |
---|
14 | * modification, are permitted provided that the following conditions are |
---|
15 | * met: |
---|
16 | * |
---|
17 | * * Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * |
---|
20 | * * Redistributions in binary form must reproduce the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer in |
---|
22 | * the documentation and/or other materials provided with the |
---|
23 | * distribution. |
---|
24 | * |
---|
25 | * * Neither the name of Linköpings universitet nor the names of its |
---|
26 | * contributors may be used to endorse or promote products derived from |
---|
27 | * this software without specific prior written permission. |
---|
28 | * |
---|
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
40 | */ |
---|
41 | |
---|
42 | package org.modelica.mdt.ui; |
---|
43 | |
---|
44 | import org.eclipse.debug.ui.IDebugUIConstants; |
---|
45 | import org.eclipse.ui.IFolderLayout; |
---|
46 | import org.eclipse.ui.IPageLayout; |
---|
47 | import org.eclipse.ui.IPerspectiveFactory; |
---|
48 | import org.eclipse.ui.console.IConsoleConstants; |
---|
49 | import org.eclipse.ui.progress.IProgressConstants; |
---|
50 | import org.modelica.mdt.ui.view.ModelicaConsoleView; |
---|
51 | import org.modelica.mdt.ui.view.ModelicaProjectsView; |
---|
52 | |
---|
53 | public class ModelicaPerspective implements IPerspectiveFactory |
---|
54 | { |
---|
55 | |
---|
56 | public void createInitialLayout(IPageLayout layout) |
---|
57 | { |
---|
58 | String editorArea = layout.getEditorArea(); |
---|
59 | /* add 'modelica projects' view */ |
---|
60 | IFolderLayout resources = |
---|
61 | layout.createFolder("org.modelica.mdt.resourcesArea", |
---|
62 | IPageLayout.LEFT, 0.25f, editorArea); |
---|
63 | resources.addView(ModelicaProjectsView.ID); |
---|
64 | resources.addPlaceholder(IPageLayout.ID_RES_NAV); |
---|
65 | |
---|
66 | /* add outline view */ |
---|
67 | IFolderLayout outlineArea = |
---|
68 | layout.createFolder("org.modelica.mdt.outlineArea", |
---|
69 | IPageLayout.BOTTOM, 0.50f, "org.modelica.mdt.resourcesArea"); |
---|
70 | outlineArea.addView(IPageLayout.ID_OUTLINE); |
---|
71 | |
---|
72 | /* add console view */ |
---|
73 | IFolderLayout consoleArea = |
---|
74 | layout.createFolder("org.modelica.mdt.consoleArea", |
---|
75 | IPageLayout.BOTTOM, 0.75f, IPageLayout.ID_EDITOR_AREA); |
---|
76 | consoleArea.addView(IPageLayout.ID_PROBLEM_VIEW); |
---|
77 | /* add modelica console view */ |
---|
78 | consoleArea.addView(IConsoleConstants.ID_CONSOLE_VIEW); |
---|
79 | consoleArea.addView(IPageLayout.ID_BOOKMARKS); |
---|
80 | consoleArea.addView(IProgressConstants.PROGRESS_VIEW_ID); |
---|
81 | |
---|
82 | /* add new wizards */ |
---|
83 | layout.addNewWizardShortcut("org.modelica.mdt.NewProjectWizard"); |
---|
84 | layout.addNewWizardShortcut("org.modelica.mdt.NewPackageWizard"); |
---|
85 | layout.addNewWizardShortcut("org.modelica.mdt.NewClassWizard"); |
---|
86 | layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); |
---|
87 | layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); |
---|
88 | |
---|
89 | /* add view shortcuts */ |
---|
90 | layout.addShowViewShortcut(ModelicaProjectsView.ID); |
---|
91 | layout.addShowViewShortcut(ModelicaConsoleView.ID); |
---|
92 | // views - debugging |
---|
93 | layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW); |
---|
94 | // views - standard workbench |
---|
95 | layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); |
---|
96 | layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); |
---|
97 | layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); |
---|
98 | layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); |
---|
99 | layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID); |
---|
100 | layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS); |
---|
101 | |
---|
102 | layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | } |
---|