changed to version 1.1.5 for js.core
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPEclipseBasePreferencePage.java
index 8d55567..3262fb0 100644 (file)
@@ -1,9 +1,9 @@
 package net.sourceforge.phpeclipse;
 
+import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
 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;
@@ -20,33 +20,29 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
 
 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 showExternalPreviewBFE;
-  BooleanFieldEditor externalBrowserBFE;
-  StringFieldEditor externalBrowserSFE;
+  StringFieldEditor phpParserExtensionsSFE;
+  StringFieldEditor xamppStartSFE;
+  StringFieldEditor xamppStopSFE;
   StringFieldEditor apacheStartSFE;
+
   StringFieldEditor apacheStopSFE;
+
   StringFieldEditor apacheRestartSFE;
+
   StringFieldEditor mySQLCommandSFE;
+
   FileFieldEditor apacheRunFFE;
+
   FileFieldEditor mysqlRunFFE;
+
   FileFieldEditor phpRunFFE;
-//  RadioGroupFieldEditor chooseParser;
-//  StringFieldEditor externalParserSFE;
-//  BooleanFieldEditor parseOnSave;
+
   BooleanFieldEditor apacheStartBFE;
+
   BooleanFieldEditor apacheStopBFE;
+
   BooleanFieldEditor apacheRestartBFE;
+
   BooleanFieldEditor mysqlStartBFE;
 
   public PHPEclipseBasePreferencePage() {
@@ -54,14 +50,14 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
     setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
   }
+
   public void init(IWorkbench workbench) {
   }
