mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2004-05-18 Alain Magloire
Fix PR 61498 Removing the Annotation Page from the CEditor preference.
This commit is contained in:
parent
db5fe28b4e
commit
245a435785
3 changed files with 10 additions and 223 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-05-18 Alain Magloire
|
||||||
|
|
||||||
|
Fix PR 61498
|
||||||
|
Removing the Annotation Page from the CEditor preference.
|
||||||
|
|
||||||
2004-05-16 Bogdan Gheorghe
|
2004-05-16 Bogdan Gheorghe
|
||||||
Added sorters to the search results
|
Added sorters to the search results
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,6 @@ import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
|
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
|
||||||
import org.eclipse.ui.texteditor.AnnotationPreference;
|
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
|
||||||
import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
|
import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -133,9 +131,6 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
protected List fAppearanceColorList;
|
protected List fAppearanceColorList;
|
||||||
protected ColorEditor fAppearanceForegroundColorEditor;
|
protected ColorEditor fAppearanceForegroundColorEditor;
|
||||||
|
|
||||||
private final String[][] fAnnotationColorListModel;
|
|
||||||
private ColorEditor fAnnotationForegroundColorEditor;
|
|
||||||
private List fAnnotationList;
|
|
||||||
private Button fShowInOverviewRulerCheckBox;
|
private Button fShowInOverviewRulerCheckBox;
|
||||||
private Button fShowInVerticalRulerCheckBox;
|
private Button fShowInVerticalRulerCheckBox;
|
||||||
private Button fShowInTextCheckBox;
|
private Button fShowInTextCheckBox;
|
||||||
|
@ -143,27 +138,11 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
public CEditorPreferencePage() {
|
public CEditorPreferencePage() {
|
||||||
setDescription(CUIPlugin.getResourceString("CEditorPreferencePage.description")); //$NON-NLS-1$
|
setDescription(CUIPlugin.getResourceString("CEditorPreferencePage.description")); //$NON-NLS-1$
|
||||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||||
MarkerAnnotationPreferences preferences = new MarkerAnnotationPreferences();
|
fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), createOverlayStoreKeys());
|
||||||
fAnnotationColorListModel = createAnnotationTypeListModel(preferences);
|
|
||||||
fOverlayStore = createOverlayStore(preferences);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private OverlayPreferenceStore createOverlayStore(MarkerAnnotationPreferences preferences) {
|
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
|
||||||
ArrayList overlayKeys = new ArrayList();
|
ArrayList overlayKeys = new ArrayList();
|
||||||
Iterator e = preferences.getAnnotationPreferences().iterator();
|
|
||||||
while (e.hasNext()) {
|
|
||||||
AnnotationPreference info = (AnnotationPreference) e.next();
|
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
|
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
|
|
||||||
overlayKeys.add(
|
|
||||||
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey()));
|
|
||||||
|
|
||||||
String verticalKey = info.getVerticalRulerPreferenceKey();
|
|
||||||
if (verticalKey != null){
|
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, verticalKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.PREFERENCE_COLOR_FOREGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.PREFERENCE_COLOR_FOREGROUND));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,CEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,CEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.PREFERENCE_COLOR_BACKGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.PREFERENCE_COLOR_BACKGROUND));
|
||||||
|
@ -217,7 +196,7 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
|
|
||||||
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
|
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
|
||||||
overlayKeys.toArray(keys);
|
overlayKeys.toArray(keys);
|
||||||
return new OverlayPreferenceStore(getPreferenceStore(), keys);
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initDefaults(IPreferenceStore store) {
|
public static void initDefaults(IPreferenceStore store) {
|
||||||
|
@ -225,22 +204,6 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
Color color;
|
Color color;
|
||||||
Display display = Display.getDefault();
|
Display display = Display.getDefault();
|
||||||
|
|
||||||
MarkerAnnotationPreferences preferences = new MarkerAnnotationPreferences();
|
|
||||||
Iterator e = preferences.getAnnotationPreferences().iterator();
|
|
||||||
while (e.hasNext()) {
|
|
||||||
AnnotationPreference info = (AnnotationPreference) e.next();
|
|
||||||
store.setDefault(info.getTextPreferenceKey(), info.getTextPreferenceValue());
|
|
||||||
store.setDefault(info.getOverviewRulerPreferenceKey(), info.getOverviewRulerPreferenceValue());
|
|
||||||
|
|
||||||
String verticalRulerKey = info.getVerticalRulerPreferenceKey();
|
|
||||||
boolean verticalRulerPreference = info.getVerticalRulerPreferenceValue();
|
|
||||||
|
|
||||||
if (verticalRulerKey != null){
|
|
||||||
store.setDefault(verticalRulerKey,verticalRulerPreference);
|
|
||||||
}
|
|
||||||
|
|
||||||
PreferenceConverter.setDefault(store, info.getColorPreferenceKey(), info.getColorPreferenceValue());
|
|
||||||
}
|
|
||||||
store.setDefault(CEditor.MATCHING_BRACKETS, true);
|
store.setDefault(CEditor.MATCHING_BRACKETS, true);
|
||||||
color = display.getSystemColor(SWT.COLOR_GRAY);
|
color = display.getSystemColor(SWT.COLOR_GRAY);
|
||||||
PreferenceConverter.setDefault(store, CEditor.MATCHING_BRACKETS_COLOR, color.getRGB());
|
PreferenceConverter.setDefault(store, CEditor.MATCHING_BRACKETS_COLOR, color.getRGB());
|
||||||
|
@ -335,173 +298,6 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + "_bold")); //$NON-NLS-1$
|
fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + "_bold")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private Control createAnnotationsPage(Composite parent) {
|
|
||||||
Composite composite = new Composite(parent, SWT.NULL);
|
|
||||||
GridLayout layout = new GridLayout();
|
|
||||||
layout.numColumns = 2;
|
|
||||||
composite.setLayout(layout);
|
|
||||||
|
|
||||||
Label label = new Label(composite, SWT.LEFT);
|
|
||||||
label.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationsPage.presentationOptions")); //$NON-NLS-1$
|
|
||||||
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
label.setLayoutData(gd);
|
|
||||||
|
|
||||||
Composite editorComposite = new Composite(composite, SWT.NONE);
|
|
||||||
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);
|
|
||||||
|
|
||||||
fAnnotationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
|
|
||||||
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
|
|
||||||
gd.heightHint = convertHeightInCharsToPixels(8);
|
|
||||||
fAnnotationList.setLayoutData(gd);
|
|
||||||
|
|
||||||
Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
|
|
||||||
layout = new GridLayout();
|
|
||||||
layout.marginHeight = 0;
|
|
||||||
layout.marginWidth = 0;
|
|
||||||
layout.numColumns = 2;
|
|
||||||
optionsComposite.setLayout(layout);
|
|
||||||
optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
||||||
|
|
||||||
fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
|
|
||||||
fShowInTextCheckBox.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationsPage.showInText")); //$NON-NLS-1$
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalAlignment = GridData.BEGINNING;
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
fShowInTextCheckBox.setLayoutData(gd);
|
|
||||||
|
|
||||||
fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
|
|
||||||
fShowInOverviewRulerCheckBox.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationsPage.showInOverview")); //$NON-NLS-1$
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalAlignment = GridData.BEGINNING;
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
fShowInOverviewRulerCheckBox.setLayoutData(gd);
|
|
||||||
|
|
||||||
fShowInVerticalRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
|
|
||||||
fShowInVerticalRulerCheckBox.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationsPage.showInVertical")); //$NON-NLS-1$
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalAlignment = GridData.BEGINNING;
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
fShowInVerticalRulerCheckBox.setLayoutData(gd);
|
|
||||||
|
|
||||||
label = new Label(optionsComposite, SWT.LEFT);
|
|
||||||
label.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationsPage.color")); //$NON-NLS-1$
|
|
||||||
gd = new GridData();
|
|
||||||
gd.horizontalAlignment = GridData.BEGINNING;
|
|
||||||
label.setLayoutData(gd);
|
|
||||||
|
|
||||||
fAnnotationForegroundColorEditor = new ColorEditor(optionsComposite);
|
|
||||||
Button foregroundColorButton = fAnnotationForegroundColorEditor.getButton();
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
gd.horizontalAlignment = GridData.BEGINNING;
|
|
||||||
foregroundColorButton.setLayoutData(gd);
|
|
||||||
|
|
||||||
fAnnotationList.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
handleAnnotationListSelection();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
int i = fAnnotationList.getSelectionIndex();
|
|
||||||
String key = fAnnotationColorListModel[i][2];
|
|
||||||
fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
int i = fAnnotationList.getSelectionIndex();
|
|
||||||
String key = fAnnotationColorListModel[i][3];
|
|
||||||
fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fShowInVerticalRulerCheckBox.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
int i = fAnnotationList.getSelectionIndex();
|
|
||||||
String key = fAnnotationColorListModel[i][4];
|
|
||||||
fOverlayStore.setValue(key, fShowInVerticalRulerCheckBox.getSelection());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
foregroundColorButton.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
int i = fAnnotationList.getSelectionIndex();
|
|
||||||
String key = fAnnotationColorListModel[i][1];
|
|
||||||
PreferenceConverter.setValue(fOverlayStore, key, fAnnotationForegroundColorEditor.getColorValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
WorkbenchHelp.setHelp(composite, ICHelpContextIds.C_EDITOR_ANNOTATIONS_PREF_PAGE);
|
|
||||||
return composite;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleAnnotationListSelection() {
|
|
||||||
int i = fAnnotationList.getSelectionIndex();
|
|
||||||
|
|
||||||
String key = fAnnotationColorListModel[i][1];
|
|
||||||
RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
|
|
||||||
fAnnotationForegroundColorEditor.setColorValue(rgb);
|
|
||||||
|
|
||||||
key = fAnnotationColorListModel[i][2];
|
|
||||||
fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
|
|
||||||
|
|
||||||
key = fAnnotationColorListModel[i][3];
|
|
||||||
fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
|
|
||||||
|
|
||||||
key = fAnnotationColorListModel[i][4];
|
|
||||||
if (key != null){
|
|
||||||
fShowInVerticalRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[][] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) {
|
|
||||||
ArrayList listModelItems = new ArrayList();
|
|
||||||
Iterator e = preferences.getAnnotationPreferences().iterator();
|
|
||||||
while (e.hasNext()) {
|
|
||||||
AnnotationPreference info = (AnnotationPreference) e.next();
|
|
||||||
listModelItems.add(
|
|
||||||
new String[] {
|
|
||||||
info.getPreferenceLabel(),
|
|
||||||
info.getColorPreferenceKey(),
|
|
||||||
info.getTextPreferenceKey(),
|
|
||||||
info.getOverviewRulerPreferenceKey(),
|
|
||||||
info.getVerticalRulerPreferenceKey()});
|
|
||||||
}
|
|
||||||
String[][] items = new String[listModelItems.size()][];
|
|
||||||
listModelItems.toArray(items);
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Control createColorPage(Composite parent) {
|
private Control createColorPage(Composite parent) {
|
||||||
|
|
||||||
Composite colorComposite = new Composite(parent, SWT.NULL);
|
Composite colorComposite = new Composite(parent, SWT.NULL);
|
||||||
|
@ -954,11 +750,6 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setControl(createBehaviorPage(folder));
|
item.setControl(createBehaviorPage(folder));
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
|
||||||
item.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationTabTitle")); //$NON-NLS-1$
|
|
||||||
item.setControl(createAnnotationsPage(folder));
|
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
item = new TabItem(folder, SWT.NONE);
|
||||||
item.setText(PreferencesMessages.getString("CEditorPreferencePage.colorsTabTitle")); //$NON-NLS-1$
|
item.setText(PreferencesMessages.getString("CEditorPreferencePage.colorsTabTitle")); //$NON-NLS-1$
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
|
@ -1026,16 +817,6 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < fAnnotationColorListModel.length; i++)
|
|
||||||
fAnnotationList.add(fAnnotationColorListModel[i][0]);
|
|
||||||
fAnnotationList.getDisplay().asyncExec(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
if (fAnnotationList != null && !fAnnotationList.isDisposed()) {
|
|
||||||
fAnnotationList.select(0);
|
|
||||||
handleAnnotationListSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeFields() {
|
private void initializeFields() {
|
||||||
|
|
|
@ -70,6 +70,7 @@ import org.eclipse.ui.IEditorReference;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
import org.eclipse.ui.editors.text.EditorsUI;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
||||||
|
|
||||||
|
@ -358,7 +359,7 @@ public class CUIPlugin extends AbstractUIPlugin {
|
||||||
super.initializeDefaultPreferences(store);
|
super.initializeDefaultPreferences(store);
|
||||||
MarkerAnnotationPreferences.initializeDefaultValues(store);
|
MarkerAnnotationPreferences.initializeDefaultValues(store);
|
||||||
PreferenceConstants.initializeDefaultValues(store);
|
PreferenceConstants.initializeDefaultValues(store);
|
||||||
|
EditorsUI.useAnnotationsPreferencePage(store);
|
||||||
runUI(new Runnable() {
|
runUI(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
CPluginPreferencePage.initDefaults(store);
|
CPluginPreferencePage.initDefaults(store);
|
||||||
|
|
Loading…
Add table
Reference in a new issue