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

项目: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();
    }
}