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 defaults to Python syntax, bracket matching, line numbering, etc. The main components are RSyntaxTextArea, and related packages from.
Since:
7.8.1
See Also:
  • Field Details

    • PYTHON_KEYWORDS

      public static final String[] PYTHON_KEYWORDS
    • textArea

      protected org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea
    • rTextScrollPane

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

      protected org.fife.ui.autocomplete.AutoCompletion autoCompleter
    • 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

    • addAutoCompletionhints

      public void addAutoCompletionhints(String pathKey, List<ScriptFunctionHint> hints)
      Will add a one or more hints to the autocomplete system for all CodeEditors for the lifetime of this gateway. The 'pathKey' is generally the first part of the function's fully qualified path. For example, 'shared.timers.startTimer()' would have a pathKey of 'shared'.
      Parameters:
      pathKey - the key that will be registered with the autocompletion system.
      hints - a list of ScriptFunctionHint that will be added to the auto-completion system
    • removeAutoCompletions

      public void removeAutoCompletions(String pathKey, List<ScriptFunctionHint> hints)
      Removes all hints that have the same function signature as those in the list and are associated with the given pathKey
      Parameters:
      pathKey - the pathkey, generally the first part of the full function path
      hints - a list of all hints that should be removed from the map
    • rebuildDefaultCompletions

      protected void rebuildDefaultCompletions()
      Will rebuild the completions
    • 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)
    • showCompletionDescription

      public void showCompletionDescription(boolean show)
      Sets whether or not the autocompletion should pop up the description window for functions
      Parameters:
      show - true to show the description window, false to only show the autocomplete options
    • isShowCompletionDescription

      public boolean isShowCompletionDescription()
    • getAutoCompleter

      public org.fife.ui.autocomplete.AutoCompletion getAutoCompleter()
    • getCollapsingSectionPanel

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

      public org.fife.ui.autocomplete.CompletionProvider getCompletionProvider()
    • 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