Java 类org.eclipse.jface.text.ITextViewerExtension 实例源码

项目:typescript.java    文件:JavaScriptLightWeightEditor.java   
@Override
public void createPartControl(Composite parent) {

    super.createPartControl(parent);

    // do not even install projection support until folding is actually
    // enabled
    if (isFoldingEnabled()) {
        installProjectionSupport();
    }

    IPreferenceStore preferenceStore = getPreferenceStore();
    boolean closeBrackets = preferenceStore.getBoolean(CLOSE_BRACKETS);
    boolean closeStrings = preferenceStore.getBoolean(CLOSE_STRINGS);
    boolean closeAngularBrackets = JavaScriptCore.VERSION_1_5
            .compareTo(preferenceStore.getString(JavaScriptCore.COMPILER_SOURCE)) <= 0;

    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
}
项目:typescript.java    文件:JavaScriptLightWeightEditor.java   
@Override
public void dispose() {
    if (fProjectionSupport != null) {
        fProjectionSupport.dispose();
        fProjectionSupport = null;
    }

    if (fBracketMatcher != null) {
        fBracketMatcher.dispose();
        fBracketMatcher = null;
    }

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
        ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);
    }

    super.dispose();
}
项目:bts    文件:MarkRegionTargetWithoutStatusline.java   
public void swapMarkAndCursor() {

        if (!(fViewer instanceof ITextViewerExtension))
            return;

        ITextViewerExtension viewerExtension = ((ITextViewerExtension) fViewer);

        int markPosition = viewerExtension.getMark();
        if (markPosition == -1) {
            return;
        }

        if (!isVisible(fViewer, markPosition)) {
            return;
        }

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

        fViewer.setSelectedRange(markPosition, 0);
        fViewer.revealRange(markPosition, 0);
    }
项目:APICloud-Studio    文件:ContentAssistSubjectControlAdapter.java   
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#prependVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
 */
public boolean prependVerifyKeyListener(VerifyKeyListener verifyKeyListener)
{
    if (fContentAssistSubjectControl != null)
    {
        return fContentAssistSubjectControl.prependVerifyKeyListener(verifyKeyListener);
    }
    else if (fViewer instanceof ITextViewerExtension)
    {
        ITextViewerExtension e = (ITextViewerExtension) fViewer;
        e.prependVerifyKeyListener(verifyKeyListener);
        return true;
    }
    else
    {

        StyledText textWidget = fViewer.getTextWidget();
        if (Helper.okToUse(textWidget))
        {
            textWidget.addVerifyKeyListener(verifyKeyListener);
            return true;
        }
    }
    return false;
}
项目:APICloud-Studio    文件:ContentAssistSubjectControlAdapter.java   
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#appendVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
 */
public boolean appendVerifyKeyListener(VerifyKeyListener verifyKeyListener)
{
    if (fContentAssistSubjectControl != null)
    {
        return fContentAssistSubjectControl.appendVerifyKeyListener(verifyKeyListener);
    }
    else if (fViewer instanceof ITextViewerExtension)
    {
        ITextViewerExtension extension = (ITextViewerExtension) fViewer;
        extension.appendVerifyKeyListener(verifyKeyListener);
        return true;
    }
    else
    {
        StyledText textWidget = fViewer.getTextWidget();
        if (Helper.okToUse(textWidget))
        {
            textWidget.addVerifyKeyListener(verifyKeyListener);
            return true;
        }
    }
    return false;
}
项目:APICloud-Studio    文件:ContentAssistSubjectControlAdapter.java   
/**
 * @see org.eclipse.jface.contentassist.IContentAssistSubjectControl#removeVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
 */
public void removeVerifyKeyListener(VerifyKeyListener verifyKeyListener)
{
    if (fContentAssistSubjectControl != null)
    {
        fContentAssistSubjectControl.removeVerifyKeyListener(verifyKeyListener);
    }
    else if (fViewer instanceof ITextViewerExtension)
    {
        ITextViewerExtension extension = (ITextViewerExtension) fViewer;
        extension.removeVerifyKeyListener(verifyKeyListener);
    }
    else
    {
        StyledText textWidget = fViewer.getTextWidget();
        if (Helper.okToUse(textWidget))
        {
            textWidget.removeVerifyKeyListener(verifyKeyListener);
        }
    }
}
项目:APICloud-Studio    文件:CommonLineNumberRulerColumn.java   
/**
 * Layouts the enclosing viewer to adapt the layout to changes of the
 * size of the individual components.
 *
 * @param redraw <code>true</code> if this column can be redrawn
 */
protected void layout(boolean redraw) {
    if (!redraw) {
        fRelayoutRequired= true;
        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);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitEditor.java   
@Override
public void dispose() {

    ISourceViewer sourceViewer= getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);

    if (fJavaEditorErrorTickUpdater != null) {
        fJavaEditorErrorTickUpdater.dispose();
        fJavaEditorErrorTickUpdater= null;
    }

    if (fCorrectionCommands != null) {
        fCorrectionCommands.deregisterCommands();
        fCorrectionCommands= null;
    }

    super.dispose();
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitEditor.java   
@Override
public void createPartControl(Composite parent) {

    super.createPartControl(parent);

    IPreferenceStore preferenceStore= getPreferenceStore();
    boolean closeBrackets= preferenceStore.getBoolean(CLOSE_BRACKETS);
    boolean closeStrings= preferenceStore.getBoolean(CLOSE_STRINGS);
    boolean closeAngularBrackets= JavaCore.VERSION_1_5.compareTo(preferenceStore.getString(JavaCore.COMPILER_SOURCE)) <= 0;

    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);

    ISourceViewer sourceViewer= getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);

    if (isMarkingOccurrences())
        installOccurrencesFinder(false);
}
项目:idecore    文件:ApexCodeEditor.java   
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    ((ProjectionViewer) getSourceViewer()).enableProjection();

    editorSelectionChangedListener = new EditorSelectionChangedListener();
    editorSelectionChangedListener.install(getSelectionProvider());

    IPreferenceStore preferenceStore = getPreferenceStore();
    boolean closeBrackets = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS);
    boolean closeStrings = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_STRINGS);
    boolean closeAngularBrackets = "1.5".compareTo(preferenceStore.getString(PreferenceConstants.COMPILER_SOURCE)) <= 0; // $NON-NLS-1$

    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitEditor.java   
@Override
public void dispose() {

    ISourceViewer sourceViewer= getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);

    if (fJavaEditorErrorTickUpdater != null) {
        fJavaEditorErrorTickUpdater.dispose();
        fJavaEditorErrorTickUpdater= null;
    }

    if (fCorrectionCommands != null) {
        fCorrectionCommands.deregisterCommands();
        fCorrectionCommands= null;
    }

    super.dispose();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitEditor.java   
@Override
public void createPartControl(Composite parent) {

    super.createPartControl(parent);

    IPreferenceStore preferenceStore= getPreferenceStore();
    boolean closeBrackets= preferenceStore.getBoolean(CLOSE_BRACKETS);
    boolean closeStrings= preferenceStore.getBoolean(CLOSE_STRINGS);
    boolean closeAngularBrackets= JavaCore.VERSION_1_5.compareTo(preferenceStore.getString(JavaCore.COMPILER_SOURCE)) <= 0;

    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);

    ISourceViewer sourceViewer= getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);

    if (isMarkingOccurrences())
        installOccurrencesFinder(false);
}
项目:e4macs    文件:RepositionHandler.java   
/**
 * A semi-hack... This uses stuff that may change at any time in Eclipse.  
 * In the java editor, the projection annotation model contains the collapsible regions which correspond to methods (and other areas
 * such as import groups).
 * 
 * This may work in other editor types as well... TBD
 */
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection,
        ExecutionEvent event) throws BadLocationException {

    ITextViewerExtension viewer = MarkUtils.getITextViewer(editor);
    if (viewer instanceof ProjectionViewer) {
        ProjectionAnnotationModel projection = ((ProjectionViewer)viewer).getProjectionAnnotationModel();
        @SuppressWarnings("unchecked") // the method name says it all
        Iterator<Annotation> pit = projection.getAnnotationIterator();
        while (pit.hasNext()) {
            Position p = projection.getPosition(pit.next());
            if (p.includes(currentSelection.getOffset())) {
                if (isUniversalPresent()) {
                    // Do this here to prevent subsequent scrolling once range is revealed
                    MarkUtils.setSelection(editor, new TextSelection(document, p.offset, 0));
                }
                // the viewer is pretty much guaranteed to be a TextViewer
                if (viewer instanceof TextViewer) {
                    ((TextViewer)viewer).revealRange(p.offset, p.length);
                }
                break;
            }
        }
    }
    return NO_OFFSET;       
}
项目:e4macs    文件:KbdMacroSupport.java   
/**
 * Start the definition of a keyboard macro
 * 
 * @param editor
 * @param append - if true, append to the current definition
 */
