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

项目:typescript.java    文件:TypeScriptEditor.java   
@Override
protected void installTabsToSpacesConverter() {
    ISourceViewer sourceViewer = getSourceViewer();
    SourceViewerConfiguration config = getSourceViewerConfiguration();
    if (config != null && sourceViewer instanceof ITextViewerExtension7) {
        int tabWidth = config.getTabWidth(sourceViewer);
        TabsToSpacesConverter tabToSpacesConverter = new TabsToSpacesConverter();
        tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
        IDocumentProvider provider = getDocumentProvider();
        if (provider instanceof ICompilationUnitDocumentProvider) {
            ICompilationUnitDocumentProvider cup = (ICompilationUnitDocumentProvider) provider;
            tabToSpacesConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
        } else
            tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
        ((ITextViewerExtension7) sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
        updateIndentPrefixes();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitEditor.java   
@Override
protected void installTabsToSpacesConverter() {
    ISourceViewer sourceViewer= getSourceViewer();
    SourceViewerConfiguration config= getSourceViewerConfiguration();
    if (config != null && sourceViewer instanceof ITextViewerExtension7) {
        int tabWidth= config.getTabWidth(sourceViewer);
        TabsToSpacesConverter tabToSpacesConverter= new TabsToSpacesConverter();
        tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
        IDocumentProvider provider= getDocumentProvider();
        if (provider instanceof ICompilationUnitDocumentProvider) {
            ICompilationUnitDocumentProvider cup= (ICompilationUnitDocumentProvider) provider;
            tabToSpacesConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
        } else
            tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
        ((ITextViewerExtension7)sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
        updateIndentPrefixes();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitEditor.java   
@Override
protected void installTabsToSpacesConverter() {
    ISourceViewer sourceViewer= getSourceViewer();
    SourceViewerConfiguration config= getSourceViewerConfiguration();
    if (config != null && sourceViewer instanceof ITextViewerExtension7) {
        int tabWidth= config.getTabWidth(sourceViewer);
        TabsToSpacesConverter tabToSpacesConverter= new TabsToSpacesConverter();
        tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
        IDocumentProvider provider= getDocumentProvider();
        if (provider instanceof ICompilationUnitDocumentProvider) {
            ICompilationUnitDocumentProvider cup= (ICompilationUnitDocumentProvider) provider;
            tabToSpacesConverter.setLineTracker(cup.createLineTracker(getEditorInput()));
        } else
            tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
        ((ITextViewerExtension7)sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
        updateIndentPrefixes();
    }
}
项目:tm4e    文件:TextUtils.java   
public static TabSpacesInfo getTabSpaces(ITextViewer viewer) {
    TabsToSpacesConverter converter = ClassHelper.getFieldValue(viewer, "fTabsToSpacesConverter", TextViewer.class);
    if (converter != null) {
        int tabSize = ClassHelper.getFieldValue(converter, "fTabRatio", TabsToSpacesConverter.class);
        return new TabSpacesInfo(tabSize, true);
    }
    return new TabSpacesInfo(-1, false);
}
项目:tlaplus    文件:FormHelper.java   
/**
 * Retrieves the tab to spaces converter
 * @return
 */
public static TabsToSpacesConverter getTabToSpacesConverter()
{
    TabsToSpacesConverter converter = new TabsToSpacesConverter();
    converter.setNumberOfSpacesPerTab(4);
    return converter;
}