mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 12:25:35 +02:00
Fix 84514 The makefileEditor preference settings are now
using the generatl settings from the platform
This commit is contained in:
parent
226ace7ccc
commit
0a6dc3da2e
4 changed files with 17 additions and 351 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -68,18 +69,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) {
|
||||
|
@ -378,24 +363,11 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
/*
|
||||
*/
|
||||
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();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
@ -235,35 +216,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
};
|
||||
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));
|
||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
|
||||
|
@ -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();
|
||||
|
@ -352,20 +276,7 @@ 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;
|
||||
|
@ -493,25 +363,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
}
|
||||
});
|
||||
|
||||
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) {
|
||||
// do nothing
|
||||
|
@ -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);
|
||||
|
@ -748,9 +447,6 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
|
|||
* @param preferenceStore
|
||||
*/
|
||||
public static void initDefaults(IPreferenceStore prefs) {
|
||||
EditorsUI.useAnnotationsPreferencePage(prefs);
|
||||
EditorsUI.useQuickDiffPreferencePage(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);
|
||||
|
|
Loading…
Add table
Reference in a new issue