avoid NullPointerException in debug
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPPerspectiveFactory.java
1 package net.sourceforge.phpeclipse;
2
3 import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
4
5 import org.eclipse.debug.ui.IDebugUIConstants;
6 import org.eclipse.search.ui.NewSearchUI;
7 import org.eclipse.ui.IFolderLayout;
8 import org.eclipse.ui.IPageLayout;
9 import org.eclipse.ui.IPerspectiveFactory;
10 import org.eclipse.ui.console.IConsoleConstants;
11
12 public class PHPPerspectiveFactory implements IPerspectiveFactory {
13         public static final String ID_PROGRESS_VIEW = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$
14         // see bug 63563
15
16         public PHPPerspectiveFactory() {
17                 super();
18         }
19
20         public void createInitialLayout(IPageLayout layout) {
21                 String editorArea = layout.getEditorArea();
22                 IFolderLayout folder = layout.createFolder("left", IPageLayout.LEFT,
23                                 (float) 0.25, editorArea); //$NON-NLS-1$
24                 folder.addView(IPageLayout.ID_RES_NAV);
25                 IFolderLayout outputfolder = layout.createFolder("bottom",
26                                 IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
27                 outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
28
29                 outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
30                 outputfolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
31                 outputfolder.addView(IPageLayout.ID_BOOKMARKS);
32                 outputfolder.addView(BrowserView.ID_BROWSER);
33                 outputfolder.addPlaceholder(ID_PROGRESS_VIEW);
34
35                 layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75,
36                                 editorArea);
37                 layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
38                 layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
39                 layout.addShowViewShortcut(BrowserView.ID_BROWSER);
40
41                 // views - search
42                 layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
43
44                 // views - debugging
45                 layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
46                 // views - standard workbench
47                 layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
48                 layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
49                 layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
50                 // new actions - PHP project creation wizards
51                 layout
52                                 .addNewWizardShortcut("net.sourceforge.phpeclipse.wizards.PHPFileWizard"); //$NON-NLS-1$
53                 layout
54                                 .addNewWizardShortcut("net.sourceforge.phpeclipse.wizards.NewWizardProjectCreation"); //$NON-NLS-1$
55                 layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
56                 layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
57                 // perspective shortcuts
58                 layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
59                 layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective");
60         }
61 }