org.eclipse.jface.text.rules.RuleBasedScanner Java Examples

The following examples show how to use org.eclipse.jface.text.rules.RuleBasedScanner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImpexSourceViewerConfig.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
protected RuleBasedScanner getImpexScanner(String partition) {
	
	RuleBasedScanner scanner = scanMap.get(partition); 
	if (scanner == null) {
		scanner = new ImpexRuleScanner(ColorProvider.getInstance());
		if (partition != null) {
			switch (partition) {
			case ImpexDocumentPartitioner.IMPEX_INSTRUCTION:
				scanner = new InstructionsRuleScanner(ColorProvider.getInstance());
				break;
			}
		}
		
	}
	return scanner;
}
 
Example #2
Source File: HConfiguration.java    From http4e with Apache License 2.0 5 votes vote down vote up
private RuleBasedScanner getValueScanner(){
   if (valueScanner == null) {
       valueScanner = new HValueScanner();
       valueScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.STRING))));
   }
   return valueScanner;
}
 
Example #3
Source File: JSSourceViewerConfiguration.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets default scanner
 * 
 * @return scanner
 */
protected RuleBasedScanner getDefaultScanner( )
{
	if ( scanner == null )
	{
		scanner = new JSScanner( );
		scanner.setDefaultReturnToken( new Token( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_CONTENT_COLOR_PREFERENCE ) ) );
	}
	return scanner;
}
 
Example #4
Source File: SyntaxHighlighter.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
ITokenScanner getCommentScanner() {
    // lazy init
    if (this.commentScanner == null) {
        final Token comment = new Token(new TextAttribute(JFaceResources.getColorRegistry().get(COMMENT_COLOR)));
        // no rules needed, because this will apply to comment partition
        // only
        final RuleBasedScanner ruleBasedScanner = new RuleBasedScanner();
        // this will apply the syntax
        ruleBasedScanner.setDefaultReturnToken(comment);
        this.commentScanner = ruleBasedScanner;
    }
    return commentScanner;
}
 
Example #5
Source File: CompositeSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private ITokenScanner getStartEndTokenScanner() {
	if (startEndTokenScanner == null) {
		RuleBasedScanner ts = new RuleBasedScanner();
		IToken seqToken = new Token(getStartEndTokenType());
		List<IRule> rules = new ArrayList<IRule>();
		for (String[] pair : getPartitionerSwitchStrategy().getSwitchTagPairs()) {
			rules.add(new SingleTagRule(pair[0], seqToken));
			rules.add(new SingleTagRule(pair[1], seqToken));
		}
		ts.setRules(rules.toArray(new IRule[rules.size()]));
		ts.setDefaultReturnToken(new Token("text")); //$NON-NLS-1$
		startEndTokenScanner = ts;
	}
	return startEndTokenScanner;
}
 
Example #6
Source File: HConfiguration.java    From http4e with Apache License 2.0 5 votes vote down vote up
private RuleBasedScanner getCommentScanner(){
   if (commentScanner == null) {
       commentScanner = new HCommentScanner();
       commentScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.COMMENT))));
   }
   return commentScanner;
}
 
Example #7
Source File: HConfiguration.java    From http4e with Apache License 2.0 5 votes vote down vote up
private RuleBasedScanner getDefaultScanner(){
   if (defaultScanner == null) {
       defaultScanner = new HDefaultScanner();
       defaultScanner.setDefaultReturnToken(new Token(new TextAttribute(ResourceUtils.getColor(Styles.KEY))));
   }
   return defaultScanner;
}
 
Example #8
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a scanner which is configured to scan Java strings.
 *
 * @return a Java string scanner
 * @since 2.0
 * @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getStringScanner()}
 */
public RuleBasedScanner getStringScanner() {
	return fStringScanner;
}
 
Example #9
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the property value scanner for this configuration.
 *
 * @return the property value scanner
 */
protected RuleBasedScanner getPropertyValueScanner() {
	return propertyValueScanner;
}
 
Example #10
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the section scanner for this configuration.
 *
 * @return the section scanner
 */
