Class ScriptEditControl

  • All Implemented Interfaces:
    EditorAction

    public class ScriptEditControl
    extends java.lang.Object
    implements EditorAction
    ScriptEditControl - Manages events and data flow for the script editor entity. There's always at most only one frame open. Additional files get attached to the tab bar.
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptEditControl​(@NotNull javax.swing.filechooser.FileFilter scriptFileFilter, @NotNull java.lang.String scriptSuffix, @NotNull java.awt.Frame owner, java.io.File defaultScriptDir, @NotNull java.util.prefs.Preferences preferences, @NotNull Exiter exiter, @NotNull AppPreferencesModel appPreferencesModel, @NotNull ScriptEditControlCallback callback)  
    • Constructor Detail

      • ScriptEditControl

        public ScriptEditControl​(@NotNull
                                 @NotNull javax.swing.filechooser.FileFilter scriptFileFilter,
                                 @NotNull
                                 @NotNull java.lang.String scriptSuffix,
                                 @NotNull
                                 @NotNull java.awt.Frame owner,
                                 java.io.File defaultScriptDir,
                                 @NotNull
                                 @NotNull java.util.prefs.Preferences preferences,
                                 @NotNull
                                 @NotNull Exiter exiter,
                                 @NotNull
                                 @NotNull AppPreferencesModel appPreferencesModel,
                                 @NotNull
                                 @NotNull ScriptEditControlCallback callback)
        Parameters:
        appPreferencesModel - the global AppPreferencesModel instance
        callback - the callback function for reporting problems when starting an external editor
    • Method Detail

      • setTextAreaDefaults

        @Deprecated
        public void setTextAreaDefaults​(@NotNull
                                        @NotNull TextAreaDefaults textAreaDefaults)
        Deprecated.
      • registerActivePopup

        public static void registerActivePopup​(@NotNull
                                               @NotNull CFPythonPopup activePopup)
        Register last active popup. When the script pad frame is hidden, this popup will be closed (if still open).
        Parameters:
        activePopup - active popup to register
      • newScript

        @ActionMethod
        public void newScript()
        Open a new empty script document.
      • openScriptFile

        public void openScriptFile​(@NotNull
                                   @NotNull java.io.File file)
        Opens a script file.
        Parameters:
        file - the script file to open
      • openUser

        public void openUser()
        Open a file which is chosen by the user.
      • closeActiveTab

        public boolean closeActiveTab()
        Close the active script-tab.
        Returns:
        true if the tab was closed, or false if the user has canceled
      • closeAllTabs

        public boolean closeAllTabs()
        Close all opened script-tabs.
        Returns:
        true if all tabs have been closed, or false if the user has canceled.
      • saveAsActiveTab

        public void saveAsActiveTab()
        Open a file browser and prompt the user for a location/name to store this file. If everything goes fine, the file is saved.
      • saveActiveTab

        public void saveActiveTab()
        Save the active script-tab to the stored file path.
      • setAction

        public void setAction​(@NotNull
                              @NotNull javax.swing.Action action,
                              @NotNull
                              @NotNull java.lang.String name)
        Description copied from interface: EditorAction
        Sets the Action instance for this editor action.
        Specified by:
        setAction in interface EditorAction
        Parameters:
        action - the action instance
        name - the name of the action