diff options
author | Alain Magloire | 2005-02-17 01:04:46 +0000 |
---|---|---|
committer | Alain Magloire | 2005-02-17 01:04:46 +0000 |
commit | 0a6dc3da2e4f6cacc956effd5590fc0bfc53a105 (patch) | |
tree | a897c3a0677b78a5f8c0918839cd01a806a6be70 /build/org.eclipse.cdt.make.ui | |
parent | 226ace7ccc7bc8d749f01d998a17737e385b5a4f (diff) | |
download | org.eclipse.cdt-0a6dc3da2e4f6cacc956effd5590fc0bfc53a105.tar.gz org.eclipse.cdt-0a6dc3da2e4f6cacc956effd5590fc0bfc53a105.tar.xz org.eclipse.cdt-0a6dc3da2e4f6cacc956effd5590fc0bfc53a105.zip |
Fix 84514 The makefileEditor preference settings are now
using the generatl settings from the platform
Diffstat (limited to 'build/org.eclipse.cdt.make.ui')
4 files changed, 17 insertions, 351 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPreferenceInitializer.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPreferenceInitializer.java index d4f3225d56b..7f8a8613545 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPreferenceInitializer.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPreferenceInitializer.java @@ -12,6 +12,7 @@ import org.eclipse.cdt.make.internal.ui.preferences.MakePreferencePage; import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferenceConstants; import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferencePage; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; public class MakeUIPreferenceInitializer extends AbstractPreferenceInitializer { @@ -20,9 +21,10 @@ public class MakeUIPreferenceInitializer extends AbstractPreferenceInitializer { * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ public void initializeDefaultPreferences() { - MakePreferencePage.initDefaults(MakeUIPlugin.getDefault().getPreferenceStore()); - MakefileEditorPreferenceConstants.initializeDefaultValues(MakeUIPlugin.getDefault().getPreferenceStore()); - MakefileEditorPreferencePage.initDefaults(MakeUIPlugin.getDefault().getPreferenceStore()); + IPreferenceStore store = MakeUIPlugin.getDefault().getPreferenceStore(); + MakePreferencePage.initDefaults(store); + MakefileEditorPreferenceConstants.initializeDefaultValues(store); + MakefileEditorPreferencePage.initDefaults(store); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java index 760ad306930..f39c1b7c965 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java @@ -34,7 +34,6 @@ import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; import org.eclipse.jface.text.source.projection.ProjectionSupport; import org.eclipse.jface.text.source.projection.ProjectionViewer; -import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelection; @@ -45,7 +44,9 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IPartService; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextEditor; +import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.DefaultRangeIndicator; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; @@ -69,18 +70,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe private ListenerList fReconcilingListeners= new ListenerList(); /** - * Property changes update the scanner - */ - final IPropertyChangeListener fPropertyChangeListener= new IPropertyChangeListener() { - /* - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - handlePreferenceStoreChanged(event); - } - }; - - /** * Adapted source viewer for CEditor */ @@ -137,7 +126,11 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#MakefileRulerContext"); //$NON-NLS-1$ setDocumentProvider(MakeUIPlugin.getDefault().getMakefileDocumentProvider()); - setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore()); + IPreferenceStore[] stores = new IPreferenceStore[2]; + stores[0] = MakeUIPlugin.getDefault().getPreferenceStore(); + stores[1] = EditorsUI.getPreferenceStore(); + ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(stores); + setPreferenceStore(chainedStore); } /* (non-Javadoc) @@ -148,10 +141,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe fProjectionMakefileUpdater.uninstall(); fProjectionMakefileUpdater= null; } - if (fPropertyChangeListener != null) { - IPreferenceStore preferenceStore = getPreferenceStore(); - preferenceStore.removePropertyChangeListener(fPropertyChangeListener); - } super.dispose(); } @@ -181,10 +170,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe fProjectionMakefileUpdater.install(this, projectionViewer); fProjectionMakefileUpdater.initialize(); } - - IPreferenceStore preferenceStore = getPreferenceStore(); - preferenceStore.addPropertyChangeListener(fPropertyChangeListener); - } protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { @@ -377,25 +362,12 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe /* */ - public void reconciled() { - - + public void reconciled() { // Notify listeners Object[] listeners = fReconcilingListeners.getListeners(); - for (int i = 0, length= listeners.length; i < length; ++i) + for (int i = 0, length= listeners.length; i < length; ++i) { ((IReconcilingParticipant)listeners[i]).reconciled(); - -// // Update Java Outline page selection -// if (!forced && !progressMonitor.isCanceled()) { -// Shell shell= getSite().getShell(); -// if (shell != null && !shell.isDisposed()) { -// shell.getDisplay().asyncExec(new Runnable() { -// public void run() { -// selectionChanged(); -// } -// }); -// } -// } + } } /* diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferenceConstants.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferenceConstants.java index 570be9282f1..4f586738da5 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferenceConstants.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferenceConstants.java @@ -12,8 +12,6 @@ package org.eclipse.cdt.make.internal.ui.preferences; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.ui.editors.text.TextEditorPreferenceConstants; -import org.eclipse.ui.texteditor.AbstractTextEditor; /** * MakefileEditorPreferenceConstants @@ -57,8 +55,6 @@ public class MakefileEditorPreferenceConstants { public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$ public static void initializeDefaultValues(IPreferenceStore store) { - TextEditorPreferenceConstants.initializeDefaultValues(store); - store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); store.setDefault(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, false); store.setDefault(MakefileEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF, false); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java index 2b55d09e63f..564170b2539 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java @@ -32,23 +32,17 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; 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.swt.widgets.List; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; -import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.help.WorkbenchHelp; import org.eclipse.ui.model.WorkbenchViewerSorter; -import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; -import org.eclipse.ui.texteditor.AbstractTextEditor; /** @@ -62,15 +56,11 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen private TableViewer fHighlightingColorListViewer; private final java.util.List fHighlightingColorList= new ArrayList(5); - List fAppearanceColorList; ColorEditor fAppearanceColorEditor; Button fAppearanceColorDefault; ColorEditor fSyntaxForegroundColorEditor; ColorEditor fBackgroundColorEditor; - private Button fBackgroundDefaultRadioButton; - Button fBackgroundCustomRadioButton; - Button fBackgroundColorButton; Button fBoldCheckBox; Button fItalicCheckBox; @@ -81,15 +71,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen protected ArrayList fComboBoxes; - final String[][] fAppearanceColorListModel= new String[][] { - {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.lineNumberForegroundColor"), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, null}, //$NON-NLS-1$ - {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.currentLineHighlighColor"), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, null}, //$NON-NLS-1$ - {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.printMarginColor"), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, null}, //$NON-NLS-1$ - {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.foreground"), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR}, //$NON-NLS-1$ - {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.background"), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR}, //$NON-NLS-1$ - }; - - /** * Item in the highlighting color list. * @@ -234,35 +215,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen {MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.makefile_editor_keyword"), ColorManager.MAKE_KEYWORD_COLOR, null}, //$NON-NLS-1$ }; ArrayList overlayKeys= new ArrayList(); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR)); - - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN)); - - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH)); - - overlayKeys.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, MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL)); @@ -289,7 +241,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ protected Control createContents(Composite parent) { - initializeDefaultColors(); WorkbenchHelp.setHelp(getControl(), IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE); getOverlayStore().load(); getOverlayStore().start(); @@ -299,10 +250,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen folder.setLayoutData(new GridData(GridData.FILL_BOTH)); TabItem item= new TabItem(folder, SWT.NONE); - item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.appearance")); //$NON-NLS-1$ - item.setControl(createAppearancePage(folder)); - - item= new TabItem(folder, SWT.NONE); item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.syntax")); //$NON-NLS-1$ item.setControl(createSyntaxPage(folder)); @@ -316,29 +263,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen return folder; } - private void initializeDefaultColors() { - if (!getPreferenceStore().contains(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) { - RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(); - PreferenceConverter.setDefault(getOverlayStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, rgb); - PreferenceConverter.setDefault(getPreferenceStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, rgb); - } - if (!getPreferenceStore().contains(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND)) { - RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB(); - PreferenceConverter.setDefault(getOverlayStore(), AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, rgb); - PreferenceConverter.setDefault(getPreferenceStore(), AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, rgb); - } - if (!getPreferenceStore().contains(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR)) { - RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(); - PreferenceConverter.setDefault(getOverlayStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR, rgb); - PreferenceConverter.setDefault(getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR, rgb); - } - if (!getPreferenceStore().contains(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR)) { - RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT).getRGB(); - PreferenceConverter.setDefault(getOverlayStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, rgb); - PreferenceConverter.setDefault(getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, rgb); - } - } - private void initialize() { initializeFields(); @@ -351,21 +275,8 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen } fHighlightingColorListViewer.setInput(fHighlightingColorList); fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0))); - - for (int i= 0; i < fAppearanceColorListModel.length; i++) { - fAppearanceColorList.add(fAppearanceColorListModel[i][0]); - } - fAppearanceColorList.getDisplay().asyncExec(new Runnable() { - public void run() { - if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) { - fAppearanceColorList.select(0); - handleAppearanceColorListSelection(); - } - } - }); initializeFolding(); - initializeBackgroundColorFields(); } void initializeFolding() { @@ -378,26 +289,11 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen fFoldingCheckbox.setSelection(enabled); } - /** - * - */ - private void initializeBackgroundColorFields() { - RGB rgb= PreferenceConverter.getColor(getOverlayStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); - fBackgroundColorEditor.setColorValue(rgb); - - boolean dflt= getOverlayStore().getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT); - fBackgroundDefaultRadioButton.setSelection(dflt); - fBackgroundCustomRadioButton.setSelection(!dflt); - fBackgroundColorButton.setEnabled(!dflt); - } - /* (non-Javadoc) * @see org.eclipse.ant.internal.ui.preferences.AbstractMakefileEditorPreferencePage#handleDefaults() */ protected void handleDefaults() { - handleAppearanceColorListSelection(); handleSyntaxColorListSelection(); - initializeBackgroundColorFields(); initializeDefaultFolding(); } @@ -406,38 +302,12 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen Composite colorComposite= new Composite(parent, SWT.NONE); colorComposite.setLayout(new GridLayout()); - Group backgroundComposite= new Group(colorComposite, SWT.SHADOW_ETCHED_IN); - GridLayout layout= new GridLayout(); - layout.numColumns= 3; - backgroundComposite.setLayout(layout); - backgroundComposite.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.backcolor")); //$NON-NLS-1$ - - SelectionListener backgroundSelectionListener= new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - boolean custom= fBackgroundCustomRadioButton.getSelection(); - fBackgroundColorButton.setEnabled(custom); - getOverlayStore().setValue(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, !custom); - } - public void widgetDefaultSelected(SelectionEvent e) {} - }; - - fBackgroundDefaultRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT); - fBackgroundDefaultRadioButton.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.systemdefault")); //$NON-NLS-1$ - fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener); - - fBackgroundCustomRadioButton= new Button(backgroundComposite, SWT.RADIO | SWT.LEFT); - fBackgroundCustomRadioButton.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.custom")); //$NON-NLS-1$ - fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener); - - fBackgroundColorEditor= new ColorEditor(backgroundComposite); - fBackgroundColorButton= fBackgroundColorEditor.getButton(); - Label label= new Label(colorComposite, SWT.LEFT); label.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.Foreground")); //$NON-NLS-1$ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite editorComposite= new Composite(colorComposite, SWT.NONE); - layout= new GridLayout(); + GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.marginHeight= 0; layout.marginWidth= 0; @@ -492,25 +362,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen handleSyntaxColorListSelection(); } }); - - foregroundColorButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } - public void widgetSelected(SelectionEvent e) { - HighlightingColorListItem item= getHighlightingColorListItem(); - PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue()); - } - }); - - fBackgroundColorButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } - public void widgetSelected(SelectionEvent e) { - PreferenceConverter.setValue(getOverlayStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, fBackgroundColorEditor.getColorValue()); - } - }); fBoldCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { @@ -535,158 +386,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen return colorComposite; } - void handleAppearanceColorListSelection() { - int i= fAppearanceColorList.getSelectionIndex(); - String key= fAppearanceColorListModel[i][1]; - RGB rgb= PreferenceConverter.getColor(getOverlayStore(), key); - fAppearanceColorEditor.setColorValue(rgb); - updateAppearanceColorWidgets(fAppearanceColorListModel[i][2]); - } - - private void updateAppearanceColorWidgets(String systemDefaultKey) { - if (systemDefaultKey == null) { - fAppearanceColorDefault.setSelection(false); - fAppearanceColorDefault.setVisible(false); - fAppearanceColorEditor.getButton().setEnabled(true); - } else { - boolean systemDefault= getOverlayStore().getBoolean(systemDefaultKey); - fAppearanceColorDefault.setSelection(systemDefault); - fAppearanceColorDefault.setVisible(true); - fAppearanceColorEditor.getButton().setEnabled(!systemDefault); - } - } - - private Control createAppearancePage(Composite parent) { - Font font= parent.getFont(); - - Composite appearanceComposite= new Composite(parent, SWT.NONE); - appearanceComposite.setFont(font); - GridLayout layout= new GridLayout(); - layout.numColumns= 2; - appearanceComposite.setLayout(layout); - - String labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$ - String[] errorMessages= new String[]{MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.empty_input_print_margin"), MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.invalid_input_print_margin")}; //$NON-NLS-1$//$NON-NLS-2$ - addTextField(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, errorMessages); - - labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.tabwidth"); //$NON-NLS-1$ - errorMessages= new String[]{MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.notabwidth"), MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.39")}; //$NON-NLS-1$ //$NON-NLS-2$ - addTextField(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, errorMessages); - -// labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.spacetabs"); //$NON-NLS-1$ -// addCheckBox(appearanceComposite, labelText, MakefileEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, 1); - - labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$ - addCheckBox(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, 0); - - labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$ - addCheckBox(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0); - - labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$ - addCheckBox(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, 0); - - labelText= MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$ - addCheckBox(appearanceComposite, labelText, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, 0); - - - Label label= new Label(appearanceComposite, SWT.LEFT ); - label.setFont(font); - GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan= 2; - gd.heightHint= convertHeightInCharsToPixels(1) / 2; - label.setLayoutData(gd); - - label= new Label(appearanceComposite, SWT.LEFT); - label.setFont(font); - label.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$ - gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan= 2; - label.setLayoutData(gd); - - Composite editorComposite= new Composite(appearanceComposite, SWT.NONE); - editorComposite.setFont(font); - layout= new GridLayout(); - layout.numColumns= 2; - layout.marginHeight= 0; - layout.marginWidth= 0; - editorComposite.setLayout(layout); - gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); - gd.horizontalSpan= 2; - editorComposite.setLayoutData(gd); - - fAppearanceColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER); - fAppearanceColorList.setFont(font); - gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); - gd.heightHint= convertHeightInCharsToPixels(6); - fAppearanceColorList.setLayoutData(gd); - - Composite stylesComposite= new Composite(editorComposite, SWT.NONE); - stylesComposite.setFont(font); - layout= new GridLayout(); - layout.marginHeight= 0; - layout.marginWidth= 0; - layout.numColumns= 2; - stylesComposite.setLayout(layout); - stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - label= new Label(stylesComposite, SWT.LEFT); - label.setFont(font); - label.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.color")); //$NON-NLS-1$ - gd= new GridData(); - gd.horizontalAlignment= GridData.BEGINNING; - label.setLayoutData(gd); - - fAppearanceColorEditor= new ColorEditor(stylesComposite); - Button foregroundColorButton= fAppearanceColorEditor.getButton(); - foregroundColorButton.setFont(font); - gd= new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalAlignment= GridData.BEGINNING; - foregroundColorButton.setLayoutData(gd); - - fAppearanceColorList.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } - public void widgetSelected(SelectionEvent e) { - handleAppearanceColorListSelection(); - } - }); - - SelectionListener colorDefaultSelectionListener= new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - boolean systemDefault= fAppearanceColorDefault.getSelection(); - fAppearanceColorEditor.getButton().setEnabled(!systemDefault); - - int i= fAppearanceColorList.getSelectionIndex(); - String key= fAppearanceColorListModel[i][2]; - if (key != null) - getOverlayStore().setValue(key, systemDefault); - } - public void widgetDefaultSelected(SelectionEvent e) {} - }; - - fAppearanceColorDefault= new Button(stylesComposite, SWT.CHECK); - fAppearanceColorDefault.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.systemdefault")); //$NON-NLS-1$ - gd= new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalAlignment= GridData.BEGINNING; - gd.horizontalSpan= 2; - fAppearanceColorDefault.setLayoutData(gd); - fAppearanceColorDefault.setVisible(false); - fAppearanceColorDefault.addSelectionListener(colorDefaultSelectionListener); - - foregroundColorButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // do nothing - } - public void widgetSelected(SelectionEvent e) { - int i= fAppearanceColorList.getSelectionIndex(); - String key= fAppearanceColorListModel[i][1]; - - PreferenceConverter.setValue(getOverlayStore(), key, fAppearanceColorEditor.getColorValue()); - } - }); - return appearanceComposite; - } private Composite createFoldingTabContent(TabFolder folder) { Composite composite= new Composite(folder, SWT.NULL); @@ -747,10 +446,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen /** * @param preferenceStore */ - public static void initDefaults(IPreferenceStore prefs) { - EditorsUI.useAnnotationsPreferencePage(prefs); - EditorsUI.useQuickDiffPreferencePage(prefs); - + public static void initDefaults(IPreferenceStore prefs) { // Makefile Editor color preferences PreferenceConverter.setDefault(prefs, ColorManager.MAKE_COMMENT_COLOR, ColorManager.MAKE_COMMENT_RGB); PreferenceConverter.setDefault(prefs, ColorManager.MAKE_DEFAULT_COLOR, ColorManager.MAKE_DEFAULT_RGB); |