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

项目:intellij-ce-playground    文件:TextEditorBasedStructureViewModel.java   
protected TextEditorBasedStructureViewModel(Editor editor, PsiFile file) {
  myEditor = editor;
  myPsiFile = file;

  myEditorCaretListener = new CaretAdapter() {
    @Override
    public void caretPositionChanged(CaretEvent e) {
      if (e.getEditor().equals(myEditor)) {
        for (FileEditorPositionListener listener : myListeners) {
          listener.onCurrentElementChanged();
        }
      }
    }
  };
}
项目: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);
}
项目:consulo    文件:TextEditorBasedStructureViewModel.java   
protected TextEditorBasedStructureViewModel(Editor editor, PsiFile file) {
  myEditor = editor;
  myPsiFile = file;

  myEditorCaretListener = new CaretAdapter() {
    @Override
    public void caretPositionChanged(CaretEvent e) {
      if (e.getEditor().equals(myEditor)) {
        for (FileEditorPositionListener listener : myListeners) {
          listener.onCurrentElementChanged();
        }
      }
    }
  };
}
项目: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);
}