From b4aa2f46978fa931c36e82594e95945499898a4d Mon Sep 17 00:00:00 2001 From: stefanbjarni Date: Tue, 7 Jun 2005 21:25:26 +0000 Subject: [PATCH] Added two new workspaces preferences, to track the location of httpd.conf and etc/hosts. These two files can be modified to create new virtual hosts in the web server. --- .../prefs/default_linux.properties | 8 +++-- .../prefs/default_macosx.properties | 8 +++-- .../prefs/default_win32.properties | 4 ++- .../phpeclipse/IPreferenceConstants.java | 4 ++ .../phpeclipse/PHPEclipseBasePreferencePage.java | 31 +++++++++++++++---- .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 18 ++--------- .../preferences/PHPPreferencesMessages.properties | 2 + 7 files changed, 47 insertions(+), 28 deletions(-) diff --git a/net.sourceforge.phpeclipse/prefs/default_linux.properties b/net.sourceforge.phpeclipse/prefs/default_linux.properties index 47e56e1..4303a36 100644 --- a/net.sourceforge.phpeclipse/prefs/default_linux.properties +++ b/net.sourceforge.phpeclipse/prefs/default_linux.properties @@ -1,5 +1,5 @@ -_php_run_pref=/opt/lamp/php/php -_external_parser=/opt/lamp/php/php -l -f {0} +_php_run_pref=/opt/lampp/php/php +_external_parser=/opt/lampp/php/php -l -f {0} _mysql_run_pref=/opt/lampp/lampp startmysql _apache_run_pref=/opt/lampp/lampp _xampp_start_pref=/opt/lampp/lampp start @@ -11,4 +11,6 @@ __apache_restart=restart _mysql_start_background=true _apache_start_background=true _apache_stop_background=true -_apache_restart_background=true \ No newline at end of file +_apache_restart_background=true +__httpd_conf_path=/opt/lampp/apache/conf/httpd.conf +__etc_hosts_path=/etc/hosts \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/prefs/default_macosx.properties b/net.sourceforge.phpeclipse/prefs/default_macosx.properties index 47e56e1..4303a36 100644 --- a/net.sourceforge.phpeclipse/prefs/default_macosx.properties +++ b/net.sourceforge.phpeclipse/prefs/default_macosx.properties @@ -1,5 +1,5 @@ -_php_run_pref=/opt/lamp/php/php -_external_parser=/opt/lamp/php/php -l -f {0} +_php_run_pref=/opt/lampp/php/php +_external_parser=/opt/lampp/php/php -l -f {0} _mysql_run_pref=/opt/lampp/lampp startmysql _apache_run_pref=/opt/lampp/lampp _xampp_start_pref=/opt/lampp/lampp start @@ -11,4 +11,6 @@ __apache_restart=restart _mysql_start_background=true _apache_start_background=true _apache_stop_background=true -_apache_restart_background=true \ No newline at end of file +_apache_restart_background=true +__httpd_conf_path=/opt/lampp/apache/conf/httpd.conf +__etc_hosts_path=/etc/hosts \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/prefs/default_win32.properties b/net.sourceforge.phpeclipse/prefs/default_win32.properties index 251b611..8ee625d 100644 --- a/net.sourceforge.phpeclipse/prefs/default_win32.properties +++ b/net.sourceforge.phpeclipse/prefs/default_win32.properties @@ -11,4 +11,6 @@ __apache_restart=-k restart _mysql_start_background=true _apache_start_background=true _apache_stop_background=true -_apache_restart_background=true \ No newline at end of file +_apache_restart_background=true +__httpd_conf_path=c:\\xampp\\apache\\conf\\httpd.conf +__etc_hosts_path=c:\\windows\\system32\\drivers\\etc\\hosts \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java index e9278cf..5c67cd6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java @@ -55,6 +55,10 @@ public interface IPreferenceConstants { public static final String APACHE_RESTART_BACKGROUND = "_apache_restart_background"; public static final String APACHE_RESTART_PREF = "__apache_restart"; + + public static final String HTTPD_CONF_PATH_PREF = "__httpd_conf_path"; + + public static final String ETC_HOSTS_PATH_PREF = "__etc_hosts_path"; public static final String SHOW_OUTPUT_IN_CONSOLE = "_show_output_in_console"; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java index 3262fb0..dcc1599 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java @@ -21,8 +21,8 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class PHPEclipseBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { StringFieldEditor phpParserExtensionsSFE; - StringFieldEditor xamppStartSFE; - StringFieldEditor xamppStopSFE; + FileFieldEditor xamppStartSFE; + FileFieldEditor xamppStopSFE; StringFieldEditor apacheStartSFE; StringFieldEditor apacheStopSFE; @@ -33,6 +33,10 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor FileFieldEditor apacheRunFFE; + FileFieldEditor httpdConfFFE; + + FileFieldEditor etcHostsFFE; + FileFieldEditor mysqlRunFFE; FileFieldEditor phpRunFFE; @@ -64,6 +68,8 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor mySQLCommandSFE.loadDefault(); phpRunFFE.loadDefault(); apacheRunFFE.loadDefault(); + httpdConfFFE.loadDefault(); + etcHostsFFE.loadDefault(); mysqlRunFFE.loadDefault(); apacheStartBFE.loadDefault(); apacheStopBFE.loadDefault(); @@ -83,6 +89,8 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor mySQLCommandSFE.store(); phpRunFFE.store(); apacheRunFFE.store(); + httpdConfFFE.store(); + etcHostsFFE.store(); mysqlRunFFE.store(); apacheStartBFE.store(); @@ -118,20 +126,17 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); apacheSettingsGroup.setLayout(new GridLayout()); - - xamppStartSFE = new StringFieldEditor(IPreferenceConstants.XAMPP_START_PREF, PHPPreferencesMessages + xamppStartSFE = new FileFieldEditor(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 + xamppStopSFE = new FileFieldEditor(IPreferenceConstants.XAMPP_STOP_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup); xamppStopSFE.setPreferencePage(this); xamppStopSFE.setPreferenceStore(getPreferenceStore()); xamppStopSFE.load(); - new Label(apacheSettingsGroup, SWT.NONE); apacheStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup); @@ -182,6 +187,18 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheRunFFE.setPreferenceStore(getPreferenceStore()); apacheRunFFE.load(); + httpdConfFFE = new FileFieldEditor(IPreferenceConstants.HTTPD_CONF_PATH_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.apacheGroup.httpdconf"), apacheSettingsGroup); + httpdConfFFE.setPreferencePage(this); + httpdConfFFE.setPreferenceStore(getPreferenceStore()); + httpdConfFFE.load(); + + etcHostsFFE = new FileFieldEditor(IPreferenceConstants.ETC_HOSTS_PATH_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.apacheGroup.etchosts"), apacheSettingsGroup); + etcHostsFFE.setPreferencePage(this); + etcHostsFFE.setPreferenceStore(getPreferenceStore()); + etcHostsFFE.load(); + phpRunFFE = new FileFieldEditor(IPreferenceConstants.PHP_RUN_PREF, PHPPreferencesMessages .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup); phpRunFFE.setPreferencePage(this); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 495d57d..74845aa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -696,7 +696,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon String operatingSystem = Platform.getOS(); // maxosx, linux, solaris, win32,... try { - InputStream is = getDefault().openStream(new Path("prefs/default_" + operatingSystem + ".properties")); + InputStream is = getDefault().openStream( + new Path("prefs/default_" + operatingSystem + ".properties")); PropertyResourceBundle resourceBundle = new PropertyResourceBundle(is); Enumeration enum = resourceBundle.getKeys(); String key; @@ -704,19 +705,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon key = (String)enum.nextElement(); store.setDefault(key, resourceBundle.getString( key )); } -// store.setDefault(PHP_RUN_PREF, resourceBundle.getString(PHP_RUN_PREF)); -// store.setDefault(EXTERNAL_PARSER_PREF, resourceBundle.getString(EXTERNAL_PARSER_PREF)); -// store.setDefault(MYSQL_RUN_PREF, resourceBundle.getString(MYSQL_RUN_PREF)); -// store.setDefault(APACHE_RUN_PREF, resourceBundle.getString(APACHE_RUN_PREF)); -// -// store.setDefault(MYSQL_PREF, resourceBundle.getString(MYSQL_PREF)); -// store.setDefault(APACHE_START_PREF, resourceBundle.getString(APACHE_START_PREF)); -// store.setDefault(APACHE_STOP_PREF, resourceBundle.getString(APACHE_STOP_PREF)); -// store.setDefault(APACHE_RESTART_PREF, resourceBundle.getString(APACHE_RESTART_PREF)); -// store.setDefault(MYSQL_START_BACKGROUND, resourceBundle.getString(MYSQL_START_BACKGROUND)); -// store.setDefault(APACHE_START_BACKGROUND, resourceBundle.getString(APACHE_START_BACKGROUND)); -// store.setDefault(APACHE_STOP_BACKGROUND, resourceBundle.getString(APACHE_STOP_BACKGROUND)); -// store.setDefault(APACHE_RESTART_BACKGROUND, resourceBundle.getString(APACHE_RESTART_BACKGROUND)); } catch (Exception e) { // no default properties found if (operatingSystem.equals(Platform.OS_WIN32)) { @@ -726,6 +714,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon store.setDefault(APACHE_RUN_PREF, "c:\\apache\\apache.exe"); store.setDefault(XAMPP_START_PREF, "c:\\xampp\\xampp_start.exe"); store.setDefault(XAMPP_STOP_PREF, "c:\\xampp\\xampp_stop.exe"); + store.setDefault( + ETC_HOSTS_PATH_PREF, "c:\\windows\\system32\\drivers\\etc\\hosts"); } else { store.setDefault(PHP_RUN_PREF, "/apache/php/php"); store.setDefault(EXTERNAL_PARSER_PREF, "/apache/php/php -l -f {0}"); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties index 7db8fcf..19b09d6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties @@ -39,6 +39,8 @@ PHPBasePreferencePage.apacheGroup=Apache Settings PHPBasePreferencePage.apacheGroup.xampp_start=XAMPP Start PHPBasePreferencePage.apacheGroup.xampp_stop=XAMPP Stop PHPBasePreferencePage.apacheGroup.run=Apache +PHPBasePreferencePage.apacheGroup.httpdconf=httpd.conf +PHPBasePreferencePage.apacheGroup.etchosts=etc/hosts PHPBasePreferencePage.apacheGroup.start=Start Apache PHPBasePreferencePage.apacheGroup.start_background=Run in background mode PHPBasePreferencePage.apacheGroup.stop=Stop Apache -- 1.7.1