X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java new file mode 100644 index 0000000..fbc578a --- /dev/null +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java @@ -0,0 +1,247 @@ +package net.sourceforge.phpdt.externaltools.preferences; + + +import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FileFieldEditor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.swt.SWT; +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; + +public class PHPExternalToolsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + +// StringFieldEditor phpParserExtensionsSFE; + StringFieldEditor xamppStartSFE; + StringFieldEditor xamppStopSFE; + StringFieldEditor apacheStartSFE; + + StringFieldEditor apacheStopSFE; + + StringFieldEditor apacheRestartSFE; + + StringFieldEditor mySQLCommandSFE; + + StringFieldEditor externalParserSFE; + + FileFieldEditor apacheRunFFE; + + FileFieldEditor mysqlRunFFE; + + FileFieldEditor phpRunFFE; + + BooleanFieldEditor apacheStartBFE; + + BooleanFieldEditor apacheStopBFE; + + BooleanFieldEditor apacheRestartBFE; + + BooleanFieldEditor mysqlStartBFE; + + public PHPExternalToolsPreferencePage() { + super(); + setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore()); + setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$ + } + + public void init(IWorkbench workbench) { + } + + protected void performDefaults() { +// phpParserExtensionsSFE.loadDefault(); + xamppStartSFE.loadDefault(); + xamppStopSFE.loadDefault(); + apacheStartSFE.loadDefault(); + apacheStopSFE.loadDefault(); + apacheRestartSFE.loadDefault(); + mySQLCommandSFE.loadDefault(); + externalParserSFE.loadDefault(); + phpRunFFE.loadDefault(); + apacheRunFFE.loadDefault(); + mysqlRunFFE.loadDefault(); + apacheStartBFE.loadDefault(); + apacheStopBFE.loadDefault(); + apacheRestartBFE.loadDefault(); + mysqlStartBFE.loadDefault(); + super.performDefaults(); + } + + public boolean performOk() { +// PHPFileUtil.setExtensions(null); +// phpParserExtensionsSFE.store(); + xamppStartSFE.store(); + xamppStopSFE.store(); + apacheStartSFE.store(); + apacheStopSFE.store(); + apacheRestartSFE.store(); + mySQLCommandSFE.store(); + externalParserSFE.store(); + phpRunFFE.store(); + apacheRunFFE.store(); + mysqlRunFFE.store(); + + apacheStartBFE.store(); + apacheStopBFE.store(); + apacheRestartBFE.store(); + mysqlStartBFE.store(); + return super.performOk(); + } + + protected Control createContents(Composite parent) { + initializeDialogUnits(parent); + final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore(); + Composite composite = new Composite(parent, SWT.LEFT); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + composite.setLayout(new GridLayout()); + + // 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()); + apacheSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Group apacheSettingsGroup = new Group(apacheSettingsComposite, SWT.NONE); + apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup")); + apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + apacheSettingsGroup.setLayout(new GridLayout()); + + + xamppStartSFE = new StringFieldEditor(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.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(ExternalToolsPlugin.APACHE_RUN_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup); + apacheRunFFE.setPreferencePage(this); + apacheRunFFE.setPreferenceStore(getPreferenceStore()); + apacheRunFFE.load(); + + phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.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); + mySQLSettingsComposite.setLayout(new GridLayout()); + mySQLSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Group mySQLSettingsGroup = new Group(mySQLSettingsComposite, SWT.NONE); + mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup")); + mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + mySQLSettingsGroup.setLayout(new GridLayout()); + + mysqlStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.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(ExternalToolsPlugin.MYSQL_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup); + mySQLCommandSFE.setPreferencePage(this); + mySQLCommandSFE.setPreferenceStore(getPreferenceStore()); + mySQLCommandSFE.load(); + new Label(mySQLSettingsGroup, SWT.NONE); + + mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup); + mysqlRunFFE.setPreferencePage(this); + mysqlRunFFE.setPreferenceStore(getPreferenceStore()); + mysqlRunFFE.load(); + + Composite parserSettingsComposite = new Composite(composite, SWT.NULL); + parserSettingsComposite.setLayout(new GridLayout()); + parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE); + parserSettingsGroup.setText("External parser command"); + parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + parserSettingsGroup.setLayout(new GridLayout()); + + externalParserSFE = + new StringFieldEditor( + ExternalToolsPlugin.EXTERNAL_PARSER_PREF, + PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"), + parserSettingsGroup + ); + externalParserSFE.setPreferencePage(this); + externalParserSFE.setPreferenceStore(getPreferenceStore()); + externalParserSFE.load(); + + return composite; + } +} \ No newline at end of file