java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.designer.gui.tools.CodeEditor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class CodeEditor extends JPanel
CodeEditor is a panel that includes a syntax highlighting text area that wraps RSyntaxTextArea. This should be used for e.g. SQL based editing inside the designer, or anywhere else you might need an editor that's able to easily handle multiple different syntaxes.

For Python editing, prefer PythonTextArea or ExtensionFunctionPanel.

For the Jide-based CodeEditor, see CodeEditorFactory, but it is generally not recommended due to issues with high DPI displays.

Since:
7.8.1
See Also:
  • Field Details

    • textArea

      protected com.inductiveautomation.ignition.designer.gui.tools.DisplayTrackingSyntaxTextArea textArea
    • rTextScrollPane

      protected org.fife.ui.rtextarea.RTextScrollPane rTextScrollPane
    • collapsingSectionPanel

      protected org.fife.rsta.ui.CollapsibleSectionPanel collapsingSectionPanel
  • Constructor Details

    • CodeEditor

      public CodeEditor()
    • CodeEditor

      public CodeEditor(JFrame parent, DesignerContext context)
      This constructor will instantiate a CodeEditor and use the context's script manager to populate and initialize the auto completion hints using default color theme and Python syntax highlighting.
    • CodeEditor

      public CodeEditor(DesignerContext context)
  • Method Details

    • fixCommentAction

      public static void fixCommentAction(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Remove the pre-seeded 'close tag' action from KeyEvent.VK_SLASH and replace it with RSyntaxTextAreaEditorKit.rstaToggleCommentAction
      Parameters:
      textArea - the text area to modify the input map of
    • getCurrentTheme

      public NamedTheme getCurrentTheme()
    • setCurrentTheme

      public void setCurrentTheme(NamedTheme namedTheme)
    • getCollapsingSectionPanel

      public org.fife.rsta.ui.CollapsibleSectionPanel getCollapsingSectionPanel()
    • getrTextScrollPane

      public org.fife.ui.rtextarea.RTextScrollPane getrTextScrollPane()
    • getErrorStrip

      public org.fife.ui.rsyntaxtextarea.ErrorStrip getErrorStrip()
    • getTextArea

      public org.fife.ui.rsyntaxtextarea.RSyntaxTextArea getTextArea()
    • getText

      public String getText()
      Returns the text held by the internal RSyntaxText area. If the text area is null, an empty string is returned.
      Returns:
      the contents of the code editor, or an empty String
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent