From bf6ca1918a2cdf63e6665beb3d80306ca9b4fee6 Mon Sep 17 00:00:00 2001 From: mbowie Date: Fri, 6 Jun 2008 05:52:00 +0000 Subject: [PATCH 1/1] Removes the "Show Line Numbers" option from the PHPEclipse preferences and sets the editor to use the setting as defined in the global "Text Editors" preferences. Some legacy (commented) code related to this still exists and should be removed prior to either the 1.3.0 or 1.5.0 release. closes #653 --- .../phpdt/internal/ui/PHPUIMessages.properties | 2 - .../ui/preferences/JavaEditorPreferencePage.java | 46 +++++++++++--------- .../ui/preferences/PreferencesMessages.properties | 5 +- .../sourceforge/phpdt/ui/PreferenceConstants.java | 28 ------------ .../phpeclipse/phpeditor/PHPEditor.java | 6 --- 5 files changed, 29 insertions(+), 58 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties index e8bbead..e1e7d3f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/PHPUIMessages.properties @@ -298,9 +298,7 @@ PHPEditorPreferencePage.codeAssist=Code A&ssist PHPEditorPreferencePage.change=C&hange... PHPEditorPreferencePage.empty_input=Empty input PHPEditorPreferencePage.invalid_input=''{0}'' is not a valid input. -PHPEditorPreferencePage.showLineNumbers=Show lin&e numbers PHPEditorPreferencePage.lineNumberColor=Line number foreground color: -PHPEditorPreferencePage.lineNumberForegroundColor=Line number foreground PHPEditorPreferencePage.matchingBracketsHighlightColor2=Matching brackets highlight PHPEditorPreferencePage.currentLineHighlighColor=Current line highlight PHPEditorPreferencePage.printMarginColor2=Print margin 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 e1700c5..7c6e28f 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 @@ -67,21 +67,26 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AnnotationPreference; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; + /** * The page for setting the editor options. */ @@ -185,11 +190,6 @@ public class JavaEditorPreferencePage extends PreferencePage implements private final String[][] fAppearanceColorListModel = new String[][] { { PreferencesMessages - .getString("JavaEditorPreferencePage.lineNumberForegroundColor"), - AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, - //$NON-NLS-1$ - { - PreferencesMessages .getString("JavaEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$ @@ -558,14 +558,6 @@ public class JavaEditorPreferencePage extends PreferencePage implements .add(new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER)); - overlayKeys - .add(new OverlayPreferenceStore.OverlayKey( - OverlayPreferenceStore.STRING, - AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR)); - overlayKeys - .add(new OverlayPreferenceStore.OverlayKey( - OverlayPreferenceStore.BOOLEAN, - AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS)); @@ -984,7 +976,28 @@ public class JavaEditorPreferencePage extends PreferencePage implements GridLayout layout = new GridLayout(); layout.numColumns = 2; appearanceComposite.setLayout(layout); + + // Inserts a hyper-link to the General Editor preferences page + // TODO Can probably be removed post 1.5.0? String label = PreferencesMessages + .getString("JavaEditorPreferencePage.appearanceTabLink"); + Link link = new Link(appearanceComposite, SWT.NONE); + GridData gridPosition = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + gridPosition.horizontalSpan = 2; + link.setLayoutData(gridPosition); + + link.setText(label); + link.addListener(SWT.Selection, new Listener () { + public void handleEvent(Event event) { + String u = event.text; + PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null); + } + }); + String tooltip = PreferencesMessages + .getString("JavaEditorPreferencePage.appearanceTabTooltip"); + link.setToolTipText(tooltip); + + label = PreferencesMessages .getString("JavaEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$ addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true); @@ -1003,13 +1016,6 @@ public class JavaEditorPreferencePage extends PreferencePage implements AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, 0); label = PreferencesMessages - .getString("JavaEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$ - addCheckBox( - appearanceComposite, - label, - AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, - 0); - label = PreferencesMessages .getString("JavaEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$ addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties index 4884b64..7a0486e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties @@ -80,6 +80,9 @@ NewJavaProjectPreferencePage.folders.error.invalidsrcname=Invalid source folder NewJavaProjectPreferencePage.folders.error.invalidbinname=Invalid output folder name: {0} NewJavaProjectPreferencePage.folders.error.invalidcp=Settings will result in an invalid build path. Check for nested folders. +JavaEditorPreferencePage.appearanceTabLink=Some general preferences now live on the Eclipse Text Editors pages. +JavaEditorPreferencePage.appearanceTabTooltip=Jump to the Text Editors page + JavaEditorPreferencePage.annotationsTab.title= Annotation&s JavaEditorPreferencePage.showQuickFixables= Indicate annotations solvable with &Quick Fix in vertical ruler JavaEditorPreferencePage.analyseAnnotationsWhileTyping= Analyze annotations &while typing @@ -160,8 +163,6 @@ JavaEditorPreferencePage.colors=Synta&x JavaEditorPreferencePage.codeAssist= &Code Assist JavaEditorPreferencePage.empty_input=Empty input JavaEditorPreferencePage.invalid_input=''{0}'' is not a valid input. -JavaEditorPreferencePage.showLineNumbers=Show lin&e numbers -JavaEditorPreferencePage.lineNumberForegroundColor=Line number foreground JavaEditorPreferencePage.matchingBracketsHighlightColor2=Matching brackets highlight JavaEditorPreferencePage.currentLineHighlighColor=Current line highlight JavaEditorPreferencePage.printMarginColor2=Print margin diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java index 1dfe2cf..60f8e03 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/PreferenceConstants.java @@ -1091,29 +1091,6 @@ public class PreferenceConstants { public final static String EDITOR_OVERVIEW_RULER = "overviewRuler"; //$NON-NLS-1$ /** - * A named preference that controls if the line number ruler is shown in the - * UI. - *

- * Value is of type Boolean. - *

- */ - public final static String EDITOR_LINE_NUMBER_RULER = "lineNumberRuler"; //$NON-NLS-1$ - - /** - * A named preference that holds the color used to render line numbers - * inside the line number ruler. - *

- * Value is of type String. A RGB color value encoded as a - * string using class PreferenceConverter - *

- * - * @see org.eclipse.jface.resource.StringConverter - * @see org.eclipse.jface.preference.PreferenceConverter - * @see #EDITOR_LINE_NUMBER_RULER - */ - public final static String EDITOR_LINE_NUMBER_RULER_COLOR = "lineNumberColor"; //$NON-NLS-1$ - - /** * A named preference that holds the color used to render linked positions * inside code templates. *

@@ -2760,11 +2737,6 @@ public class PreferenceConstants { store.setDefault(PreferenceConstants.EDITOR_OVERVIEW_RULER, true); - store.setDefault(PreferenceConstants.EDITOR_LINE_NUMBER_RULER, false); - PreferenceConverter.setDefault(store, - PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, new RGB(0, - 0, 0)); - // WorkbenchChainedTextFontFieldEditor.startPropagate(store, // JFaceResources.TEXT_FONT); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 0a09a2e..e8de8e0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -3063,12 +3063,6 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements */ private boolean fStickyOccurrenceAnnotations; - /** Preference key for showing the line number ruler */ - // private final static String LINE_NUMBER_RULER = - // PreferenceConstants.EDITOR_LINE_NUMBER_RULER; - /** Preference key for the foreground color of the line numbers */ - // private final static String LINE_NUMBER_COLOR = - // PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR; /** Preference key for the link color */ private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR; -- 1.7.1