From ca68f6bb046788678d57a6b37b2619d294f312f4 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 17 Sep 2010 08:38:51 +0000 Subject: [PATCH] Bug 324905 - [Search] Show different colors to mark read and write accesses in Mark Occurrences Patch from Patrick Hofer --- .../resources/ceditor/occurrences.cpp | 2 +- .../cdt/ui/tests/text/MarkOccurrenceTest.java | 81 ++++++++++++------- core/org.eclipse.cdt.ui/plugin.properties | 1 + core/org.eclipse.cdt.ui/plugin.xml | 39 ++++++--- .../cdt/internal/ui/editor/CEditor.java | 3 +- .../internal/ui/search/CSearchMessages.java | 3 +- .../ui/search/CSearchMessages.properties | 1 + .../ui/search/IOccurrencesFinder.java | 5 +- .../internal/ui/search/OccurrencesFinder.java | 30 +++++-- 9 files changed, 118 insertions(+), 47 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/resources/ceditor/occurrences.cpp b/core/org.eclipse.cdt.ui.tests/resources/ceditor/occurrences.cpp index 5a5bc9d1bec..913e82a9345 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/ceditor/occurrences.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/ceditor/occurrences.cpp @@ -17,7 +17,7 @@ static void globalStaticFunc() { EMPTY_MACRO(n); globalVariable = 1; EMPTY_MACRO(1); - return 0; + return; } class Base1 { 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 21b72ff543c..d0ecec1a98b 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 @@ -69,12 +69,16 @@ public class MarkOccurrenceTest extends BaseUITestCase { private static final String PROJECT = "MarkOccurrenceTest"; private static final String OCCURRENCE_ANNOTATION= "org.eclipse.cdt.ui.occurrences"; + private static final String WRITE_OCCURRENCE_ANNOTATION= "org.eclipse.cdt.ui.occurrences.write"; + private static final RGB fgHighlightRGB= getHighlightRGB(); + private static final RGB fgWriteHighlightRGB= getWriteHighlightRGB(); private CEditor fEditor; private IDocument fDocument; private FindReplaceDocumentAdapter fFindReplaceDocumentAdapter; private int fOccurrences; + private int fWriteOccurrences; private IAnnotationModel fAnnotationModel; private ISelectionListenerWithAST fSelWASTListener; private IRegion fMatch; @@ -117,6 +121,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fProjectSetup.setUp(); } assertNotNull(fgHighlightRGB); + assertNotNull(fgWriteHighlightRGB); final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true); // TLETODO temporary fix for bug 314635 @@ -143,11 +148,14 @@ public class MarkOccurrenceTest extends BaseUITestCase { private synchronized void countOccurrences() { fOccurrences= 0; + fWriteOccurrences= 0; Iterator iter= fAnnotationModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); - if (OCCURRENCE_ANNOTATION.equals(annotation.getType())) + if (annotation.getType().startsWith(OCCURRENCE_ANNOTATION)) fOccurrences++; + if (annotation.getType().equals(WRITE_OCCURRENCE_ANNOTATION)) + fWriteOccurrences++; } } }; @@ -193,7 +201,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -207,7 +215,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(5); + assertOccurrences(5, 0); assertOccurrencesInWidget(); } @@ -221,7 +229,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -235,7 +243,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(4); + assertOccurrences(4, 0); assertOccurrencesInWidget(); } @@ -249,7 +257,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -263,7 +271,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -277,7 +285,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(4); + assertOccurrences(4, 0); assertOccurrencesInWidget(); } @@ -306,7 +314,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fMatch= new Region(fMatch.getOffset(), 4); fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(1); + assertOccurrences(1, 0); assertOccurrencesInWidget(); store.setValue("REUSE_OPEN_EDITORS_BOOLEAN", false); @@ -323,7 +331,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -337,7 +345,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -351,7 +359,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 1); assertOccurrencesInWidget(); } @@ -365,7 +373,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 2); assertOccurrencesInWidget(); } @@ -380,7 +388,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fMatch= new Region(fMatch.getOffset(), fMatch.getLength() - 1); fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -395,7 +403,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fMatch= new Region(fMatch.getOffset() + 1, fMatch.getLength() - 1); fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -409,7 +417,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 1); assertOccurrencesInWidget(); } @@ -423,7 +431,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(5); + assertOccurrences(5, 0); assertOccurrencesInWidget(); } @@ -437,7 +445,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -451,7 +459,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -465,7 +473,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(3); + assertOccurrences(3, 0); assertOccurrencesInWidget(); } @@ -479,7 +487,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(4); + assertOccurrences(4, 2); assertOccurrencesInWidget(); } @@ -493,7 +501,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -507,7 +515,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(2); + assertOccurrences(2, 0); assertOccurrencesInWidget(); } @@ -524,17 +532,17 @@ public class MarkOccurrenceTest extends BaseUITestCase { fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength()); - assertOccurrences(0); + assertOccurrences(0, 0); assertOccurrencesInWidget(); } private void assertOccurrencesInWidget() { - EditorTestHelper.runEventQueue(500); + EditorTestHelper.runEventQueue(100); Iterator iter= fAnnotationModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); - if (OCCURRENCE_ANNOTATION.equals(annotation.getType())) + if (annotation.getType().startsWith(OCCURRENCE_ANNOTATION)) assertOccurrenceInWidget(fAnnotationModel.getPosition(annotation)); } } @@ -544,7 +552,7 @@ public class MarkOccurrenceTest extends BaseUITestCase { for (int i= 0; i < styleRanges.length; i++) { if (styleRanges[i].background != null) { RGB rgb= styleRanges[i].background.getRGB(); - if (fgHighlightRGB.equals(rgb)) + if ((fgHighlightRGB.equals(rgb)) || (fgWriteHighlightRGB.equals(rgb))) return; } } @@ -565,15 +573,30 @@ public class MarkOccurrenceTest extends BaseUITestCase { return null; } - private void assertOccurrences(final int expected) { + /** + * Returns the write occurrence annotation color. + * + * @return the write occurrence annotation color + */ + private static RGB getWriteHighlightRGB() { + AnnotationPreference annotationPref= EditorsPlugin.getDefault().getAnnotationPreferenceLookup().getAnnotationPreference(WRITE_OCCURRENCE_ANNOTATION); + IPreferenceStore store= EditorsUI.getPreferenceStore(); + if (store != null) + return PreferenceConverter.getColor(store, annotationPref.getColorPreferenceKey()); + + return null; + } + + private void assertOccurrences(final int expected, final int expectedWrite) { DisplayHelper helper= new DisplayHelper() { @Override protected boolean condition() { - return fOccurrences == expected; + return ((fOccurrences == expected) && (fWriteOccurrences == expectedWrite)); } }; if (!helper.waitForCondition(EditorTestHelper.getActiveDisplay(), 10000)) { assertEquals(expected, fOccurrences); + assertEquals(expectedWrite, fWriteOccurrences); } } } diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index b18f649bb5a..0ae56889cb1 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -514,6 +514,7 @@ toggleMarkOccurrences.tooltip= Toggle Mark Occurrences toggleMarkOccurrences.description= Toggles mark occurrences in C/C++ editors OccurrenceAnnotation.label= C/C++ Occurrences +WriteOccurrenceAnnotation.label= C/C++ Write Occurrences DocCommentOwner.name = DocCommentOwner Doxygen.name = Doxygen diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 0955051f3f0..c2819675e0e 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -2601,25 +2601,42 @@ annotationType="org.eclipse.cdt.ui.occurrences" label="%OccurrenceAnnotation.label" icon="$nl$/icons/obj16/searchm_obj.gif" - textPreferenceKey="org.eclipse.cdt.ui.occurrenceIndication" + textPreferenceKey="occurrenceIndication" textPreferenceValue="false" - highlightPreferenceKey="org.eclipse.cdt.ui.occurrenceHighlighting" + highlightPreferenceKey="occurrenceHighlighting" highlightPreferenceValue="true" contributesToHeader="false" - overviewRulerPreferenceKey="org.eclipse.cdt.ui.occurrenceIndicationInOverviewRuler" + overviewRulerPreferenceKey="occurrenceIndicationInOverviewRuler" overviewRulerPreferenceValue="true" - verticalRulerPreferenceKey="org.eclipse.cdt.ui.occurrenceIndicationInVerticalRuler" + verticalRulerPreferenceKey="occurrenceIndicationInVerticalRuler" verticalRulerPreferenceValue="false" - colorPreferenceKey="org.eclipse.cdt.ui.occurrenceIndicationColor" + colorPreferenceKey="occurrenceIndicationColor" colorPreferenceValue="212,212,212" presentationLayer="4" - showInNextPrevDropdownToolbarActionKey="org.eclipse.cdt.ui.showOccurrenceInNextPrevDropdownToolbarAction" + showInNextPrevDropdownToolbarActionKey="showOccurrenceInNextPrevDropdownToolbarAction" showInNextPrevDropdownToolbarAction="true" - isGoToNextNavigationTargetKey="org.eclipse.cdt.ui.isOccurrenceGoToNextNavigationTarget" + isGoToNextNavigationTargetKey="isOccurrenceGoToNextNavigationTarget" isGoToNextNavigationTarget="false" - isGoToPreviousNavigationTargetKey="org.eclipse.cdt.ui.isOccurrenceGoToPreviousNavigationTarget" + isGoToPreviousNavigationTargetKey="isOccurrenceGoToPreviousNavigationTarget" isGoToPreviousNavigationTarget="false" - textStylePreferenceKey="org.eclipse.cdt.ui.occurrenceTextStyle" + textStylePreferenceKey="occurrenceTextStyle" + textStylePreferenceValue="NONE"> + + + + 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 cc03a60fdf5..07df6a7204c 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 @@ -210,6 +210,7 @@ import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction; import org.eclipse.cdt.internal.ui.actions.StructureSelectionAction; import org.eclipse.cdt.internal.ui.actions.SurroundWithActionGroup; import org.eclipse.cdt.internal.ui.search.IOccurrencesFinder.OccurrenceLocation; +import org.eclipse.cdt.internal.ui.search.IOccurrencesFinder; import org.eclipse.cdt.internal.ui.search.OccurrencesFinder; import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup; import org.eclipse.cdt.internal.ui.text.CHeuristicScanner; @@ -3189,7 +3190,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC Position position= new Position(location.getOffset(), location.getLength()); String description= location.getDescription(); - String annotationType= "org.eclipse.cdt.ui.occurrences"; //$NON-NLS-1$ + String annotationType= (location.getFlags() == IOccurrencesFinder.F_WRITE_OCCURRENCE) ? "org.eclipse.cdt.ui.occurrences.write" : "org.eclipse.cdt.ui.occurrences"; //$NON-NLS-1$ //$NON-NLS-2$ annotationMap.put(new Annotation(annotationType, false, description), position); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java index 62e02253ee9..7bd4f43af07 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2009 IBM Corporation and others. + * Copyright (c) 2003, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -84,6 +84,7 @@ public final class CSearchMessages extends NLS { public static String OccurrencesFinder_label_singular; public static String OccurrencesFinder_label_plural; public static String OccurrencesFinder_occurrence_description; + public static String OccurrencesFinder_occurrence_write_description; public static String PDOMSearchListContentProvider_IndexerNotEnabledMessageFormat; public static String PDOMSearchListContentProvider_ProjectClosedMessageFormat; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties index 30fd4546364..a88631dc935 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties @@ -107,3 +107,4 @@ OccurrencesFinder_label_singular=''{0}'' - 1 occurrence in ''{1}'' # The first argument will be replaced by the element name, the second by the count and the last by the file name OccurrencesFinder_label_plural=''{0}'' - {1} occurrences in ''{2}'' OccurrencesFinder_occurrence_description=Occurrence of ''{0}'' +OccurrencesFinder_occurrence_write_description=Write Occurrence of ''{0}'' \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/IOccurrencesFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/IOccurrencesFinder.java index 0dd88c797a9..4ca1328ed6e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/IOccurrencesFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/IOccurrencesFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,6 +17,9 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; public interface IOccurrencesFinder { public static final int K_OCCURRENCE= 5; + + public static final int F_WRITE_OCCURRENCE= 1; + public static final int F_READ_OCCURRENCE= 2; /** * Element representing an occurrence diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/OccurrencesFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/OccurrencesFinder.java index 8060750acd4..69cfa19835e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/OccurrencesFinder.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/OccurrencesFinder.java @@ -19,12 +19,17 @@ import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.parser.Keywords; import org.eclipse.cdt.core.parser.util.CharArrayUtils; +import org.eclipse.cdt.internal.core.dom.parser.c.CVariableReadWriteFlags; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; import org.eclipse.cdt.internal.ui.util.Messages; @@ -42,8 +47,10 @@ public class OccurrencesFinder implements IOccurrencesFinder { private IBinding fTarget; private List fResult; - private String fDescription; + private String fReadDescription; + private String fWriteDescription; + private int fOptions; public OccurrencesFinder() { @@ -59,7 +66,8 @@ public class OccurrencesFinder implements IOccurrencesFinder { if (fTarget == null) return CSearchMessages.OccurrencesFinder_no_binding; - fDescription= Messages.format(CSearchMessages.OccurrencesFinder_occurrence_description, fTarget.getName()); + fReadDescription= Messages.format(CSearchMessages.OccurrencesFinder_occurrence_description, fTarget.getName()); + fWriteDescription= Messages.format(CSearchMessages.OccurrencesFinder_occurrence_write_description, fTarget.getName()); return null; } @@ -154,8 +162,6 @@ public class OccurrencesFinder implements IOccurrencesFinder { private boolean addUsage(IASTName node, IBinding binding) { if (binding != null /* && Bindings.equals(binding, fTarget) */) { - int flag= 0; - String description= fDescription; if (node instanceof ICPPASTTemplateId) { node= ((ICPPASTTemplateId) node).getTemplateName(); } @@ -167,7 +173,21 @@ public class OccurrencesFinder implements IOccurrencesFinder { final int offset= fileLocation.getNodeOffset(); final int length= fileLocation.getNodeLength(); if (offset >= 0 && length > 0) { - fResult.add(new OccurrenceLocation(offset, length, flag, description)); + if (binding instanceof IVariable) { + boolean isWrite; + if (binding instanceof ICPPVariable) { + isWrite = ((CPPVariableReadWriteFlags.getReadWriteFlags(node) & PDOMName.WRITE_ACCESS) != 0); + } + else { + isWrite = ((CVariableReadWriteFlags.getReadWriteFlags(node) & PDOMName.WRITE_ACCESS) != 0); + } + int flag = isWrite ? F_WRITE_OCCURRENCE : F_READ_OCCURRENCE; + String description = isWrite ? fWriteDescription : fReadDescription; + fResult.add(new OccurrenceLocation(offset, length, flag, description)); + } + else { + fResult.add(new OccurrenceLocation(offset, length, F_READ_OCCURRENCE, fWriteDescription)); + } } } return true;