Improved handling for right mouse click menu on file in Navigator:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPEclipseBasePreferencePage.java
index 5b9af53..9da4482 100644 (file)
@@ -1,80 +1,85 @@
 package net.sourceforge.phpeclipse;
 
-import java.util.ArrayList;
+import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
 
 import org.eclipse.jface.preference.BooleanFieldEditor;
 import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FileFieldEditor;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
 import org.eclipse.jface.preference.StringFieldEditor;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
-import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
-
 public class PHPEclipseBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
 
-  private SelectionListener SelectionListener;
-  private ModifyListener ModifyListener;
-  private ModifyListener TextModifyListener;
-
-  private ArrayList CheckBoxes = new ArrayList();
-  private ArrayList ComboBoxes = new ArrayList();
-  private ArrayList TextBoxes = new ArrayList();
-  private ArrayList RadioButtons = new ArrayList();
-
-  StringFieldEditor localHostSFE;
-  DirectoryFieldEditor documentRootDFE;
-  BooleanFieldEditor externalBrowserBFE;
-  StringFieldEditor externalBrowserSFE;
   StringFieldEditor apacheStartSFE;
+
   StringFieldEditor apacheStopSFE;
+
   StringFieldEditor apacheRestartSFE;
+
   StringFieldEditor mySQLCommandSFE;
-  RadioGroupFieldEditor chooseParser;
-  BooleanFieldEditor parseOnSave;
+
+  FileFieldEditor apacheRunFFE;
+
+  FileFieldEditor mysqlRunFFE;
+
+  FileFieldEditor phpRunFFE;
+
+  BooleanFieldEditor apacheStartBFE;
+
+  BooleanFieldEditor apacheStopBFE;
+
+  BooleanFieldEditor apacheRestartBFE;
+
+  BooleanFieldEditor mysqlStartBFE;
 
   public PHPEclipseBasePreferencePage() {
     super();
     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
     setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
   }
+
   public void init(IWorkbench workbench) {
   }
+
   protected void performDefaults() {
-    localHostSFE.loadDefault();
-    documentRootDFE.loadDefault();
-    externalBrowserBFE.loadDefault();
-    externalBrowserSFE.loadDefault();
     apacheStartSFE.loadDefault();
     apacheStopSFE.loadDefault();
     apacheRestartSFE.loadDefault();
     mySQLCommandSFE.loadDefault();
-    chooseParser.loadDefault();
-    parseOnSave.loadDefault();
+    phpRunFFE.loadDefault();
+    apacheRunFFE.loadDefault();
+    mysqlRunFFE.loadDefault();
+    apacheStartBFE.loadDefault();
+    apacheStopBFE.loadDefault();
+    apacheRestartBFE.loadDefault();
+    mysqlStartBFE.loadDefault();
     super.performDefaults();
   }
 
   public boolean performOk() {
-    localHostSFE.store();
-    documentRootDFE.store();
-    externalBrowserBFE.store();
-    externalBrowserSFE.store();
+
     apacheStartSFE.store();
     apacheStopSFE.store();
     apacheRestartSFE.store();
     mySQLCommandSFE.store();
-    chooseParser.store();
-    parseOnSave.store();
+    phpRunFFE.store();
+    apacheRunFFE.store();
+    mysqlRunFFE.store();
+
+    apacheStartBFE.store();
+    apacheStopBFE.store();
+    apacheRestartBFE.store();
+    mysqlStartBFE.store();
     return super.performOk();
   }
 
@@ -84,46 +89,6 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     Composite composite = new Composite(parent, SWT.LEFT);
     composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     composite.setLayout(new GridLayout());
-    //Create Websettings
-    Composite webSettingsComposite = new Composite(composite, SWT.NONE);
-    webSettingsComposite.setLayout(new GridLayout());
-    webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE);
-    webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup"));
-    webSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    webSettingsGroup.setLayout(new GridLayout());
-    localHostSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.LOCALHOST_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.localhost"),
-        webSettingsGroup);
-    localHostSFE.setPreferencePage(this);
-    localHostSFE.setPreferenceStore(getPreferenceStore());
-    localHostSFE.load();
-    documentRootDFE =
-      new DirectoryFieldEditor(
-        IPreferenceConstants.DOCUMENTROOT_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.docroot"),
-        webSettingsGroup);
-    documentRootDFE.setPreferencePage(this);
-    documentRootDFE.setPreferenceStore(getPreferenceStore());
-    documentRootDFE.load();
-    externalBrowserBFE =
-      new BooleanFieldEditor(
-        IPreferenceConstants.USE_EXTERNAL_BROWSER_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.useexternal"),
-        webSettingsGroup);
-    externalBrowserBFE.setPreferencePage(this);
-    externalBrowserBFE.setPreferenceStore(getPreferenceStore());
-    externalBrowserBFE.load();
-    externalBrowserSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.EXTERNAL_BROWSER_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.browser"),
-        webSettingsGroup);
-    externalBrowserSFE.setPreferencePage(this);
-    externalBrowserSFE.setPreferenceStore(getPreferenceStore());
-    externalBrowserSFE.load();
 
     //Create apache
     Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
