use of org.eclipse.jface.text.IAutoEditStrategy in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfigurationHTML 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 added last in list, so it has a change to modify
// previous results.
// add auto edit strategy that handles when tab key is pressed
allStrategies.add(new AutoEditStrategyForTabs());
return (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
}
use of org.eclipse.jface.text.IAutoEditStrategy in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfigurationJSP 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) {
IAutoEditStrategy[] strategies = null;
if (contentType == IXMLPartitions.XML_DEFAULT) {
// xml autoedit strategies
strategies = getXMLSourceViewerConfiguration().getAutoEditStrategies(sourceViewer, contentType);
} else if (contentType == IJSPPartitions.JSP_CONTENT_JAVA) {
// jsp java autoedit strategies
List allStrategies = new ArrayList(0);
// add the scritplet autoedit strategy first
allStrategies.add(new StructuredAutoEditStrategyJSPJava());
IAutoEditStrategy[] javaStrategies = getJavaSourceViewerConfiguration().getAutoEditStrategies(sourceViewer, IJavaPartitions.JAVA_PARTITIONING);
for (int i = 0; i < javaStrategies.length; i++) {
allStrategies.add(javaStrategies[i]);
}
// be sure this is added last, after others, so it can modify
// results from earlier steps.
// add auto edit strategy that handles when tab key is pressed
allStrategies.add(new AutoEditStrategyForTabs());
strategies = (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
} else if (contentType == IHTMLPartitions.HTML_DEFAULT || contentType == IHTMLPartitions.HTML_DECLARATION || contentType == IJSPPartitions.JSP_DIRECTIVE) {
// html and jsp autoedit strategies
List allStrategies = new ArrayList(0);
// add the jsp autoedit strategy first then add all html's
allStrategies.add(new StructuredAutoEditStrategyJSP());
IAutoEditStrategy[] htmlStrategies = getHTMLSourceViewerConfiguration().getAutoEditStrategies(sourceViewer, contentType);
for (int i = 0; i < htmlStrategies.length; i++) {
allStrategies.add(htmlStrategies[i]);
}
strategies = (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
} else {
// default autoedit strategies
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 added last, after others, so it can modify
// results from earlier steps.
// add auto edit strategy that handles when tab key is pressed
allStrategies.add(new AutoEditStrategyForTabs());
strategies = (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
}
return strategies;
}
use of org.eclipse.jface.text.IAutoEditStrategy in project titan.EclipsePlug-ins by eclipse.
the class Configuration method getAutoEditStrategies.
/**
* Returns the auto indentation strategy ready to be used with the given
* source viewer when manipulating text of the given content type..
*
* @param sourceViewer
* the source viewer to be configured by this
* configuration
* @param contentType
* the content type for which the strategy is applicable
* @return the auto indent strategy or <code>null</code> if automatic
* indentation is not to be enabled
*/
@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 };
}
use of org.eclipse.jface.text.IAutoEditStrategy in project titan.EclipsePlug-ins by eclipse.
the class Configuration method getAutoEditStrategies.
/**
* Returns the auto indentation strategy ready to be used with the given
* source viewer when manipulating text of the given content type..
*
* @param sourceViewer
* the source viewer to be configured by this
* configuration
* @param contentType
* the content type for which the strategy is applicable
* @return the auto indent strategy or <code>null</code> if automatic
* indentation is not to be enabled
*/
@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 };
}
Aggregations