+
   protected void performDefaults() {
-    localHostSFE.loadDefault();
-    documentRootDFE.loadDefault();
-    showExternalPreviewBFE.loadDefault();
-    externalBrowserBFE.loadDefault();
-    externalBrowserSFE.loadDefault();
+    phpParserExtensionsSFE.loadDefault();
+    xamppStartSFE.loadDefault();
+    xamppStopSFE.loadDefault();
     apacheStartSFE.loadDefault();
     apacheStopSFE.loadDefault();
     apacheRestartSFE.loadDefault();
@@ -69,9 +65,6 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     phpRunFFE.loadDefault();
     apacheRunFFE.loadDefault();
     mysqlRunFFE.loadDefault();
-//    chooseParser.loadDefault();
-//    externalParserSFE.loadDefault();
-//    parseOnSave.loadDefault();
     apacheStartBFE.loadDefault();
     apacheStopBFE.loadDefault();
     apacheRestartBFE.loadDefault();
@@ -80,11 +73,10 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
   }
 
   public boolean performOk() {
-    localHostSFE.store();
-    documentRootDFE.store();
-    showExternalPreviewBFE.store();
-    externalBrowserBFE.store();
-    externalBrowserSFE.store();
+    PHPFileUtil.setExtensions(null); 
+    phpParserExtensionsSFE.store();
+    xamppStartSFE.store();
+    xamppStopSFE.store();
     apacheStartSFE.store();
     apacheStopSFE.store();
     apacheRestartSFE.store();
@@ -92,9 +84,7 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     phpRunFFE.store();
     apacheRunFFE.store();
     mysqlRunFFE.store();
-//    chooseParser.store();
-//    externalParserSFE.store();
-//    parseOnSave.store();
+
     apacheStartBFE.store();
     apacheStopBFE.store();
     apacheRestartBFE.store();
@@ -108,76 +98,17 @@ 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));
-
-    showExternalPreviewBFE =
-      new BooleanFieldEditor(
-        IPreferenceConstants.SHOW_EXTERNAL_PREVIEW_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.showexternalpreview"),
-        composite);
-    showExternalPreviewBFE.setPreferencePage(this);
-    showExternalPreviewBFE.setPreferenceStore(getPreferenceStore());
-    showExternalPreviewBFE.load();
-
-    //    Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE);
-    //    webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup"));
-    //    GridLayout gridLayout = new GridLayout();
-    //    //  gridLayout.numColumns = 3;
-    //    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
-    //    webSettingsGroup.setLayoutData(gridData);
-    //    webSettingsGroup.setLayout(gridLayout);
-
-    Composite webSettingsComposite = new Composite(composite, SWT.NULL);
-    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());
-
-    // new Label(webSettingsGroup, SWT.NONE);
-    externalBrowserBFE =
-      new BooleanFieldEditor(
-        IPreferenceConstants.USE_EXTERNAL_BROWSER_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.useexternal"),
-        webSettingsGroup);
-    externalBrowserBFE.setPreferencePage(this);
-    externalBrowserBFE.setPreferenceStore(getPreferenceStore());
-    externalBrowserBFE.load();
-    new Label(webSettingsGroup, SWT.NONE);
-    new Label(webSettingsGroup, SWT.NONE);
-    //  new Label(webSettingsGroup, SWT.NONE);
-    externalBrowserSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.EXTERNAL_BROWSER_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.browser"),
-        webSettingsGroup);
-    externalBrowserSFE.setPreferencePage(this);
-    externalBrowserSFE.setPreferenceStore(getPreferenceStore());
-    externalBrowserSFE.load();
-    new Label(webSettingsGroup, SWT.NONE);
-
-    localHostSFE =
-      new StringFieldEditor(
-        IPreferenceConstants.LOCALHOST_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.localhost"),
-        webSettingsGroup);
-    localHostSFE.setPreferencePage(this);
-    localHostSFE.setPreferenceStore(getPreferenceStore());
-    localHostSFE.load();
-    new Label(webSettingsGroup, SWT.NONE);
-
-    documentRootDFE =
-      new DirectoryFieldEditor(
-        IPreferenceConstants.DOCUMENTROOT_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.docroot"),
-        webSettingsGroup);
-    documentRootDFE.setPreferencePage(this);
-    documentRootDFE.setPreferenceStore(getPreferenceStore());
-    documentRootDFE.load();
+
+    // allowed PHP file extensions for parsing
+    Composite phpParserExtensionsComposite = new Composite(composite, SWT.NULL);
+    phpParserExtensionsComposite.setLayout(new GridLayout());
+    phpParserExtensionsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 
+    phpParserExtensionsSFE = new StringFieldEditor(IPreferenceConstants.PHP_EXTENSION_PREFS, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.phpExtensionPrefs"), phpParserExtensionsComposite);
+    phpParserExtensionsSFE.setPreferencePage(this);
+    phpParserExtensionsSFE.setPreferenceStore(getPreferenceStore());
+    phpParserExtensionsSFE.load();
+    
     //Create apache
     Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
     apacheSettingsComposite.setLayout(new GridLayout());
@@ -187,81 +118,72 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     apacheSettingsGroup.setLayout(new GridLayout());
 
-    apacheStartBFE =
-      new BooleanFieldEditor(
-        PHPeclipsePlugin.APACHE_START_BACKGROUND,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.start_background"),
-        apacheSettingsGroup);
-               apacheStartBFE.setPreferencePage(this);
-               apacheStartBFE.setPreferenceStore(getPreferenceStore());
-               apacheStartBFE.load();
-               
+    
+    xamppStartSFE = new StringFieldEditor(IPreferenceConstants.XAMPP_START_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup);
+    xamppStartSFE.setPreferencePage(this);
+    xamppStartSFE.setPreferenceStore(getPreferenceStore());
+    xamppStartSFE.load();
     new Label(apacheSettingsGroup, SWT.NONE);
+    
+    xamppStopSFE = new StringFieldEditor(IPreferenceConstants.XAMPP_STOP_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup);
+    xamppStopSFE.setPreferencePage(this);
+    xamppStopSFE.setPreferenceStore(getPreferenceStore());
+    xamppStopSFE.load();
     new Label(apacheSettingsGroup, SWT.NONE);
-    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();
     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();
+    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 = new StringFieldEditor(IPreferenceConstants.APACHE_STOP_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
     apacheStopSFE.setPreferencePage(this);
     apacheStopSFE.setPreferenceStore(getPreferenceStore());
     apacheStopSFE.load();
     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();
+    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 = 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 = 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 = new FileFieldEditor(IPreferenceConstants.PHP_RUN_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
     phpRunFFE.setPreferencePage(this);
     phpRunFFE.setPreferenceStore(getPreferenceStore());
     phpRunFFE.load();
@@ -276,80 +198,27 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor
     mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     mySQLSettingsGroup.setLayout(new GridLayout());
 
-    mysqlStartBFE =
-      new BooleanFieldEditor(
-        PHPeclipsePlugin.MYSQL_START_BACKGROUND,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup.start_background"),
-        mySQLSettingsGroup);
-               mysqlStartBFE.setPreferencePage(this);
-               mysqlStartBFE.setPreferenceStore(getPreferenceStore());
-               mysqlStartBFE.load();
+    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 = new StringFieldEditor(IPreferenceConstants.MYSQL_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
     mySQLCommandSFE.setPreferencePage(this);
     mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
     mySQLCommandSFE.load();
     new Label(mySQLSettingsGroup, SWT.NONE);
 
-    mysqlRunFFE =
-      new FileFieldEditor(
-        IPreferenceConstants.MYSQL_RUN_PREF,
-        PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup.run"),
-        mySQLSettingsGroup);
+    mysqlRunFFE = new FileFieldEditor(IPreferenceConstants.MYSQL_RUN_PREF, PHPPreferencesMessages
+        .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
     mysqlRunFFE.setPreferencePage(this);
     mysqlRunFFE.setPreferenceStore(getPreferenceStore());
     mysqlRunFFE.load();
 
-//    //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();
-//    //create a copmposte just for the StringEditor - makes layout simpler
-//    Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
-//    externalParserSFE =
-//      new StringFieldEditor(
-//        IPreferenceConstants.EXTERNAL_PARSER_PREF,
-//        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
-//        externalParserCompo
-//    /*parserSettingsGroup*/
-//    );
-//    externalParserSFE.setPreferencePage(this);
-//    externalParserSFE.setPreferenceStore(getPreferenceStore());
-//    externalParserSFE.load();
-//
-//    parseOnSave =
-//      new BooleanFieldEditor(
-//        PHPeclipsePlugin.PHP_PARSE_ON_SAVE,
-//        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"),
-//        parserSettingsGroup);
-//    parseOnSave.setPreferencePage(this);
-//    parseOnSave.setPreferenceStore(getPreferenceStore());
-//    parseOnSave.load();
-
     return composite;
   }
-}
+}
\ No newline at end of file