@@ -133,30 +98,61 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup"));
     apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     apacheSettingsGroup.setLayout(new GridLayout());
-    apacheStartSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.APACHE_START_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.start"),
-        apacheSettingsGroup);
+
+    apacheStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup);
+    apacheStartBFE.setPreferencePage(this);
+    apacheStartBFE.setPreferenceStore(getPreferenceStore());
+    apacheStartBFE.load();
+
+    new Label(apacheSettingsGroup, SWT.NONE);
+    new Label(apacheSettingsGroup, SWT.NONE);
+    apacheStartSFE = new StringFieldEditor(IPreferenceConstants.APACHE_START_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup);
     apacheStartSFE.setPreferencePage(this);
     apacheStartSFE.setPreferenceStore(getPreferenceStore());
     apacheStartSFE.load();
-    apacheStopSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.APACHE_STOP_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.stop"),
-        apacheSettingsGroup);
+    new Label(apacheSettingsGroup, SWT.NONE);
+
+    apacheStopBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup);
+    apacheStopBFE.setPreferencePage(this);
+    apacheStopBFE.setPreferenceStore(getPreferenceStore());
+    apacheStopBFE.load();
+    new Label(apacheSettingsGroup, SWT.NONE);
+    new Label(apacheSettingsGroup, SWT.NONE);
+    apacheStopSFE = new StringFieldEditor(IPreferenceConstants.APACHE_STOP_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
     apacheStopSFE.setPreferencePage(this);
     apacheStopSFE.setPreferenceStore(getPreferenceStore());
     apacheStopSFE.load();
-    apacheRestartSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.APACHE_RESTART_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.restart"),
-        apacheSettingsGroup);
+    new Label(apacheSettingsGroup, SWT.NONE);
+
+    apacheRestartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup);
+    apacheRestartBFE.setPreferencePage(this);
+    apacheRestartBFE.setPreferenceStore(getPreferenceStore());
+    apacheRestartBFE.load();
+    new Label(apacheSettingsGroup, SWT.NONE);
+    new Label(apacheSettingsGroup, SWT.NONE);
+    apacheRestartSFE = new StringFieldEditor(IPreferenceConstants.APACHE_RESTART_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup);
     apacheRestartSFE.setPreferencePage(this);
     apacheRestartSFE.setPreferenceStore(getPreferenceStore());
     apacheRestartSFE.load();
+    new Label(apacheSettingsGroup, SWT.NONE);
+
+    apacheRunFFE = new FileFieldEditor(IPreferenceConstants.APACHE_RUN_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup);
+    apacheRunFFE.setPreferencePage(this);
+    apacheRunFFE.setPreferenceStore(getPreferenceStore());
+    apacheRunFFE.load();
+
+    phpRunFFE = new FileFieldEditor(IPreferenceConstants.PHP_RUN_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
+    phpRunFFE.setPreferencePage(this);
+    phpRunFFE.setPreferenceStore(getPreferenceStore());
+    phpRunFFE.load();
 
     //Create mySQL
     Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL);
@@ -167,42 +163,28 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup"));
     mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     mySQLSettingsGroup.setLayout(new GridLayout());
-    mySQLCommandSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.MYSQL_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup.command"),
-        mySQLSettingsGroup);
+
+    mysqlStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup);
+    mysqlStartBFE.setPreferencePage(this);
+    mysqlStartBFE.setPreferenceStore(getPreferenceStore());
+    mysqlStartBFE.load();
+    new Label(mySQLSettingsGroup, SWT.NONE);
+    new Label(mySQLSettingsGroup, SWT.NONE);
+
+    mySQLCommandSFE = new StringFieldEditor(IPreferenceConstants.MYSQL_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
     mySQLCommandSFE.setPreferencePage(this);
     mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
     mySQLCommandSFE.load();
+    new Label(mySQLSettingsGroup, SWT.NONE);
 
-    //Create parser settings composite
-    Composite parserSettingsComposite = new Composite(composite, SWT.NONE);
-    parserSettingsComposite.setLayout(new GridLayout());
-    parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
-    parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers"));
-    parserSettingsGroup.setLayout(new GridLayout());
-    parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-    chooseParser =
-      new RadioGroupFieldEditor(
-        IPreferenceConstants.PHP_PARSER_DEFAULT,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
-        1,
-        new String[][] {
-          { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
-          {
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
-    }, parserSettingsGroup);
-    chooseParser.setPreferencePage(this);
-    chooseParser.setPreferenceStore(getPreferenceStore());
-    chooseParser.load();
-    parseOnSave = new BooleanFieldEditor(PHPeclipsePlugin.PHP_PARSE_ON_SAVE, "&Parse automatically on save", parserSettingsGroup);
-    parseOnSave.setPreferencePage(this);
-    parseOnSave.setPreferenceStore(getPreferenceStore());
-    parseOnSave.load();
+    mysqlRunFFE = new FileFieldEditor(IPreferenceConstants.MYSQL_RUN_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
+    mysqlRunFFE.setPreferencePage(this);
+    mysqlRunFFE.setPreferenceStore(getPreferenceStore());
+    mysqlRunFFE.load();
 
     return composite;
   }
-}
+}
\ No newline at end of file