Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2010-10-28 13:16:15 +0000
committerAnton Leherbauer2010-10-28 13:16:15 +0000
commitc83b49a7907db641d8c3935efb3c663bcf876144 (patch)
tree4386a55ab0dba94689769bbecc017cda4810b16a
parente137bca7426993527661ea9a2ef12b2db3361224 (diff)
downloadorg.eclipse.cdt-c83b49a7907db641d8c3935efb3c663bcf876144.tar.gz
org.eclipse.cdt-c83b49a7907db641d8c3935efb3c663bcf876144.tar.xz
org.eclipse.cdt-c83b49a7907db641d8c3935efb3c663bcf876144.zip
Bug 314813 - [mark occurrences] Add preference option for overloaded operators
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java18
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java14
6 files changed, 37 insertions, 13 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
index d0ecec1a98b..66ab69c0dcf 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
@@ -124,10 +124,7 @@ public class MarkOccurrenceTest extends BaseUITestCase {
assertNotNull(fgWriteHighlightRGB);
final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
- // TLETODO temporary fix for bug 314635
- store.setValue(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX
- + SemanticHighlightings.OVERLOADED_OPERATOR
- + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX, true);
+ store.setValue(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, true);
fEditor= openCEditor(new Path("/" + PROJECT + "/src/occurrences.cpp"));
assertNotNull(fEditor);
fTextWidget= fEditor.getViewer().getTextWidget();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
index e515c86b56f..072de8bee09 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
@@ -1479,6 +1479,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
((CSourceViewer) getSourceViewer()).setPreferenceStore(store);
fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+ fMarkOverloadedOperatorOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES);
fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
}
@@ -1691,6 +1692,10 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
fStickyOccurrenceAnnotations= newBooleanValue;
return;
}
+ if (PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES.equals(property)) {
+ fMarkOverloadedOperatorOccurrences= newBooleanValue;
+ return;
+ }
if (SemanticHighlightings.affectsEnablement(getPreferenceStore(), event)
|| (isEnableScalablilityMode() && PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT.equals(property))) {
@@ -2783,6 +2788,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
*/
private boolean fStickyOccurrenceAnnotations;
/**
+ * Tells whether to mark overloaded operator occurrences in this editor.
+ * Only valid if {@link #fMarkOccurrenceAnnotations} is <code>true</code>.
+ * @since 5.3
+ */
+ private boolean fMarkOverloadedOperatorOccurrences;
+ /**
* The selection used when forcing occurrence marking
* through code.
* @since 5.0
@@ -3360,12 +3371,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
if (binding != null) {
OccurrencesFinder occurrencesFinder= new OccurrencesFinder();
if (occurrencesFinder.initialize(astRoot, name) == null) {
- // TLETODO temporary fix for bug 314635
- boolean overloadedOperatorsEnabled = getPreferenceStore().getBoolean(
- PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX
- + SemanticHighlightings.OVERLOADED_OPERATOR
- + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX);
- if (!overloadedOperatorsEnabled) {
+ if (!fMarkOverloadedOperatorOccurrences) {
occurrencesFinder.setOptions(OccurrencesFinder.OPTION_EXCLUDE_IMPLICIT_REFERENCES);
}
locations= occurrencesFinder.getOccurrences();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java
index c5d4251723e..8069cb54867 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/MarkOccurrencesConfigurationBlock.java
@@ -79,6 +79,7 @@ class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock
ArrayList<OverlayKey> overlayKeys= new ArrayList<OverlayKey>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MARK_OCCURRENCES));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STICKY_OCCURRENCES));
OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
@@ -122,8 +123,14 @@ class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock
addFiller(composite);
+ label= PreferencesMessages.MarkOccurrencesConfigurationBlock_markOverloadOccurrences;
+ Button slave = addCheckBox(composite, label, PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, 0);
+ createDependency(master, PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, slave);
+
+ addFiller(composite);
+
label= PreferencesMessages.MarkOccurrencesConfigurationBlock_stickyOccurrences;
- Button slave = addCheckBox(composite, label, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, 0);
+ slave = addCheckBox(composite, label, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, 0);
createDependency(master, PreferenceConstants.EDITOR_STICKY_OCCURRENCES, slave);
return composite;
@@ -171,7 +178,7 @@ class MarkOccurrencesConfigurationBlock implements IPreferenceConfigurationBlock
private static void indent(Control control) {
GridData gridData= new GridData();
- gridData.horizontalIndent= 20;
+ gridData.horizontalIndent= 10;
control.setLayoutData(gridData);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
index c99f011a446..9e8c92ea07d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
@@ -393,6 +393,7 @@ public final class PreferencesMessages extends NLS {
public static String MarkOccurrencesConfigurationBlock_link;
public static String MarkOccurrencesConfigurationBlock_link_tooltip;
public static String MarkOccurrencesConfigurationBlock_markOccurrences;
+ public static String MarkOccurrencesConfigurationBlock_markOverloadOccurrences;
public static String MarkOccurrencesConfigurationBlock_stickyOccurrences;
public static String ScalabilityPreferencePage_description;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
index 05c4983a1d2..8c56c66fb38 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
@@ -454,6 +454,7 @@ MarkOccurrencesConfigurationBlock_link= The appearance can be configured on the
MarkOccurrencesConfigurationBlock_link_tooltip=Show the annotations preferences
MarkOccurrencesConfigurationBlock_markOccurrences= Mark &occurrences of the selected element in the current file.
+MarkOccurrencesConfigurationBlock_markOverloadOccurrences= Mark o&verloaded operators
MarkOccurrencesConfigurationBlock_stickyOccurrences= &Keep marks when the selection changes
#Scalability Preferences
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
index 4e239a23408..4051ccf89f1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
@@ -1350,9 +1350,9 @@ public class PreferenceConstants {
*/
public static final String EDITOR_MARK_OCCURRENCES= "markOccurrences"; //$NON-NLS-1$
-
/**
* A named preference that controls whether occurrences are sticky in the editor.
+ * Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
@@ -1362,6 +1362,17 @@ public class PreferenceConstants {
public static final String EDITOR_STICKY_OCCURRENCES= "stickyOccurrences"; //$NON-NLS-1$
/**
+ * A named preference that controls whether occurrences of overloaded operators are marked in the editor.
+ * Only valid if {@link #EDITOR_MARK_OCCURRENCES} is <code>true</code>.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ *
+ * @since 5.3
+ */
+ public static final String EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES= "markOverloadedOperatorsOccurrences"; //$NON-NLS-1$
+
+ /**
* A named preference that controls whether all scalability mode options should be turned on.
* <p>
* Value is of type <code>Boolean</code>.
@@ -1661,6 +1672,7 @@ public class PreferenceConstants {
// mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
+ store.setDefault(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, false);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
// Scalability

Back to the top