From 8d40d1cb97f873ca34ece652cc43f00fb606554f Mon Sep 17 00:00:00 2001 From: khartlage Date: Sun, 27 Jun 2004 10:14:47 +0000 Subject: [PATCH 1/1] misc preferences improvements --- .../plugin.xml | 4 +- net.sourceforge.phpeclipse/plugin.properties | 1 + net.sourceforge.phpeclipse/plugin.xml | 12 +- .../ui/preferences/JavaEditorPreferencePage.java | 10 +- .../phpeclipse/IPreferenceConstants.java | 4 +- .../phpeclipse/PHPEclipseParserPreferencePage.java | 112 -------------------- .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 6 +- .../phpeclipse/phpeditor/PHPParserAction.java | 23 +--- .../PHPEclipseParserPreferencePage.java | 110 +++++++++++++++++++ 9 files changed, 133 insertions(+), 149 deletions(-) delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPEclipseParserPreferencePage.java diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml index 030c378..ffc897b 100644 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml @@ -180,13 +180,13 @@ class="com.quantum.preferences.SQLEditorPreferences" id="com.quantum.preferences.editor"> - - @@ -1382,13 +1382,13 @@ category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage" class="net.sourceforge.phpeclipse.PHPLanguagePreferencePage" id="net.sourceforge.phpeclipse.preference.PHPLanguagePreferencePage"> - --> + - + --> diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java index c8ed48e..c25ed26 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java @@ -1605,13 +1605,11 @@ public class JavaEditorPreferencePage extends PreferencePage item= new TabItem(folder, SWT.NONE); item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$ - fJavaEditorHoverConfigurationBlock= new - JavaEditorHoverConfigurationBlock(this, fOverlayStore); + fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(this, fOverlayStore); item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder)); - item= new TabItem(folder, SWT.NONE); - item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.navigationTab.title")); - //$NON-NLS-1$ - item.setControl(createNavigationPage(folder)); +// item= new TabItem(folder, SWT.NONE); +// item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.navigationTab.title")); //$NON-NLS-1$ +// item.setControl(createNavigationPage(folder)); item= new TabItem(folder, SWT.NONE); item.setText(PreferencesMessages.getString("JavaEditorPreferencePage.folding.title")); //$NON-NLS-1$ item.setControl(fFoldingConfigurationBlock.createControl(folder)); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java index 9016106..a4c52bb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java @@ -50,8 +50,8 @@ public interface IPreferenceConstants { public static final String PHP_RUN_PREF = "_php_run_pref"; public static final String EXTERNAL_PARSER_PREF = "_external_parser"; public static final String PHP_PARSER_DEFAULT = "_php_parser_default"; - public static final String PHP_INTERNAL_PARSER = "_php_internal_parser"; - public static final String PHP_EXTERNAL_PARSER = "_php_external_parser"; +// public static final String PHP_INTERNAL_PARSER = "_php_internal_parser"; +// public static final String PHP_EXTERNAL_PARSER = "_php_external_parser"; // public static final String PHP_PARSE_ON_SAVE = "_php_parse_on_save"; public static final String PHP_MULTILINE_COMMENT = "_php_multilineComment"; public static final String PHP_MULTILINE_COMMENT_BOLD = "_php_multilineComment_bold"; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java deleted file mode 100644 index 0d3ecae..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java +++ /dev/null @@ -1,112 +0,0 @@ -package net.sourceforge.phpeclipse; - -import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages; - -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.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.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -public class PHPEclipseParserPreferencePage 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(); - - - RadioGroupFieldEditor chooseParser; - StringFieldEditor externalParserSFE; - // BooleanFieldEditor parseOnSave; - - public PHPEclipseParserPreferencePage() { - super(); - setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); - setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$ - } - public void init(IWorkbench workbench) { - } - protected void performDefaults() { - chooseParser.loadDefault(); - externalParserSFE.loadDefault(); -// parseOnSave.loadDefault(); - super.performDefaults(); - } - - public boolean performOk() { - chooseParser.store(); - externalParserSFE.store(); -// parseOnSave.store(); - return super.performOk(); - } - - protected Control createContents(Composite parent) { - initializeDialogUnits(parent); - final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); - 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)); - - //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; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index b094bc7..a9cb199 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -683,9 +683,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements store.setDefault(APACHE_START_BACKGROUND, "true"); store.setDefault(APACHE_STOP_BACKGROUND, "true"); store.setDefault(APACHE_RESTART_BACKGROUND, "true"); - store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER); - store.setDefault(PHP_INTERNAL_PARSER, "false"); - store.setDefault(PHP_EXTERNAL_PARSER, "true"); +// store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER); +// store.setDefault(PHP_INTERNAL_PARSER, "false"); +// store.setDefault(PHP_EXTERNAL_PARSER, "true"); // store.setDefault(PHP_PARSE_ON_SAVE, "true"); // show line numbers: // store.setDefault(LINE_NUMBER_RULER, "false"); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java index 38534c7..940d68b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java @@ -87,27 +87,14 @@ public class PHPParserAction extends TextEditorAction { } if (phpFlag) { IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); - if (store.getString(PHPeclipsePlugin.PHP_PARSER_DEFAULT).equals(PHPeclipsePlugin.PHP_INTERNAL_PARSER)) { -// // first delete all the previous markers -// fileToParse.deleteMarkers(IMarker.PROBLEM, false, 0); -// -// //the tasks are removed here -// fileToParse.deleteMarkers(IMarker.TASK, false, 0); - PHPBuilder.removeProblemsAndTasksFor(fileToParse); - // try { - // InputStream iStream = fileToParse.getContents(); - parse(fileToParse); //, iStream); - // iStream.close(); - // } catch (IOException e) { - // } - } else { +// if (store.getString(PHPeclipsePlugin.PHP_PARSER_DEFAULT).equals(PHPeclipsePlugin.PHP_INTERNAL_PARSER)) { +// PHPBuilder.removeProblemsAndTasksFor(fileToParse); +// parse(fileToParse); //, iStream); +// } else { ExternalPHPParser parser = new ExternalPHPParser(fileToParse); parser.phpExternalParse(); - } +// } } -// } catch (CoreException e) { -// } - } /** * Finds the file that's currently opened in the PHP Text Editor diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPEclipseParserPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPEclipseParserPreferencePage.java new file mode 100644 index 0000000..1c5a98f --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPEclipseParserPreferencePage.java @@ -0,0 +1,110 @@ +package net.sourceforge.phpeclipse.preferences; + +import net.sourceforge.phpeclipse.IPreferenceConstants; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; + +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.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.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class PHPEclipseParserPreferencePage 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(); + + +// RadioGroupFieldEditor chooseParser; + StringFieldEditor externalParserSFE; + // BooleanFieldEditor parseOnSave; + + public PHPEclipseParserPreferencePage() { + super(); + setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); + setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$ + } + + public void init(IWorkbench workbench) { + } + protected void performDefaults() { +// chooseParser.loadDefault(); + externalParserSFE.loadDefault(); +// parseOnSave.loadDefault(); + super.performDefaults(); + } + + public boolean performOk() { +// chooseParser.store(); + externalParserSFE.store(); +// parseOnSave.store(); + return super.performOk(); + } + + protected Control createContents(Composite parent) { + initializeDialogUnits(parent); + final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + Composite composite = new Composite(parent, SWT.LEFT); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + composite.setLayout(new GridLayout()); + + //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; + } +} -- 1.7.1