Java Code Examples for org.fife.ui.rsyntaxtextarea.SyntaxConstants#SYNTAX_STYLE_GROOVY

The following examples show how to use org.fife.ui.rsyntaxtextarea.SyntaxConstants#SYNTAX_STYLE_GROOVY . 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: ConsolePanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
private static String getSyntaxForScript(String engine) {
    String engineLc = engine.toLowerCase(Locale.ROOT);
    if (engineLc.startsWith("clojure")) {
        return SyntaxConstants.SYNTAX_STYLE_CLOJURE;
    } else if (engineLc.startsWith("groovy")) {
        return SyntaxConstants.SYNTAX_STYLE_GROOVY;
    } else if (engineLc.startsWith("ecmacript")) {
        return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
    } else if (engineLc.startsWith("javascript")) {
        return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
    } else if (engineLc.startsWith("python")) {
        return SyntaxConstants.SYNTAX_STYLE_PYTHON;
    } else if (engineLc.startsWith("ruby")) {
        return SyntaxConstants.SYNTAX_STYLE_RUBY;
    } else if (engineLc.startsWith("scala")) {
        return SyntaxConstants.SYNTAX_STYLE_SCALA;
    } else {
        return SyntaxConstants.SYNTAX_STYLE_NONE;
    }
}
 
Example 2
Source File: PmdDataSourceEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String mapLanguageToSyntaxHighlighting( final ScriptEngineFactory script ) {
  if ( script == null ) {
    return SyntaxConstants.SYNTAX_STYLE_NONE;
  }

  final String language = script.getLanguageName();
  if ( "ECMAScript".equalsIgnoreCase( language )
     || "js".equalsIgnoreCase( language )
     || "rhino".equalsIgnoreCase( language )
     || "javascript".equalsIgnoreCase( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
  }
  if ( "groovy".equalsIgnoreCase( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
  }
  return SyntaxConstants.SYNTAX_STYLE_NONE;
}
 
Example 3
Source File: ScriptableDataSourceEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String mapLanguageToSyntaxHighlighting( final String language ) {
  if ( "beanshell".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVA;
  }
  if ( "groovy".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
  }
  if ( "javascript".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
  }
  if ( "jython".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_PYTHON;
  }
  if ( "xslt".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_XML;
  }

  return SyntaxConstants.SYNTAX_STYLE_NONE;
}
 
Example 4
Source File: BeanShellScriptingExpressionEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String mapLanguageToSyntaxHighlighting( final String language ) {
  if ( "beanshell".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVA;
  }
  if ( "groovy".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
  }
  if ( "javascript".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
  }
  if ( "jython".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_PYTHON;
  }
  if ( "xslt".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_XML;
  }

  return SyntaxConstants.SYNTAX_STYLE_NONE;
}
 
Example 5
Source File: BSFScriptingExpressionEditor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String mapLanguageToSyntaxHighlighting( final String language ) {
  if ( "beanshell".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVA;
  }
  if ( "groovy".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
  }
  if ( "javascript".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
  }
  if ( "jython".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_PYTHON;
  }
  if ( "xslt".equals( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_XML;
  }

  return SyntaxConstants.SYNTAX_STYLE_NONE;
}
 
Example 6
Source File: DesktopSourceCodeEditor.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void setMode(HighlightMode mode) {
    Preconditions.checkNotNullArgument(mode, "HighlightMode of SourceCodeEditor cannot be null");

    this.mode = mode;

    String modeId = "text/" + mode.getId();

    switch (modeId) {
        case SyntaxConstants.SYNTAX_STYLE_GROOVY:
        case SyntaxConstants.SYNTAX_STYLE_HTML:
        case SyntaxConstants.SYNTAX_STYLE_JAVA:
        case SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT:
        case SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE:
        case SyntaxConstants.SYNTAX_STYLE_SQL:
        case SyntaxConstants.SYNTAX_STYLE_XML:
        case SyntaxConstants.SYNTAX_STYLE_CSS:
            impl.setSyntaxEditingStyle(modeId);
            break;

        default:
            if (mode.getId().equals(HighlightMode.SCSS.getId())) {
                impl.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CSS);
            } else {
                impl.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
            }
            break;
    }
}
 
Example 7
Source File: GroovyEngineWrapper.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public String getSyntaxStyle() {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
}