public void startKbdMacro(ITextEditor editor, boolean append) {

    if (!isExecuting()) {
        setEditor(editor);
        isdefining = true;
        ics = (ICommandService) editor.getSite().getService(ICommandService.class);
        // listen for command executions
        ics.addExecutionListener(this);
        addDocumentListener(editor);
        if (!append || kbdMacro == null) {
            kbdMacro = new KbdMacro();
        }
        setViewer(findSourceViewer(editor));
        if (viewer instanceof ITextViewerExtension) {
            ((ITextViewerExtension) viewer).prependVerifyKeyListener(whileDefining);
        } else {
            viewer = null;
        }
        // add a listener for ^G
        Beeper.addBeepListener(KbdMacroBeeper.beeper);
        currentCommand = null;
    }
}
项目:ftc    文件:TweakedLinkedModeUI.java   
private void connect() {
    Assert.isNotNull(fCurrentTarget);
    ITextViewer viewer = fCurrentTarget.getViewer();
    Assert.isNotNull(viewer);
    fCurrentTarget.fWidget = viewer.getTextWidget();
    if (fCurrentTarget.fWidget == null)
        leave(ILinkedModeListener.EXIT_ALL);

    if (fCurrentTarget.fKeyListener == null) {
        fCurrentTarget.fKeyListener = new KeyListener();
        ((ITextViewerExtension) viewer).prependVerifyKeyListener(fCurrentTarget.fKeyListener);
    } else
        fCurrentTarget.fKeyListener.setEnabled(true);

    registerAutoEditVetoer(viewer);

    ((IPostSelectionProvider) viewer).addPostSelectionChangedListener(fSelectionListener);

    createAnnotationModel();

    showSelection();

    fCurrentTarget.fShell = fCurrentTarget.fWidget.getShell();
    if (fCurrentTarget.fShell == null)
        leave(ILinkedModeListener.EXIT_ALL);
    fCurrentTarget.fShell.addShellListener(fCloser);

    fAssistant.install(viewer);

    viewer.addTextInputListener(fCloser);

    viewer.getDocument().addDocumentListener(fDocumentListener);
}
项目:ftc    文件:TweakedLinkedModeUI.java   
private void endCompoundChangeIfNeeded() {
    if (fHasOpenCompoundChange) {
        ITextViewerExtension extension = (ITextViewerExtension) fCurrentTarget.getViewer();
        IRewriteTarget target = extension.getRewriteTarget();
        target.endCompoundChange();
        fHasOpenCompoundChange = false;
    }
}
项目:ftc    文件:TweakedLinkedModeUI.java   
private void beginCompoundChangeIfNeeded() {
    if (!fHasOpenCompoundChange) {
        ITextViewerExtension extension = (ITextViewerExtension) fCurrentTarget.getViewer();
        IRewriteTarget target = extension.getRewriteTarget();
        target.beginCompoundChange();
        fHasOpenCompoundChange = true;
    }
}
项目:texlipse    文件:TexEditor.java   
/** 
 * Create the part control.
 * 
 * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    // enable projection support (for code folder)
    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
    fProjectionSupport = new ProjectionSupport(projectionViewer,
            getAnnotationAccess(), getSharedColors());
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    fProjectionSupport.install();

    if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.CODE_FOLDING)) {
        projectionViewer.doOperation(ProjectionViewer.TOGGLE);
    }

    fAnnotationUpdater = new TexlipseAnnotationUpdater(this);

    ((IPostSelectionProvider) getSelectionProvider()).addPostSelectionChangedListener(
            new ISelectionChangedListener(){
                public void selectionChanged(SelectionChangedEvent event) {
                    //Delete all StatuslineErrors after selection changes
                    documentModel.removeStatusLineErrorMessage();
                }
            });

    // register documentModel as documentListener
    // in initializeEditor this would cause NPE
    this.getDocumentProvider().getDocument(getEditorInput()).addDocumentListener(this.documentModel);
    this.documentModel.initializeModel();
    this.documentModel.updateNow();

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension) {
        if (fBracketInserter == null)
            fBracketInserter = new BracketInserter(getSourceViewer(), this);
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
    }
}
项目:fluentmark    文件:SmartBackspaceManager.java   
private void ensureListenerInstalled() {
    if (fBackspaceListener == null) {
        fBackspaceListener = new BackspaceListener();
        ITextViewer viewer = fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).prependVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().addVerifyKeyListener(fBackspaceListener);
    }
}
项目:fluentmark    文件:SmartBackspaceManager.java   
private void ensureListenerRemoved() {
    if (fBackspaceListener != null) {
        ITextViewer viewer = fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).removeVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().removeVerifyKeyListener(fBackspaceListener);
        fBackspaceListener = null;
    }
}
项目:bts    文件:TextViewerMoveLinesAction.java   
/**
 * Ends the compound change.
 */
