Search in sources :

Example 1 with ITextViewerExtension7

use of org.eclipse.jface.text.ITextViewerExtension7 in project eclipse.platform.text by eclipse.

the class AbstractTextEditor method installTabsToSpacesConverter.

// ---- Tabs to spaces conversion support ------------------
/**
 * Installs a tabs to spaces converter.
 *
 * <p>Subclasses may extend or override this method.</p>
 *
 * @since 3.3
 */
protected void installTabsToSpacesConverter() {
    SourceViewerConfiguration config = getSourceViewerConfiguration();
    if (config != null && fSourceViewer instanceof ITextViewerExtension7) {
        int tabWidth = config.getTabWidth(fSourceViewer);
        TabsToSpacesConverter tabToSpacesConverter = new TabsToSpacesConverter();
        tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
        tabToSpacesConverter.setNumberOfSpacesPerTab(tabWidth);
        ((ITextViewerExtension7) fSourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
        updateIndentPrefixes();
    }
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) DefaultLineTracker(org.eclipse.jface.text.DefaultLineTracker) ITextViewerExtension7(org.eclipse.jface.text.ITextViewerExtension7) TabsToSpacesConverter(org.eclipse.jface.text.TabsToSpacesConverter) Point(org.eclipse.swt.graphics.Point)

Aggregations

DefaultLineTracker (org.eclipse.jface.text.DefaultLineTracker)1 ITextViewerExtension7 (org.eclipse.jface.text.ITextViewerExtension7)1 TabsToSpacesConverter (org.eclipse.jface.text.TabsToSpacesConverter)1 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)1 Point (org.eclipse.swt.graphics.Point)1