doSelectionChanged(event);
}
}
+
/**
* The internal shell activation listener for updating occurrences.
+ *
* @since 3.0
*/
- private ActivationListener fActivationListener= new ActivationListener();
+ private ActivationListener fActivationListener = new ActivationListener();
+
private ISelectionListenerWithAST fPostSelectionListenerWithAST;
+
private OccurrencesFinderJob fOccurrencesFinderJob;
+
/** The occurrences finder job canceler */
private OccurrencesFinderJobCanceler fOccurrencesFinderJobCanceler;
+
/**
* Holds the current occurrence annotations.
*
// setSourceViewerConfiguration(new
// JavaSourceViewerConfiguration(textTools.getColorManager(), store,
// this, IJavaPartitions.JAVA_PARTITIONING));
- fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
- fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
-// fMarkTypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES);
-// fMarkMethodOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES);
-// fMarkConstantOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES);
-// fMarkFieldOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES);
-// fMarkLocalVariableypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES);
-// fMarkExceptions= store.getBoolean(PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES);
-// fMarkImplementors= store.getBoolean(PreferenceConstants.EDITOR_MARK_IMPLEMENTORS);
-// fMarkMethodExitPoints= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS);
+ fMarkOccurrenceAnnotations = store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+ fStickyOccurrenceAnnotations = store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
+ // fMarkTypeOccurrences=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES);
+ // fMarkMethodOccurrences=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES);
+ // fMarkConstantOccurrences=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES);
+ // fMarkFieldOccurrences=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES);
+ // fMarkLocalVariableypeOccurrences=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES);
+ // fMarkExceptions=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES);
+ // fMarkImplementors=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_IMPLEMENTORS);
+ // fMarkMethodExitPoints=
+ // store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS);
}
if (isBrowserLikeLinks())
disableBrowserLikeLinks();
-// cancel possible running computation
- fMarkOccurrenceAnnotations= false;
+ // cancel possible running computation
+ fMarkOccurrenceAnnotations = false;
uninstallOccurrencesFinder();
uninstallOverrideIndicator();
if (fActivationListener != null) {
PlatformUI.getWorkbench().removeWindowListener(fActivationListener);
- fActivationListener= null;
+ fActivationListener = null;
}
if (fEncodingSupport != null) {
return;
}
- boolean newBooleanValue= false;
- Object newValue= event.getNewValue();
+ boolean newBooleanValue = false;
+ Object newValue = event.getNewValue();
if (newValue != null)
- newBooleanValue= Boolean.valueOf(newValue.toString()).booleanValue();
+ newBooleanValue = Boolean.valueOf(newValue.toString()).booleanValue();
if (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE.equals(property)) {
if (newBooleanValue)
if (PreferenceConstants.EDITOR_MARK_OCCURRENCES.equals(property)) {
if (newBooleanValue != fMarkOccurrenceAnnotations) {
- fMarkOccurrenceAnnotations= newBooleanValue;
+ fMarkOccurrenceAnnotations = newBooleanValue;
if (!fMarkOccurrenceAnnotations)
uninstallOccurrencesFinder();
else
}
if (PreferenceConstants.EDITOR_STICKY_OCCURRENCES.equals(property)) {
- fStickyOccurrenceAnnotations= newBooleanValue;
+ fStickyOccurrenceAnnotations = newBooleanValue;
return;
}
// }
// if (stickyOccurrenceAnnotations != fStickyOccurrenceAnnotations)
// {
-
((PHPSourceViewerConfiguration) getSourceViewerConfiguration()).handlePropertyChangeEvent(event);
// if (affectsOverrideIndicatorAnnotations(event)) {
* the compilation unit AST
* @since 3.0
*/
- protected void updateOccurrenceAnnotations(ITextSelection selection) {//, CompilationUnit astRoot) {
+ protected void updateOccurrenceAnnotations(ITextSelection selection) {// ,
+ // CompilationUnit
+ // astRoot)
+ // {
if (fOccurrencesFinderJob != null)
fOccurrencesFinderJob.cancel();
if (!fMarkOccurrenceAnnotations)
return;
-// if (astRoot == null || selection == null)
+ // if (astRoot == null || selection == null)
if (selection == null)
return;
if (document == null)
return;
+ fMarkOccurrenceTargetRegion = null;
if (document instanceof IDocumentExtension4) {
int offset = selection.getOffset();
long currentModificationStamp = ((IDocumentExtension4) document).getModificationStamp();
fMarkOccurrenceModificationStamp = currentModificationStamp;
}
+ if (fMarkOccurrenceTargetRegion == null) {
+ return;
+ }
+
List matches = null;
if (matches == null) {
// global variable
if (fScanner.equalsCurrentTokenSource(word)) {
matches.add(new Region(fScanner.getCurrentTokenStartPosition(), fScanner.getCurrentTokenEndPosition()
- - fScanner.getCurrentTokenStartPosition()+1));
+ - fScanner.getCurrentTokenStartPosition() + 1));
}
}
fToken = fScanner.getNextToken();
} catch (BadLocationException e1) {
// ignore errors
+ } catch (Exception e) {
+ e.printStackTrace();
+ // ignore errors
}
}
fMarkOccurrenceAnnotations = true;
fPostSelectionListenerWithAST = new ISelectionListenerWithAST() {
- public void selectionChanged(IEditorPart part, ITextSelection selection) { //, CompilationUnit astRoot) {
- updateOccurrenceAnnotations(selection);//, astRoot);
+ public void selectionChanged(IEditorPart part, ITextSelection selection) { // ,
+ // CompilationUnit
+ // astRoot)
+ // {
+ updateOccurrenceAnnotations(selection);// , astRoot);
}
};
SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST);