Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITextViewerExtension


  // Auto-close

  @Override
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    ITextViewerExtension tve = (ITextViewerExtension)getSourceViewer();
    tve.appendVerifyKeyListener(new AutoCloser(this, (SourceViewer)getSourceViewer()));
  }
View Full Code Here


      return;
    }

    fRelayoutRequired= false;
    if (fCachedTextViewer instanceof ITextViewerExtension) {
      ITextViewerExtension extension= (ITextViewerExtension) fCachedTextViewer;
      Control control= extension.getControl();
      if (control instanceof Composite && !control.isDisposed()) {
        Composite composite= (Composite) control;
        composite.layout(true);
      }
    }
View Full Code Here

  public void setMarkAtCursor(boolean set) {

    if (!(fViewer instanceof ITextViewerExtension))
      return;

    ITextViewerExtension viewerExtension= ((ITextViewerExtension) fViewer);

    if (set) {
      Point selection= fViewer.getSelectedRange();
      viewerExtension.setMark(selection.x);

      fStatusLine.setErrorMessage(""); //$NON-NLS-1$
      fStatusLine.setMessage(EditorMessages.Editor_mark_status_message_mark_set);

    } else {
      viewerExtension.setMark(-1);

      fStatusLine.setErrorMessage(""); //$NON-NLS-1$
      fStatusLine.setMessage(EditorMessages.Editor_mark_status_message_mark_cleared);
    }
  }
View Full Code Here

  public void swapMarkAndCursor() {

    if (!(fViewer instanceof ITextViewerExtension))
      return;

    ITextViewerExtension viewerExtension= ((ITextViewerExtension) fViewer);

    int markPosition= viewerExtension.getMark();
    if (markPosition == -1) {
      fStatusLine.setErrorMessage(EditorMessages.MarkRegionTarget_markNotSet);
      fStatusLine.setMessage(""); //$NON-NLS-1$
      return;
    }

    if (!isVisible(fViewer, markPosition)) {
      fStatusLine.setErrorMessage(EditorMessages.MarkRegionTarget_markNotVisible);
      fStatusLine.setMessage(""); //$NON-NLS-1$
      return;
    }

    Point selection= fViewer.getSelectedRange();
    viewerExtension.setMark(selection.x);

    fViewer.setSelectedRange(markPosition, 0);
    fViewer.revealRange(markPosition, 0);

    fStatusLine.setErrorMessage(""); //$NON-NLS-1$
View Full Code Here

     */
    public void install() {
      if (!fIsInstalled) {

        if (fSourceViewer instanceof ITextViewerExtension) {
          ITextViewerExtension e= (ITextViewerExtension) fSourceViewer;
          e.prependVerifyKeyListener(this);
        } else {
          StyledText text= fSourceViewer.getTextWidget();
          text.addVerifyKeyListener(this);
        }

View Full Code Here

     */
    public void uninstall() {
      if (fIsInstalled) {

        if (fSourceViewer instanceof ITextViewerExtension) {
          ITextViewerExtension e= (ITextViewerExtension) fSourceViewer;
          e.removeVerifyKeyListener(this);
        } else if (fSourceViewer != null) {
          StyledText text= fSourceViewer.getTextWidget();
          if (text != null && !text.isDisposed())
            text.removeVerifyKeyListener(fActivationCodeTrigger);
        }
View Full Code Here

      int topIndex= sourceViewer.getTopIndex();

      StyledText styledText= sourceViewer.getTextWidget();
      Control parent= styledText;
      if (sourceViewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) sourceViewer;
        parent= extension.getControl();
      }

      parent.setRedraw(false);

      styledText.setFont(font);
View Full Code Here

    if (ITextOperationTarget.class.equals(required))
      return (fSourceViewer == null ? null : fSourceViewer.getTextOperationTarget());

    if (IRewriteTarget.class.equals(required)) {
      if (fSourceViewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) fSourceViewer;
        return extension.getRewriteTarget();
      }
      return null;
    }

    if (Control.class.equals(required))
View Full Code Here

            return;
        }

        Utils.runSafeSWTSync(log, new Runnable() {
            public void run() {
                ITextViewerExtension textViewer = (ITextViewerExtension) EditorAPI
                    .getViewer(editorPart);

                if (textViewer == null)
                    return;

                boolean isEditable = !lockedEditors.contains(editorPart);

                // Already as we want it?
                if (newIsEditable == isEditable)
                    return;

                log.trace(editorPart.getEditorInput().getName()
                    + " set to editable: " + newIsEditable);
                updateStatusLine(editorPart, newIsEditable);

                if (newIsEditable) {
                    lockedEditors.remove(editorPart);
                    textViewer
                        .removeVerifyKeyListener(EditorAPI.this.keyVerifier);

                    // enable editing and undo-manager
                    SourceViewer sourceViewer = (SourceViewer) textViewer;
                    sourceViewer.setEditable(true);

                    // TODO use undoLevel from Preferences (TextEditorPlugin)
                    sourceViewer.getUndoManager().setMaximalUndoLevel(200);

                } else {
                    lockedEditors.add(editorPart);
                    textViewer
                        .prependVerifyKeyListener(EditorAPI.this.keyVerifier);

                    // disable editing and undo-manager
                    SourceViewer sourceViewer = (SourceViewer) textViewer;
                    sourceViewer.setEditable(false);
View Full Code Here

      runnable.run();
  }

  private void endCompoundChange() {
    if (fHasOpenCompoundChange) {
      ITextViewerExtension extension= (ITextViewerExtension) fCurrentTarget.getViewer();
      IRewriteTarget target= extension.getRewriteTarget();
      target.endCompoundChange();
      fHasOpenCompoundChange= false;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.ITextViewerExtension

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.