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

项目:ftc    文件:TweakedLinkedModeUI.java   
/**
 * Registers our auto edit vetoer with the viewer.
 *
 * @param viewer
 *            the viewer we want to veto ui-triggered changes within linked
 *            positions
 */
private void registerAutoEditVetoer(ITextViewer viewer) {
    try {
        String[] contentTypes = getContentTypes(viewer.getDocument());
        if (viewer instanceof ITextViewerExtension2) {
            ITextViewerExtension2 vExtension = ((ITextViewerExtension2) viewer);
            for (int i = 0; i < contentTypes.length; i++) {
                vExtension.prependAutoEditStrategy(fAutoEditVetoer, contentTypes[i]);
            }
        } else {
            Assert.isTrue(false);
        }

    } catch (BadPartitioningException e) {
        leave(ILinkedModeListener.EXIT_ALL);
    }
}
项目:bts    文件:DefaultContentViewer.java   
@Override
protected void configureSourceViewer(ISourceViewer sourceViewer) {
    sourceViewer.setEditable(false);
    sourceViewer.configure(sourceViewerConfiguration);
    if (sourceViewer instanceof ITextViewerExtension6) {
        ITextViewerExtension6 textViewerExtension6 = (ITextViewerExtension6) sourceViewer;
        textViewerExtension6.setHyperlinkDetectors(null,
                sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
    }
    if (sourceViewer instanceof ITextViewerExtension2) {
        ITextViewerExtension2 textViewerExtension2 = (ITextViewerExtension2) sourceViewer;
        String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
        for (String contentType : configuredContentTypes) {
            textViewerExtension2.removeTextHovers(contentType);
        }
    }
}
项目:APICloud-Studio    文件:FormatterModifyTabPage.java   
protected void updateShowInvisible(boolean value)
{
    if (value)
    {
        if (whitespaceCharacterPainter == null)
        {
            whitespaceCharacterPainter = new WhitespaceCharacterPainter(previewViewer);
            ((ITextViewerExtension2) previewViewer).addPainter(whitespaceCharacterPainter);
        }
    }
    else
    {
        if (whitespaceCharacterPainter != null)
        {
            ((ITextViewerExtension2) previewViewer).removePainter(whitespaceCharacterPainter);
            whitespaceCharacterPainter = null;
        }
    }
}
项目:ftc    文件:TweakedLinkedModeUI.java   
private void unregisterAutoEditVetoer(ITextViewer viewer) {
    try {
        String[] contentTypes = getContentTypes(viewer.getDocument());
        if (viewer instanceof ITextViewerExtension2) {
            ITextViewerExtension2 vExtension = ((ITextViewerExtension2) viewer);
            for (int i = 0; i < contentTypes.length; i++) {
                vExtension.removeAutoEditStrategy(fAutoEditVetoer, contentTypes[i]);
            }
        } else {
            Assert.isTrue(false);
        }
    } catch (BadPartitioningException e) {
        leave(ILinkedModeListener.EXIT_ALL);
    }
}
项目:LogViewer    文件:LogFileViewer.java   
private void createCursorLinePainter() {
    cursorLinePainter = new CursorLinePainter(txtViewer);
    Color color = new Color(Display.getCurrent(),PreferenceConverter.getColor(store,ILogViewerConstants.PREF_CURSORLINE_COLOR));
    cursorLinePainter.setHighlightColor(color);
    ITextViewerExtension2 extension = (ITextViewerExtension2)txtViewer;
    extension.addPainter(cursorLinePainter);
}
项目:velocity-edit    文件:VelocityEditor.java   
private void repairRepresentation(boolean redrawAll)
{
    if (fActiveRegion == null) { return; }
    ISourceViewer viewer = getSourceViewer();
    if (viewer != null)
    {
        resetCursor(viewer);
        int offset = fActiveRegion.getOffset();
        int length = fActiveRegion.getLength();
        // remove style
        if (!redrawAll && viewer instanceof ITextViewerExtension2)
        {
            ((ITextViewerExtension2) viewer).invalidateTextPresentation(offset, length);
        } else
        {
            viewer.invalidateTextPresentation();
        }
        // remove underline
        if (viewer instanceof ITextViewerExtension5)
        {
            ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
            offset = extension.modelOffset2WidgetOffset(offset);
        } else
        {
            offset -= viewer.getVisibleRegion().getOffset();
        }
        StyledText text = viewer.getTextWidget();
        try
        {
            text.redrawRange(offset, length, true);
        }
        catch (IllegalArgumentException x)
        {
        }
    }
    fActiveRegion = null;
}
项目:APICloud-Studio    文件:ThemeableEditorExtension.java   
public void createBackgroundPainter(ISourceViewer viewer)
{
    if (fFullLineBackgroundPainter == null)
    {
        if (viewer instanceof ITextViewerExtension2)
        {
            boolean lineHighlight = Platform.getPreferencesService().getBoolean(EditorsUI.PLUGIN_ID,
                    AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true, null);
            fFullLineBackgroundPainter = new LineBackgroundPainter(viewer);
            fFullLineBackgroundPainter.setHighlightLineEnabled(lineHighlight);
            ITextViewerExtension2 extension = (ITextViewerExtension2) viewer;
            extension.addPainter(fFullLineBackgroundPainter);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AbstractJavaCompletionProposal.java   
private void repairPresentation(ITextViewer viewer) {
    if (fRememberedStyleRange != null) {
        if (viewer instanceof ITextViewerExtension2) {
            // attempts to reduce the redraw area
            ITextViewerExtension2 viewer2= (ITextViewerExtension2)viewer;
            viewer2.invalidateTextPresentation(fRememberedStyleRange.start, fRememberedStyleRange.length);
        } else
            viewer.invalidateTextPresentation();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AbstractJavaCompletionProposal.java   
private void repairPresentation(ITextViewer viewer) {
    if (fRememberedStyleRange != null) {
        if (viewer instanceof ITextViewerExtension2) {
            // attempts to reduce the redraw area
            ITextViewerExtension2 viewer2= (ITextViewerExtension2)viewer;
            viewer2.invalidateTextPresentation(fRememberedStyleRange.start, fRememberedStyleRange.length);
        } else
            viewer.invalidateTextPresentation();
    }
}
项目:Pydev    文件:PyCompletionPresentationUpdater.java   
private void repairPresentation(ITextViewer viewer) {
    if (fRememberedStyleRange != null) {
        if (viewer instanceof ITextViewerExtension2) {
            // attempts to reduce the redraw area
            ITextViewerExtension2 viewer2 = (ITextViewerExtension2) viewer;
            viewer2.invalidateTextPresentation(fRememberedStyleRange.start, fRememberedStyleRange.length);
        } else {
            viewer.invalidateTextPresentation();
        }
    }
}
项目:APICloud-Studio    文件:LineBackgroundPainter.java   
public void paint(int reason)
{
    if (fViewer == null)
    {
        return;
    }
    if (fViewer.getDocument() == null)
    {
        deactivate(false);
        return;
    }

    // initialization
    if (!fIsActive)
    {
        StyledText textWidget = fViewer.getTextWidget();
        textWidget.addLineBackgroundListener(this);
        textWidget.addPaintListener(this);
        fPositionManager.managePosition(fCurrentLine);
        fIsActive = true;
    }

    // This forces redraw of the line highlight
    if (updateHighlightLine())
    {
        // clear last line
        // Fix the background colors for tokens that didn't have the same as line!
        if (isOpaque() && !fLastLine.isDeleted() && fViewer instanceof ITextViewerExtension2)
        {
            ITextViewerExtension2 ext = (ITextViewerExtension2) fViewer;
            try
            {
                ext.invalidateTextPresentation(fLastLine.getOffset(), fLastLine.getLength());
            }
            catch (Exception e)
            {
                IdeLog.logError(CommonEditorPlugin.getDefault(), MessageFormat.format(
                        "Error invalidating syntax coloring for offset {0}, length {1}", fLastLine.getOffset(), //$NON-NLS-1$
                        fLastLine.getLength()), e);
            }
        }
        drawHighlightLine(fLastLine);
        // draw new line
        drawHighlightLine(fCurrentLine);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaSourceViewerConfiguration.java   
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
    return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
项目:idecore    文件:ApexSourceViewerConfiguration.java   
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
    return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaSourceViewerConfiguration.java   
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
    return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
项目:Pydev    文件:PyEditConfiguration.java   
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
    return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
项目:goclipse    文件:AbstractLangSourceViewerConfiguration.java   
@Override
public final ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
    return getTextHover(sourceViewer, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}