Avoid NPE when deleting a project
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / preferences / PHPMiscProjectPreferences.java
1 package net.sourceforge.phpeclipse.ui.preferences;
2 import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
3 import net.sourceforge.phpeclipse.ui.WebUI;
4 import net.sourceforge.phpeclipse.ui.overlaypages.FieldEditorOverlayPage;
5
6 import org.eclipse.jface.preference.IPreferenceStore;
7 import org.eclipse.jface.preference.PathEditor;
8 import org.eclipse.jface.preference.StringFieldEditor;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.RowLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.ui.IWorkbench;
14 import org.eclipse.ui.IWorkbenchPreferencePage;
15 /**
16  * 
17  * This page will be added to the project's property page dialog when the
18  * "Properties..." popup menu item is selected
19  */
20 public class PHPMiscProjectPreferences extends FieldEditorOverlayPage
21     implements
22       IWorkbenchPreferencePage,
23       IMiscProjectPreferences {
24
25   public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
26   public PHPMiscProjectPreferences() {
27     super(GRID);
28   }
29   /*
30    * (non-Javadoc)
31    * 
32    * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
33    */
34   protected String getPageId() {
35     return PREF_ID;
36   }
37   
38   protected void createFieldEditors() {
39     Composite composite = getFieldEditorParent();
40     
41     addField(new StringFieldEditor(IPreferenceConstants.PHP_LOCALHOST_PREF,
42         PHPPreferencesMessages.getString("PHPMiscProjectPreferences.localhost"),
43         composite));
44     addField(new StringFieldEditor(IPreferenceConstants.PHP_BOOKMARK_DEFAULT,
45         PHPPreferencesMessages.getString("PHPMiscProjectPreferences.bookmark"),
46         composite));
47     addField(new StringFieldEditor(IPreferenceConstants.PHP_DOCUMENTROOT_PREF,
48         PHPPreferencesMessages.getString("PHPMiscProjectPreferences.documentroot"),
49         composite)); 
50    
51     PathEditor pe = new PathEditor(IPreferenceConstants.PHP_INCLUDE_PATHS,
52         PHPPreferencesMessages.getString("PHPMiscProjectPreferences.include_paths"),
53         "Choose Path...",
54         composite);
55     addField(pe);
56     
57     
58     
59     //if (!isPropertyPage)) {
60     //  
61     //}
62   }
63   /* (non-Javadoc)
64    * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
65    */
66   protected IPreferenceStore doGetPreferenceStore() {
67     return WebUI.getDefault().getPreferenceStore();
68   }
69   /* (non-Javadoc)
70    * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
71    */
72   public void init(IWorkbench workbench) {
73     setDescription("Default entries for PHP projects.");
74   }
75 }