Search in sources :

Example 1 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project linuxtools by eclipse.

the class SpecfileConfiguration method getAutoEditStrategies.

@Override
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
    if (isTabConversionEnabled()) {
        TabsToSpacesConverter tabsConverter = new TabsToSpacesConverter();
        tabsConverter.setLineTracker(new DefaultLineTracker());
        tabsConverter.setNumberOfSpacesPerTab(getTabSize());
        return new IAutoEditStrategy[] { tabsConverter };
    }
    return null;
}
Also used : DefaultLineTracker(org.eclipse.jface.text.DefaultLineTracker) IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) TabsToSpacesConverter(org.eclipse.jface.text.TabsToSpacesConverter)

Example 2 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfiguration method getAutoEditStrategies.

/* (non-Javadoc)
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
	 */
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
    List allStrategies = new ArrayList(0);
    IAutoEditStrategy[] superStrategies = super.getAutoEditStrategies(sourceViewer, contentType);
    for (int i = 0; i < superStrategies.length; i++) {
        allStrategies.add(superStrategies[i]);
    }
    // add auto edit strategies contributed by clients
    List extendedAutoEdits = ExtendedConfigurationBuilder.getInstance().getConfigurations(AUTOEDITSTRATEGY, contentType);
    if (!extendedAutoEdits.isEmpty()) {
        allStrategies.addAll(extendedAutoEdits);
    }
    return (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
}
Also used : IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationJSDT method getAutoEditStrategies.

/**
 * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
 */
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
    if (contentType.equals(IHTMLPartitions.SCRIPT) || contentType.equals(IHTMLPartitions.SCRIPT_EVENTHANDLER)) {
        IAutoEditStrategy[] strategies = new IAutoEditStrategy[1];
        strategies[0] = new AutoEditStrategyForJs();
        return strategies;
    } else {
        return super.getAutoEditStrategies(sourceViewer, contentType);
    }
}
Also used : IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) AutoEditStrategyForJs(org.eclipse.wst.jsdt.web.ui.internal.autoedit.AutoEditStrategyForJs)

Example 4 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationXML method getAutoEditStrategies.

public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
    List allStrategies = new ArrayList(0);
    IAutoEditStrategy[] superStrategies = super.getAutoEditStrategies(sourceViewer, contentType);
    for (int i = 0; i < superStrategies.length; i++) {
        allStrategies.add(superStrategies[i]);
    }
    // be sure this is last, so it can modify any results form previous
    // commands that might on on same partiion type.
    // add auto edit strategy that handles when tab key is pressed
    allStrategies.add(new AutoEditStrategyForTabs());
    return (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
}
Also used : IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) AutoEditStrategyForTabs(org.eclipse.wst.xml.ui.internal.autoedit.AutoEditStrategyForTabs)

Example 5 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project n4js by eclipse.

the class AutoEditStrategyProvider method configureMultilineComments.

@Override
protected void configureMultilineComments(IEditStrategyAcceptor acceptor) {
    IAutoEditStrategy multiline = multiLineTerminals.newInstance("/*", " * ", " */");
    IAutoEditStrategy singleline = singleLineTerminals.newInstance("/*", " */", new SupressingMLCommentPredicate());
    acceptor.accept(singleline, IDocument.DEFAULT_CONTENT_TYPE);
    acceptor.accept(multiline, IDocument.DEFAULT_CONTENT_TYPE);
    acceptor.accept(multiline, TerminalsTokenTypeToPartitionMapper.COMMENT_PARTITION);
    acceptor.accept(multiline, JS_DOC_PARTITION);
    acceptor.accept(singleLineTerminals.newInstance("/*", " */"), REG_EX_PARTITION);
    acceptor.accept(multiline, REG_EX_PARTITION);
}
Also used : IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy)

Aggregations

IAutoEditStrategy (org.eclipse.jface.text.IAutoEditStrategy)14 ArrayList (java.util.ArrayList)5 List (java.util.List)5 BracketCompletionAutoEditStrategy (org.eclipse.titan.designer.editors.BracketCompletionAutoEditStrategy)4 ClosingBracketIndentationAutoEditStrategy (org.eclipse.titan.designer.editors.ClosingBracketIndentationAutoEditStrategy)4 GeneralTITANAutoEditStrategy (org.eclipse.titan.designer.editors.GeneralTITANAutoEditStrategy)4 HeuristicalIntervalDetector (org.eclipse.titan.designer.editors.HeuristicalIntervalDetector)3 SmartIndentAfterNewLineAutoEditStrategy (org.eclipse.titan.designer.editors.ttcn3editor.SmartIndentAfterNewLineAutoEditStrategy)2 AutoEditStrategyForJs (org.eclipse.wst.jsdt.web.ui.internal.autoedit.AutoEditStrategyForJs)2 HashSet (java.util.HashSet)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 DefaultLineTracker (org.eclipse.jface.text.DefaultLineTracker)1 TabsToSpacesConverter (org.eclipse.jface.text.TabsToSpacesConverter)1 AutoEditStrategyForTabs (org.eclipse.jst.jsp.ui.internal.autoedit.AutoEditStrategyForTabs)1 StructuredAutoEditStrategyJSP (org.eclipse.jst.jsp.ui.internal.autoedit.StructuredAutoEditStrategyJSP)1 StructuredAutoEditStrategyJSPJava (org.eclipse.jst.jsp.ui.internal.autoedit.StructuredAutoEditStrategyJSPJava)1 AutoEditStrategyForTabs (org.eclipse.wst.html.ui.internal.autoedit.AutoEditStrategyForTabs)1 AutoEditStrategyForTabs (org.eclipse.wst.xml.ui.internal.autoedit.AutoEditStrategyForTabs)1