java.lang.Object
qupath.lib.gui.scripting.richtextfx.stylers.JavaStyler
All Implemented Interfaces:
ScriptStyler
Direct Known Subclasses:
GroovyStyler, ImageJMacroStyler

public class JavaStyler extends Object implements ScriptStyler
Styling to apply to a CodeArea, based on Groovy or Java syntax.
Since:
v0.4.1
Implementation Note
This was rewritten for v0.4.1 to avoid relying on regex, which could sometimes result in a StackOverflowError.
  • Field Details

    • JAVA_KEYWORDS

      public static final Set<String> JAVA_KEYWORDS
      Main keywords in Java
  • Constructor Details

    • JavaStyler

      public JavaStyler()
    • JavaStyler

      protected JavaStyler(String languageName, boolean includeJavaKeywords, Collection<String> additionalKeywords, boolean includeGroovySyntax)
      Constructor useful for subclasses that share most syntax ruls with Java.
      Parameters:
      languageName - name of the language
      includeJavaKeywords - add standard Java keywords to any others that are supplied
      additionalKeywords - optional additional keywords
      includeGroovySyntax - support Groovy single/triple quotes and string interpolation
  • Method Details

    • getLanguageNames

      public Set<String> getLanguageNames()
      Description copied from interface: ScriptStyler
      Get a set of the scripting languages supported by this styler.

      Note: One of the names returned by this method must match exactly (but case-insensitive) that of the corresponding ScriptLanguage for QuPath to automatically apply it to the script editor when needed.

      Specified by:
      getLanguageNames in interface ScriptStyler
      Returns:
    • computeEditorStyles

      public org.fxmisc.richtext.model.StyleSpans<Collection<String>> computeEditorStyles(String text)
      Description copied from interface: ScriptStyler
      Compute styling for the specified text, considering it will be used in the main editor.
      Specified by:
      computeEditorStyles in interface ScriptStyler
      Parameters:
      text - the text to process styling for
      Returns:
      stylespans the StyleSpans to apply
    • computeConsoleStyles

      public org.fxmisc.richtext.model.StyleSpans<Collection<String>> computeConsoleStyles(String text, boolean logConsole)
      Description copied from interface: ScriptStyler
      Compute styling for the specified text, considering it will be used in the console.
      Specified by:
      computeConsoleStyles in interface ScriptStyler
      Parameters:
      text - the text to process styling for
      logConsole - if true, the console prints to the log rather than directly
      Returns:
      stylespans the StyleSpans to apply