Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.AbstractDecoratedTextEditor


      }
    });
  }

  private void openEditor(final RevisionInformation info) {
    AbstractDecoratedTextEditor editor;
    try {
      if (storage instanceof IFile)
        editor = RevisionAnnotationController.openEditor(page,
            (IFile) storage);
      else
        editor = RevisionAnnotationController.openEditor(page, storage,
            storage);
    } catch (PartInitException e) {
      Activator.handleError("Error displaying blame annotations", e, //$NON-NLS-1$
          false);
      return;
    }
    if (editor == null)
      return;

    // Show history view for path
    try {
      IHistoryView part = (IHistoryView) page.showView(
          IHistoryView.VIEW_ID, null, IWorkbenchPage.VIEW_VISIBLE);
      HistoryPageInput input = createHistoryPageInputWhenEditorOpened();
      part.showHistoryFor(input);
    } catch (PartInitException e) {
      Activator.handleError("Error displaying blame annotations", e, //$NON-NLS-1$
          false);
    }

    // IRevisionRulerColumn would also be possible but using
    // IVerticalRulerInfo seems to work in more situations.
    IVerticalRulerInfo rulerInfo = AdapterUtils.adapt(editor,
        IVerticalRulerInfo.class);

    BlameInformationControlCreator creator = new BlameInformationControlCreator(
        rulerInfo);
    info.setHoverControlCreator(creator);
    info.setInformationPresenterControlCreator(creator);

    editor.showRevisionInformation(info,
        "org.eclipse.egit.ui.internal.decorators.GitQuickDiffProvider"); //$NON-NLS-1$

    if (lineNumberToReveal >= 0) {
      IDocument document = editor.getDocumentProvider().getDocument(
          editor.getEditorInput());
      int offset;
      try {
        offset = document.getLineOffset(lineNumberToReveal);
        editor.selectAndReveal(offset, 0);
      } catch (BadLocationException e) {
        Activator.logError(
            "Error revealing line " + lineNumberToReveal, e); //$NON-NLS-1$
      }
    }
View Full Code Here


        StructuredTextEditor metadataEditor = multiPageEditor.getMetadataEditor();
        return metadataEditor.getDocumentProvider().getDocument(getEditorInput()).get();
    }

    protected void setTextOfMetadataEditor(String value) {
        AbstractDecoratedTextEditor metadataEditor = multiPageEditor.getMetadataEditor();
        IDocument document = metadataEditor.getDocumentProvider().getDocument(getEditorInput());
        if (!value.contentEquals(document.get().trim())) { // If the content is the same, don't bother setting
            document.set(value);
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.AbstractDecoratedTextEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.