KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > PDEPerspective


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui;
12
13 import org.eclipse.debug.ui.IDebugUIConstants;
14 import org.eclipse.jdt.ui.JavaUI;
15 import org.eclipse.ui.IFolderLayout;
16 import org.eclipse.ui.IPageLayout;
17 import org.eclipse.ui.IPerspectiveFactory;
18
19 public class PDEPerspective implements IPerspectiveFactory {
20     
21     private IPageLayout factory;
22
23     public PDEPerspective() {
24         super();
25     }
26
27     public void createInitialLayout(IPageLayout factory) {
28         this.factory = factory;
29         addViews();
30         addActionSets();
31         addNewWizardShortcuts();
32         addPerspectiveShortcuts();
33         addViewShortcuts();
34     }
35     
36     private void addPerspectiveShortcuts() {
37         factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
38
factory.addPerspectiveShortcut(JavaUI.ID_PERSPECTIVE);
39         factory.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
40     }
41     
42     private void addViews() {
43         IFolderLayout topLeft =
44             factory.createFolder(
45                 "topLeft", //$NON-NLS-1$
46
IPageLayout.LEFT,
47                 0.25f,
48                 factory.getEditorArea());
49         topLeft.addPlaceholder(IPageLayout.ID_RES_NAV);
50         topLeft.addView(JavaUI.ID_PACKAGES);
51         topLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
52         topLeft.addView(IPDEUIConstants.PLUGINS_VIEW_ID);
53
54         IFolderLayout bottom =
55             factory.createFolder(
56                 "bottomRight", //$NON-NLS-1$
57
IPageLayout.BOTTOM,
58                 0.75f,
59                 factory.getEditorArea());
60         bottom.addView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
61
bottom.addView(IPageLayout.ID_TASK_LIST);
62         bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
63         
64         factory.addView(
65             IPageLayout.ID_OUTLINE,
66             IPageLayout.RIGHT,
67             0.75f,
68             factory.getEditorArea());
69     }
70     
71     private void addActionSets() {
72         factory.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
73         factory.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
74         factory.addActionSet(JavaUI.ID_ACTION_SET);
75         factory.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
76         factory.addActionSet("org.eclipse.debug.ui.breakpointActionSet"); //$NON-NLS-1$
77
}
78     
79     private void addNewWizardShortcuts() {
80         factory.addNewWizardShortcut("org.eclipse.pde.ui.NewProductConfigurationWizard"); //$NON-NLS-1$
81
factory.addNewWizardShortcut("org.eclipse.pde.ui.NewProfileWizard"); //$NON-NLS-1$
82
factory.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
83
factory.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
84
factory.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
85
factory.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
86
factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
87
factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
88
}
89     
90     private void addViewShortcuts() {
91         factory.addShowViewShortcut(JavaUI.ID_PACKAGES);
92         factory.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
93
factory.addShowViewShortcut(IPDEUIConstants.PLUGINS_VIEW_ID);
94         factory.addShowViewShortcut(IPageLayout.ID_RES_NAV);
95         factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
96         factory.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
97         factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
98     }
99 }
100
Popular Tags