private void beginCompoundEdit() {
    ITextViewer viewer= getTextViewer();
    if (fEditInProgress || viewer == null || !(viewer instanceof ITextViewerExtension))
        return;

    fEditInProgress= true;

    fStrategy.arm(viewer);

    IRewriteTarget target= ((ITextViewerExtension) viewer).getRewriteTarget();
    if (target != null) {
        target.beginCompoundChange();
    }
}
项目:bts    文件:TextViewerMoveLinesAction.java   
/**
 * Ends the compound change.
 */
private void endCompoundEdit() {
    ITextViewer viewer= getTextViewer();
    if (!fEditInProgress || viewer == null || !(viewer instanceof ITextViewerExtension))
        return;

    IRewriteTarget target= ((ITextViewerExtension) viewer).getRewriteTarget();
    if (target != null) {
        target.endCompoundChange();
    }

    fEditInProgress= false;
}
项目:bts    文件:MarkRegionTargetWithoutStatusline.java   
public void setMarkAtCursor(boolean set) {

        if (!(fViewer instanceof ITextViewerExtension))
            return;

        ITextViewerExtension viewerExtension = ((ITextViewerExtension) fViewer);

        if (set) {
            Point selection = fViewer.getSelectedRange();
            viewerExtension.setMark(selection.x);
        } else {
            viewerExtension.setMark(-1);
        }
    }
