protected TextEditorBasedStructureViewModel(Editor editor, PsiFile file) { myEditor = editor; myPsiFile = file; if (editor != null) { EditorFactory.getInstance().getEventMulticaster().addCaretListener(new CaretListener() { @Override public void caretPositionChanged(CaretEvent e) { if (e.getEditor().equals(myEditor)) { for (FileEditorPositionListener listener : myListeners) { listener.onCurrentElementChanged(); } } } }, myDisposable); } }
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) { myOptions = options; myPage = page; String text = page.getDemoText(); HighlightsExtractor extractant2 = new HighlightsExtractor(page.getAdditionalHighlightingTagToDescriptorMap()); myHighlightData = extractant2.extractHighlights(text); int selectedLine = -1; myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(extractant2.cutDefinedTags(text), 10, 3, selectedLine, myOptions, false); FontEditorPreview.installTrafficLights(myEditor); myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent()); if (navigatable) { addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false); CaretListener listener = new CaretListener() { @Override public void caretPositionChanged(CaretEvent e) { navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false); } }; myEditor.getCaretModel().addCaretListener(listener); } }
public void addClickNavigator(final Editor view, final SyntaxHighlighter highlighter, final HighlightData[] data, final boolean isBackgroundImportant) { addMouseMotionListener(view, highlighter, data, isBackgroundImportant); CaretListener listener = new CaretAdapter() { @Override public void caretPositionChanged(CaretEvent e) { navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant); } }; view.getCaretModel().addCaretListener(listener); }
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) { myOptions = options; myPage = page; String text = page.getDemoText(); HighlightsExtractor extractant2 = new HighlightsExtractor(page.getAdditionalHighlightingTagToDescriptorMap()); List<HighlightData> highlights = new ArrayList<HighlightData>(); String stripped = extractant2.extractHighlights(text, highlights); myHighlightData = highlights.toArray(new HighlightData[highlights.size()]); int selectedLine = -1; myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(stripped, 10, 3, selectedLine, myOptions, false); FontEditorPreview.installTrafficLights(myEditor); myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent()); if (navigatable) { addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false); CaretListener listener = new CaretAdapter() { @Override public void caretPositionChanged(CaretEvent e) { navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false); } }; myEditor.getCaretModel().addCaretListener(listener); } }
@Override public void addCaretListener(@NotNull final CaretListener listener) { CaretListener wrapper = new CaretAdapter() { @Override public void caretPositionChanged(CaretEvent e) { if (!myEditorWindow.getDocument().isValid()) return; // injected document can be destroyed by now CaretEvent event = new CaretEvent(myEditorWindow, createInjectedCaret(e.getCaret()), myEditorWindow.hostToInjected(e.getOldPosition()), myEditorWindow.hostToInjected(e.getNewPosition())); listener.caretPositionChanged(event); } }; myCaretListeners.registerWrapper(listener, wrapper); myDelegate.addCaretListener(wrapper); }
@Override public void removeCaretListener(@NotNull final CaretListener listener) { CaretListener wrapper = myCaretListeners.removeWrapper(listener); if (wrapper != null) { myDelegate.removeCaretListener(wrapper); } }
public void addClickNavigator(final Editor view, final SyntaxHighlighter highlighter, final HighlightData[] data, final boolean isBackgroundImportant) { addMouseMotionListener(view, highlighter, data, isBackgroundImportant); CaretListener listener = new CaretListener() { @Override public void caretPositionChanged(CaretEvent e) { navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant); } }; view.getCaretModel().addCaretListener(listener); }
@Override public void addCaretListener(@NotNull final CaretListener listener) { CaretListener wrapper = new CaretListener() { @Override public void caretPositionChanged(CaretEvent e) { if (!myEditorWindow.getDocument().isValid()) return; // injected document can be destroyed by now CaretEvent event = new CaretEvent(myEditorWindow, myEditorWindow.hostToInjected(e.getOldPosition()), myEditorWindow.hostToInjected(e.getNewPosition())); listener.caretPositionChanged(event); } }; myCaretListeners.registerWrapper(listener, wrapper); myDelegate.addCaretListener(wrapper); }
@Override public void addCaretListener(@Nonnull final CaretListener listener) { CaretListener wrapper = new CaretListener() { @Override public void caretPositionChanged(CaretEvent e) { if (!myEditorWindow.getDocument().isValid()) return; // injected document can be destroyed by now CaretEvent event = new CaretEvent(myEditorWindow, createInjectedCaret(e.getCaret()), myEditorWindow.hostToInjected(e.getOldPosition()), myEditorWindow.hostToInjected(e.getNewPosition())); listener.caretPositionChanged(event); } }; myCaretListeners.registerWrapper(listener, wrapper); myDelegate.addCaretListener(wrapper); }
@Override public void removeCaretListener(@Nonnull final CaretListener listener) { CaretListener wrapper = myCaretListeners.removeWrapper(listener); if (wrapper != null) { myDelegate.removeCaretListener(wrapper); } }
@Override public void addCaretListener(@NotNull final CaretListener listener) { throw new UnsupportedOperationException("Not implemented"); }
@Override public void removeCaretListener(@NotNull final CaretListener listener) { throw new UnsupportedOperationException("Not implemented"); }
@Override public void addCaretListener(@NotNull final CaretListener listener) { myCaretListeners.addListener(listener); }
@Override public void removeCaretListener(@NotNull CaretListener listener) { myCaretListeners.removeListener(listener); }
public void disposeModel() { for (CaretListener wrapper : myCaretListeners.wrappers()) { myDelegate.removeCaretListener(wrapper); } myCaretListeners.clear(); }
@Override public void addCaretListener(@NotNull CaretListener listener) { myCaretListeners.addListener(listener); }
@Override public void addCaretListener(@Nonnull final CaretListener listener) { throw new UnsupportedOperationException("Not implemented"); }
@Override public void removeCaretListener(@Nonnull final CaretListener listener) { throw new UnsupportedOperationException("Not implemented"); }
@Override public void addCaretListener(@Nonnull final CaretListener listener) { myCaretListeners.addListener(listener); }
@Override public void removeCaretListener(@Nonnull CaretListener listener) { myCaretListeners.removeListener(listener); }
/** * Adds a listener for receiving notifications about caret movement and caret addition/removal * * @param listener the listener instance. */ void addCaretListener(@NotNull CaretListener listener);
/** * Removes a listener for receiving notifications about caret movement and caret addition/removal * * @param listener the listener instance. */ void removeCaretListener(@NotNull CaretListener listener);
/** * Adds a listener for receiving notifications about caret movement. * * @param listener the listener instance. */ void addCaretListener(@NotNull CaretListener listener);
/** * Removes a listener for receiving notifications about caret movement. * * @param listener the listener instance. */ void removeCaretListener(@NotNull CaretListener listener);
/** * Adds a listener for receiving notifications about caret movement and caret addition/removal * * @param listener the listener instance. */ void addCaretListener(@Nonnull CaretListener listener);
/** * Removes a listener for receiving notifications about caret movement and caret addition/removal * * @param listener the listener instance. */ void removeCaretListener(@Nonnull CaretListener listener);