protected RuleBasedScanner getSectionNameScanner() {
	return sectionScanner;
}
 
Example #11
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the comment scanner for this configuration.
 *
 * @return the comment scanner
 */
protected RuleBasedScanner getCommentScanner() {
	return commentScanner;
}
 
Example #12
Source File: EditorConfigSourceViewerConfiguration.java    From editorconfig-eclipse with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the property key scanner for this configuration.
 *
 * @return the property key scanner
 */
protected RuleBasedScanner getPropertyKeyScanner() {
	return propertyKeyScanner;
}
 
Example #13
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the property value scanner for this configuration.
 *
 * @return the property value scanner
 */
protected RuleBasedScanner getPropertyValueScanner() {
	return fPropertyValueScanner;
}
 
Example #14
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the comment scanner for this configuration.
 *
 * @return the comment scanner
 */
protected RuleBasedScanner getCommentScanner() {
	return fCommentScanner;
}
 
Example #15
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the property key scanner for this configuration.
 *
 * @return the property key scanner
 */
protected RuleBasedScanner getPropertyKeyScanner() {
	return fPropertyKeyScanner;
}
 
Example #16
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a scanner which is configured to scan JavaDoc compliant comments.
 * <p>
 * Note that the start sequence "/**" and the corresponding end sequence
 * are part of the Javadoc comment.</p>
 *
 * @return a Javadoc scanner
 * @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getJavaDocScanner()}
 */
public RuleBasedScanner getJavaDocScanner() {
	return fJavaDocScanner;
}
 
Example #17
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 2 votes vote down vote up
/**
 * Returns the JSX source code scanner for this configuration.
 *
 * @return the JSX source code scanner
 */
protected RuleBasedScanner getJSXScanner() {
	return jsxScanner;
}
 
Example #18
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a scanner which is configured to scan Java single-line comments.
 *
 * @return a Java single-line comment scanner
 * @since 2.0
 * @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getSinglelineCommentScanner()}
 */
public RuleBasedScanner getSinglelineCommentScanner() {
	return fSinglelineCommentScanner;
}
 
Example #19
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a scanner which is configured to scan Java multi-line comments.
 *
 * @return a Java multi-line comment scanner
 * @since 2.0
 * @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getMultilineCommentScanner()}
 */
public RuleBasedScanner getMultilineCommentScanner() {
	return fMultilineCommentScanner;
}
 
Example #20
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns a scanner which is configured to scan Java source code.
 *
 * @return a Java source code scanner
 * @deprecated As of 3.0, replaced by {@link JavaSourceViewerConfiguration#getCodeScanner()}
 */
public RuleBasedScanner getCodeScanner() {
	return fCodeScanner;
}
 
Example #21
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the JavaDoc scanner for this configuration.
 *
 * @return the JavaDoc scanner
 */
protected RuleBasedScanner getJavaDocScanner() {
	return fJavaDocScanner;
}
 
Example #22
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the Java string scanner for this configuration.
 *
 * @return the Java string scanner
 * @since 2.0
 */
protected RuleBasedScanner getStringScanner() {
	return fStringScanner;
}
 
Example #23
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the Java single-line comment scanner for this configuration.
 *
 * @return the Java single-line comment scanner
 * @since 2.0
 */
protected RuleBasedScanner getSinglelineCommentScanner() {
	return fSinglelineCommentScanner;
}
 
Example #24
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the Java multi-line comment scanner for this configuration.
 *
 * @return the Java multi-line comment scanner
 * @since 2.0
 */
protected RuleBasedScanner getMultilineCommentScanner() {
	return fMultilineCommentScanner;
}
 
Example #25
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the Java source code scanner for this configuration.
 *
 * @return the Java source code scanner
 */
protected RuleBasedScanner getCodeScanner() {
	return fCodeScanner;
}
 
Example #26
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 2 votes vote down vote up
/**
 * Returns the TypeScript source code scanner for this configuration.
 *
 * @return the TypeScript source code scanner
 */
@Override
protected RuleBasedScanner getCodeScanner() {
	return fCodeScanner;
}