Search in sources :

Example 6 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project titan.EclipsePlug-ins by eclipse.

the class Configuration method getAutoEditStrategies.

@Override
public IAutoEditStrategy[] getAutoEditStrategies(final ISourceViewer sourceViewer, final String contentType) {
    HeuristicalIntervalDetector detector = new HeuristicalIntervalDetector();
    GeneralTITANAutoEditStrategy strategy2 = new ClosingBracketIndentationAutoEditStrategy();
    strategy2.setHeuristicIntervalDetector(detector);
    GeneralTITANAutoEditStrategy strategy3 = new SmartIndentAfterNewLineAutoEditStrategy();
    strategy3.setHeuristicIntervalDetector(detector);
    return new IAutoEditStrategy[] { new BracketCompletionAutoEditStrategy(), strategy2, strategy3 };
}
Also used : ClosingBracketIndentationAutoEditStrategy(org.eclipse.titan.designer.editors.ClosingBracketIndentationAutoEditStrategy) IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) BracketCompletionAutoEditStrategy(org.eclipse.titan.designer.editors.BracketCompletionAutoEditStrategy) GeneralTITANAutoEditStrategy(org.eclipse.titan.designer.editors.GeneralTITANAutoEditStrategy)

Example 7 with IAutoEditStrategy

use of org.eclipse.jface.text.IAutoEditStrategy in project titan.EclipsePlug-ins by eclipse.

the class Configuration method getAutoEditStrategies.

@Override
public IAutoEditStrategy[] getAutoEditStrategies(final ISourceViewer sourceViewer, final String contentType) {
    HeuristicalIntervalDetector detector = new HeuristicalIntervalDetector();
    GeneralTITANAutoEditStrategy strategy2 = new ClosingBracketIndentationAutoEditStrategy();
    strategy2.setHeuristicIntervalDetector(detector);
    GeneralTITANAutoEditStrategy strategy3 = new SmartIndentAfterNewLineAutoEditStrategy();
    strategy3.setHeuristicIntervalDetector(detector);
    return new IAutoEditStrategy[] { new BracketCompletionAutoEditStrategy(), strategy2, strategy3 };
}
Also used : ClosingBracketIndentationAutoEditStrategy(org.eclipse.titan.designer.editors.ClosingBracketIndentationAutoEditStrategy) IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) BracketCompletionAutoEditStrategy(org.eclipse.titan.designer.editors.BracketCompletionAutoEditStrategy) SmartIndentAfterNewLineAutoEditStrategy(org.eclipse.titan.designer.editors.ttcn3editor.SmartIndentAfterNewLineAutoEditStrategy) GeneralTITANAutoEditStrategy(org.eclipse.titan.designer.editors.GeneralTITANAutoEditStrategy) HeuristicalIntervalDetector(org.eclipse.titan.designer.editors.HeuristicalIntervalDetector)

Example 8 with IAutoEditStrategy

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

the class AutoEditStrategyRegistry method sync.

private void sync() {
    Set<IConfigurationElement> toRemoveExtensions = new HashSet<>(this.extensions.keySet());
    for (IConfigurationElement extension : Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID)) {
        toRemoveExtensions.remove(extension);
        if (!this.extensions.containsKey(extension)) {
            try {
                this.extensions.put(extension, new GenericContentTypeRelatedExtension<IAutoEditStrategy>(extension));
            } catch (Exception ex) {
                GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex));
            }
        }
    }
    for (IConfigurationElement toRemove : toRemoveExtensions) {
        this.extensions.remove(toRemove);
    }
    this.outOfSync = false;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) HashSet(java.util.HashSet)

Example 9 with IAutoEditStrategy

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

the class JSDTStructuredTextViewerConfigurationJSP method getAutoEditStrategies.

/**
 * @see org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP#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 10 with IAutoEditStrategy

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

the class StructuredTextViewerConfigurationCSS 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]);
    }
    return (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[0]);
}
Also used : IAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

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