项目:TeamFileList    文件:SourceViewerKeyHandler.java   
public void install(ITextViewer viewer) {
    fTarget = viewer.getTextOperationTarget();
    fViewer = viewer;
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension e= (ITextViewerExtension)viewer;
        e.appendVerifyKeyListener(this);
    } else {
        viewer.getTextWidget().addVerifyKeyListener(this);
    }
}
项目:TeamFileList    文件:SourceViewerKeyHandler.java   
public void uninstall(ITextViewer viewer) {
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension e= (ITextViewerExtension)viewer;
        e.removeVerifyKeyListener(this);
    } else {
        viewer.getTextWidget().removeVerifyKeyListener(this);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SmartBackspaceManager.java   
private void ensureListenerInstalled() {
    if (fBackspaceListener == null) {
        fBackspaceListener= new BackspaceListener();
        ITextViewer viewer= fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).prependVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().addVerifyKeyListener(fBackspaceListener);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SmartBackspaceManager.java   
private void ensureListenerRemoved() {
    if (fBackspaceListener != null) {
        ITextViewer viewer= fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).removeVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().removeVerifyKeyListener(fBackspaceListener);
        fBackspaceListener= null;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:TemplateProposal.java   
private void endCompoundChange(ITextViewer viewer) {
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) viewer;
        IRewriteTarget target= extension.getRewriteTarget();
        target.endCompoundChange();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:TemplateProposal.java   
private void beginCompoundChange(ITextViewer viewer) {
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) viewer;
        IRewriteTarget target= extension.getRewriteTarget();
        target.beginCompoundChange();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SurroundWithTemplateProposal.java   
private void setRedraw(ITextViewer viewer, boolean redraw) {
if (viewer instanceof ITextViewerExtension) {
    ITextViewerExtension extension= (ITextViewerExtension) viewer;
    IRewriteTarget target= extension.getRewriteTarget();
    target.setRedraw(redraw);
}
  }
项目:idecore    文件:ApexCodeEditor.java   
/**
 * The <code>JavaEditor</code> implementation of this <code>AbstractTextEditor</code> method performs any extra
 * disposal actions required by the java editor.
 */
@Override
public void dispose() {
    if (fOutlinePage != null) {
        fOutlinePage.dispose();
    }

    if (outlineUpdateResourceListener != null) {
        outlineUpdateResourceListener.clear();
        removeListenerObject(outlineUpdateResourceListener);
    }

    if (outlineSelectionChangedListener != null) {
        outlineSelectionChangedListener.uninstall(getSelectionProvider());
    }

    if (editorSelectionChangedListener != null) {
        editorSelectionChangedListener.uninstall(getSelectionProvider());
        editorSelectionChangedListener = null;
    }

    if (fBracketMatcher != null) {
        fBracketMatcher.dispose();
        fBracketMatcher = null;
    }

    if (getSourceViewer() instanceof ITextViewerExtension)
        ((ITextViewerExtension) getSourceViewer()).removeVerifyKeyListener(fBracketInserter);

    super.dispose();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SmartBackspaceManager.java   
private void ensureListenerInstalled() {
    if (fBackspaceListener == null) {
        fBackspaceListener= new BackspaceListener();
        ITextViewer viewer= fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).prependVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().addVerifyKeyListener(fBackspaceListener);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SmartBackspaceManager.java   
private void ensureListenerRemoved() {
    if (fBackspaceListener != null) {
        ITextViewer viewer= fViewer;
        if (viewer instanceof ITextViewerExtension)
            ((ITextViewerExtension) viewer).removeVerifyKeyListener(fBackspaceListener);
        else
            viewer.getTextWidget().removeVerifyKeyListener(fBackspaceListener);
        fBackspaceListener= null;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TemplateProposal.java   
private void endCompoundChange(ITextViewer viewer) {
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) viewer;
        IRewriteTarget target= extension.getRewriteTarget();
        target.endCompoundChange();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TemplateProposal.java   
private void beginCompoundChange(ITextViewer viewer) {
    if (viewer instanceof ITextViewerExtension) {
        ITextViewerExtension extension= (ITextViewerExtension) viewer;
        IRewriteTarget target= extension.getRewriteTarget();
        target.beginCompoundChange();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SurroundWithTemplateProposal.java   
private void setRedraw(ITextViewer viewer, boolean redraw) {
if (viewer instanceof ITextViewerExtension) {
    ITextViewerExtension extension= (ITextViewerExtension) viewer;
    IRewriteTarget target= extension.getRewriteTarget();
    target.setRedraw(redraw);
}
  }
项目:e4macs    文件:MarkUtils.java   
/**
 * Get the current Mark position
 * 
 * @param editor
 * @return the Mark position in model coords (-1 if not set)
 */
public static int getMark(ITextEditor editor) {
    int result = -1;
    ITextViewerExtension ive = getITextViewer(editor);
    if (ive != null) {
        result = ive.getMark();
    }
    return result;
}
项目:e4macs    文件:MarkUtils.java   
/**
 * Set Mark at offset, and potentially save the marks in the Mark Rings
 * 
 * @param editor
 * @param ve
 * @param offset - the offset in document (absolute) coords
 * @param save - true if we're (potentially) saving in the Mark Rings
 * @return the mark position in document coords
 */
public static int setMark(ITextEditor editor, ITextViewerExtension ve, int offset, boolean save) {
    int result = -1;
    if (ve != null) {
        int localMark = ve.getMark();
        ve.setMark(offset);
        result = ve.getMark();
        if (save) {
            MarkRing.addMark(editor, ve.getRewriteTarget().getDocument(), localMark, result);
            EmacsPlusUtils.showMessage(editor, MARK_SET, false);
        }
    }
    return result;
}
项目:e4macs    文件:MarkUtils.java   
public static ITextViewerExtension getITextViewer(ITextEditor editor) {
    ITextViewerExtension result = null;
    ISourceViewer viewer = findSourceViewer(editor);
    if ((viewer instanceof ITextViewerExtension)) {
        result = ((ITextViewerExtension) viewer);
    }
    return result;
}
项目:e4macs    文件:WithMinibuffer.java   
/**
 * Installs this target. I.e. adds all required listeners.
 */
private boolean install() {
    if (editor instanceof AbstractTextEditor && !isInstalled()) {
        bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
        viewer = findSourceViewer(editor);
        if (viewer != null) {
            widget = viewer.getTextWidget();
            if (widget == null || widget.isDisposed()) {
                viewer = null;
                widget = null;
                return false;
            }
            addStatusContribution(editor);
            widget.addMouseListener(this);
            widget.addFocusListener(this);
            viewer.addTextListener(this);

            ISelectionProvider selectionProvider = viewer.getSelectionProvider();
            if (selectionProvider != null)
                selectionProvider.addSelectionChangedListener(this);

            if (viewer instanceof ITextViewerExtension){
                ((ITextViewerExtension) viewer).prependVerifyKeyListener(this);
                KbdMacroSupport.getInstance().continueKbdMacro(this,editor);
            } else {
                widget.addVerifyKeyListener(this);
            }
            addOtherListeners(page,viewer, widget);
            installed = true;
        }
    }
    return installed;
}