Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2004-04-13 10:06:39 +0000
committerDani Megert2004-04-13 10:06:39 +0000
commitbd5f2bc0a301f69d43ae3aab15da6bf5d9f48fe2 (patch)
tree0e18293a296178a2d327a7155be30b41e1e8c478
parent06351f1532bb6a959864bebf15af83be87a0e796 (diff)
downloadeclipse.platform.text-bd5f2bc0a301f69d43ae3aab15da6bf5d9f48fe2.tar.gz
eclipse.platform.text-bd5f2bc0a301f69d43ae3aab15da6bf5d9f48fe2.tar.xz
eclipse.platform.text-bd5f2bc0a301f69d43ae3aab15da6bf5d9f48fe2.zip
Renamed caret preference from disabled_custom to use_custom
Made thick caret dependent from use_custom caret
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java45
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java6
4 files changed, 51 insertions, 12 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
index dccbacde3..691de410c 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
@@ -30,7 +30,7 @@ TextEditorPreferencePage.annotations.color= C&olor:
TextEditorPreferencePage.general=Appeara&nce
TextEditorPreferencePage.displayedTabWidth=Displayed &tab width:
-TextEditorPreferencePage.printMarginColumn=Print margin col&umn:
+TextEditorPreferencePage.printMarginColumn=&Print margin column:
TextEditorPreferencePage.showOverviewRuler=Show overview &ruler
TextEditorPreferencePage.showLineNumbers=Show lin&e numbers
TextEditorPreferencePage.changedLineColor=Changed lines background
@@ -43,7 +43,7 @@ TextEditorPreferencePage.appearanceOptions=Appearance co&lor options:
TextEditorPreferencePage.lineNumberForegroundColor=Line number foreground
TextEditorPreferencePage.currentLineHighlighColor=Current line highlight
TextEditorPreferencePage.printMarginColor=Print margin
-TextEditorPreferencePage.accessibility.disableCustomCarets= Use onl&y standard caret
+TextEditorPreferencePage.accessibility.disableCustomCarets= Use c&ustom caret
TextEditorPreferencePage.accessibility.wideCaret= Ena&ble thick caret
TextEditorPreferencePage.empty_input=Empty input
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
index 63013183a..8915211ce 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
@@ -122,6 +122,14 @@ public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbe
* @since 3.0
*/
private boolean fFieldsInitialized= false;
+
+ /**
+ * List of master/slave listeners when there's a dependency.
+ *
+ * @see #createDependency(Button, String, Control)
+ * @since 3.0
+ */
+ private ArrayList fMasterSlaveListeners= new ArrayList();
public TextEditorPreferencePage2() {
@@ -166,7 +174,7 @@ public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbe
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_DISABLE_CUSTOM_CARETS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_WIDE_CARET));
OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
@@ -308,10 +316,11 @@ public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbe
addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, 0);
label= TextEditorMessages.getString("TextEditorPreferencePage.accessibility.disableCustomCarets"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_DISABLE_CUSTOM_CARETS, 0);
+ Button master= addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS, 0);
label= TextEditorMessages.getString("TextEditorPreferencePage.accessibility.wideCaret"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_WIDE_CARET, 0);
+ Button slave= addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_WIDE_CARET, 0);
+ createDependency(master, ExtendedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS, slave);
Label l= new Label(appearanceComposite, SWT.LEFT );
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
@@ -713,6 +722,13 @@ public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbe
fFieldsInitialized= true;
updateStatus(validatePositiveNumber("0")); //$NON-NLS-1$
+
+ // Update slaves
+ Iterator iter= fMasterSlaveListeners.iterator();
+ while (iter.hasNext()) {
+ SelectionListener listener= (SelectionListener)iter.next();
+ listener.widgetSelected(null);
+ }
}
/*
@@ -792,6 +808,29 @@ public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbe
return textControl;
}
+ private void createDependency(final Button master, String masterKey, final Control slave) {
+ indent(slave);
+
+ boolean masterState= fOverlayStore.getBoolean(masterKey);
+ slave.setEnabled(masterState);
+
+ SelectionListener listener= new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ slave.setEnabled(master.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ };
+ master.addSelectionListener(listener);
+ fMasterSlaveListeners.add(listener);
+ }
+
+ private static void indent(Control control) {
+ GridData gridData= new GridData();
+ gridData.horizontalIndent= 20;
+ control.setLayoutData(gridData);
+ }
+
private void numberFieldChanged(Text textControl) {
String number= textControl.getText();
IStatus status= validatePositiveNumber(number);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java
index e6e19994d..90c95ca95 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java
@@ -186,16 +186,16 @@ public class ExtendedTextEditorPreferenceConstants {
public static final String QUICK_DIFF_CHARACTER_MODE= "quickdiff.characterMode"; //$NON-NLS-1$
/**
- * A named preference that controls whether custom carets are allowed in the
+ * A named preference that controls whether custom carets are used in the
* editor or not.
* <p>
- * Value is of type <code>Boolean</code>. If <code>true</code>, only
+ * Value is of type <code>Boolean</code>. If <code>false</code>, only
* the default caret is used in the editor.
* </p>
*
* @since 3.0
*/
- public static final String EDITOR_DISABLE_CUSTOM_CARETS= AbstractTextEditor.PREFERENCE_DISABLE_CUSTOM_CARETS;
+ public static final String EDITOR_USE_CUSTOM_CARETS= AbstractTextEditor.PREFERENCE_USE_CUSTOM_CARETS;
/**
* A named preference that controls whether carets are drawn wide or not.
@@ -236,7 +236,7 @@ public class ExtendedTextEditorPreferenceConstants {
store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false);
PreferenceConverter.setDefault(store, ExtendedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0));
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_DISABLE_CUSTOM_CARETS, false);
+ store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS, true);
store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_WIDE_CARET, true);
MarkerAnnotationPreferences.initializeDefaultValues(store);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 5699298a9..fb1f8a3af 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -1341,7 +1341,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* Value: {@value}
* @since 3.0
*/
- public final static String PREFERENCE_DISABLE_CUSTOM_CARETS= "AbstractTextEditor.Accessibility.DisableCustomCarets"; //$NON-NLS-1$
+ public final static String PREFERENCE_USE_CUSTOM_CARETS= "AbstractTextEditor.Accessibility.UseCustomCarets"; //$NON-NLS-1$
/**
* Key used to look up the caret width preference.
* Value: {@value}
@@ -2982,7 +2982,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
initializeViewerColors(fSourceViewer);
} else if (PREFERENCE_COLOR_FIND_SCOPE.equals(property)) {
initializeFindScopeColor(fSourceViewer);
- } else if (PREFERENCE_DISABLE_CUSTOM_CARETS.equals(property)) {
+ } else if (PREFERENCE_USE_CUSTOM_CARETS.equals(property)) {
updateCaret();
} else if (PREFERENCE_WIDE_CARET.equals(property)) {
updateCaret();
@@ -4605,7 +4605,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
styledText.setCaret(null);
disposeNonDefaultCaret();
- if (getPreferenceStore().getBoolean(PREFERENCE_DISABLE_CUSTOM_CARETS)) {
+ if (!getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) {
Assert.isTrue(fNonDefaultCaret == null);
} else if (fIsOverwriting)
fNonDefaultCaret= createOverwriteCaret(styledText);

Back to the top