Java 类com.intellij.openapi.editor.event.CaretListener 实例源码

项目:tools-idea    文件:TextEditorBasedStructureViewModel.java   
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);
  }
}
项目:tools-idea    文件:SimpleEditorPreview.java   
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);
  }
}
项目:intellij-ce-playground    文件:ClickNavigator.java   
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);
}
项目:intellij-ce-playground    文件:SimpleEditorPreview.java   
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);
  }
}
项目:intellij-ce-playground    文件:CaretModelWindow.java   
@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);
}
项目:intellij-ce-playground    文件:CaretModelWindow.java   
@Override
public void removeCaretListener(@NotNull final CaretListener listener) {
  CaretListener wrapper = myCaretListeners.removeWrapper(listener);
  if (wrapper != null) {
    myDelegate.removeCaretListener(wrapper);
  }
}
项目:tools-idea    文件:ClickNavigator.java   
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);
}
项目:tools-idea    文件:CaretModelWindow.java   
@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);
}
项目:tools-idea    文件:CaretModelWindow.java   
@Override
public void removeCaretListener(@NotNull final CaretListener listener) {
  CaretListener wrapper = myCaretListeners.removeWrapper(listener);
  if (wrapper != null) {
    myDelegate.removeCaretListener(wrapper);
  }
}
项目:consulo    文件:ClickNavigator.java   
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);
}
项目:consulo    文件:CaretModelWindow.java   
@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);
}
项目:consulo    文件:CaretModelWindow.java   
@Override
public void removeCaretListener(@Nonnull final CaretListener listener) {
  CaretListener wrapper = myCaretListeners.removeWrapper(listener);
  if (wrapper != null) {
    myDelegate.removeCaretListener(wrapper);
  }
}
项目:intellij-ce-playground    文件:TextComponentCaretModel.java   
@Override
public void addCaretListener(@NotNull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:intellij-ce-playground    文件:TextComponentCaretModel.java   
@Override
public void removeCaretListener(@NotNull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:intellij-ce-playground    文件:CaretModelImpl.java   
@Override
public void addCaretListener(@NotNull final CaretListener listener) {
  myCaretListeners.addListener(listener);
}
项目:intellij-ce-playground    文件:CaretModelImpl.java   
@Override
public void removeCaretListener(@NotNull CaretListener listener) {
  myCaretListeners.removeListener(listener);
}
项目:intellij-ce-playground    文件:CaretModelWindow.java   
public void disposeModel() {
  for (CaretListener wrapper : myCaretListeners.wrappers()) {
    myDelegate.removeCaretListener(wrapper);
  }
  myCaretListeners.clear();
}
项目:tools-idea    文件:TextComponentCaretModel.java   
@Override
public void addCaretListener(@NotNull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:tools-idea    文件:TextComponentCaretModel.java   
@Override
public void removeCaretListener(@NotNull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:tools-idea    文件:CaretModelImpl.java   
@Override
public void addCaretListener(@NotNull CaretListener listener) {
  myCaretListeners.addListener(listener);
}
项目:tools-idea    文件:CaretModelImpl.java   
@Override
public void removeCaretListener(@NotNull CaretListener listener) {
  myCaretListeners.removeListener(listener);
}
项目:tools-idea    文件:CaretModelWindow.java   
public void disposeModel() {
  for (CaretListener wrapper : myCaretListeners.wrappers()) {
    myDelegate.removeCaretListener(wrapper);
  }
  myCaretListeners.clear();
}
项目:consulo    文件:TextComponentCaretModel.java   
@Override
public void addCaretListener(@Nonnull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:consulo    文件:TextComponentCaretModel.java   
@Override
public void removeCaretListener(@Nonnull final CaretListener listener) {
  throw new UnsupportedOperationException("Not implemented");
}
项目:consulo    文件:CaretModelImpl.java   
@Override
public void addCaretListener(@Nonnull final CaretListener listener) {
  myCaretListeners.addListener(listener);
}
项目:consulo    文件:CaretModelImpl.java   
@Override
public void removeCaretListener(@Nonnull CaretListener listener) {
  myCaretListeners.removeListener(listener);
}
项目:consulo    文件:CaretModelWindow.java   
public void disposeModel() {
  for (CaretListener wrapper : myCaretListeners.wrappers()) {
    myDelegate.removeCaretListener(wrapper);
  }
  myCaretListeners.clear();
}
项目:intellij-ce-playground    文件:CaretModel.java   
/**
 * Adds a listener for receiving notifications about caret movement and caret addition/removal
 *
 * @param listener the listener instance.
 */
void addCaretListener(@NotNull CaretListener listener);
项目:intellij-ce-playground    文件:CaretModel.java   
/**
 * Removes a listener for receiving notifications about caret movement and caret addition/removal
 *
 * @param listener the listener instance.
 */
void removeCaretListener(@NotNull CaretListener listener);
项目:tools-idea    文件:CaretModel.java   
/**
 * Adds a listener for receiving notifications about caret movement.
 *
 * @param listener the listener instance.
 */
void addCaretListener(@NotNull CaretListener listener);
项目:tools-idea    文件:CaretModel.java   
/**
 * Removes a listener for receiving notifications about caret movement.
 * 
 * @param listener the listener instance.
 */
void removeCaretListener(@NotNull CaretListener listener);
项目:consulo    文件:CaretModel.java   
/**
 * Adds a listener for receiving notifications about caret movement and caret addition/removal
 *
 * @param listener the listener instance.
 */
void addCaretListener(@Nonnull CaretListener listener);
项目:consulo    文件:CaretModel.java   
/**
 * Removes a listener for receiving notifications about caret movement and caret addition/removal
 *
 * @param listener the listener instance.
 */
void removeCaretListener(@Nonnull CaretListener listener);