コード例 #1
0
    public void install() {
      ISourceViewer sourceViewer = editor.getISourceViewer();
      if (sourceViewer == null) return;

      StyledText text = sourceViewer.getTextWidget();
      if (text == null || text.isDisposed()) return;

      sourceViewer.addTextInputListener(this);

      IDocument document = sourceViewer.getDocument();
      if (document != null) document.addDocumentListener(this);
    }
コード例 #2
0
    public void install() {
      final ISourceViewer sourceViewer = erlangEditor.getViewer();
      if (sourceViewer == null) {
        return;
      }

      final StyledText text = sourceViewer.getTextWidget();
      if (text == null || text.isDisposed()) {
        return;
      }

      sourceViewer.addTextInputListener(this);

      final IDocument document = sourceViewer.getDocument();
      if (document != null) {
        document.addDocumentListener(this);
      }
    }
  /**
   * Install this reconciler on the given editor, presenter and highlightings.
   *
   * @param editor the editor
   * @param sourceViewer the source viewer
   * @param presenter the semantic highlighting presenter
   * @param semanticHighlightings the semantic highlightings
   * @param highlightings the highlightings
   */
  public void install(
      JavaEditor editor,
      ISourceViewer sourceViewer,
      SemanticHighlightingPresenter presenter,
      SemanticHighlighting[] semanticHighlightings,
      Highlighting[] highlightings) {
    fPresenter = presenter;
    fSemanticHighlightings = semanticHighlightings;
    fHighlightings = highlightings;

    fEditor = editor;
    fSourceViewer = sourceViewer;

    if (fEditor instanceof CompilationUnitEditor) {
      ((CompilationUnitEditor) fEditor).addReconcileListener(this);
    } else if (fEditor == null) {
      fSourceViewer.addTextInputListener(this);
      scheduleJob();
    }
  }