java.lang.Object
qupath.lib.gui.scripting.richtextfx.stylers.XmlStyler
All Implemented Interfaces:
ScriptStyler

public class XmlStyler extends Object implements ScriptStyler
Styling to apply to a CodeArea for XML.

This is based on XMLEditorDemo.java from RichTextFX, available at https://github.com/FXMisc/RichTextFX/blob/master/richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/XMLEditorDemo.java and adapted for use in QuPath.

The license for RichTextFX is given below:

   Copyright (c) 2013-2017, Tomas Mikula and contributors
   
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
   
   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
   
   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
   
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
   IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
Since:
v0.4.0
Author:
Pete Bankhead
  • 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