1 11 package org.eclipse.jdt.internal.ui.javaeditor; 12 13 import org.eclipse.core.runtime.Assert; 14 15 import org.eclipse.jface.text.link.ILinkedModeListener; 16 import org.eclipse.jface.text.link.LinkedModeModel; 17 18 19 25 public class EditorHighlightingSynchronizer implements ILinkedModeListener { 26 27 private final JavaEditor fEditor; 28 private final boolean fWasOccurrencesOn; 29 30 37 public EditorHighlightingSynchronizer(JavaEditor editor) { 38 Assert.isLegal(editor != null); 39 fEditor= editor; 40 fWasOccurrencesOn= fEditor.isMarkingOccurrences(); 41 42 if (fWasOccurrencesOn && !isEditorDisposed()) 43 fEditor.uninstallOccurrencesFinder(); 44 } 45 46 49 public void left(LinkedModeModel environment, int flags) { 50 if (fWasOccurrencesOn && !isEditorDisposed()) 51 fEditor.installOccurrencesFinder(true); 52 } 53 54 57 private boolean isEditorDisposed() { 58 return fEditor == null || fEditor.getSelectionProvider() == null; 59 } 60 61 64 public void suspend(LinkedModeModel environment) { 65 } 66 67 70 public void resume(LinkedModeModel environment, int flags) { 71 } 72 73 } 74 | Popular Tags |