Class jEdit


  • public class jEdit
    extends java.lang.Object
    The main class of the jEdit text editor.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void _closeBuffer​(View view, Buffer buffer)
      Closes the buffer, even if it has unsaved changes.
      static void _closeBuffer​(View view, Buffer buffer, boolean doNotSave)
      Closes the buffer, even if it has unsaved changes.
      static Buffer _getBuffer​(java.lang.String path)
      Deprecated.
      static void addActionSet​(ActionSet actionSet)
      Adds a new action set to jEdit's list of ActionSets (viewable from the shortcuts option pane).
      static void addPluginJAR​(java.lang.String path)
      Loads the plugin JAR with the specified path.
      static void backupSettingsFile​(java.io.File file)
      Backs up the specified file in the settings directory.
      static void checkBufferStatus​(View view)
      Checks each buffer's status on disk and shows the dialog box informing the user that buffers changed on disk, if necessary.
      static void checkBufferStatus​(View view, boolean currentBuffer)
      Checks buffer status on disk and shows the dialog box informing the user that buffers changed on disk, if necessary.
      static boolean closeAllBuffers​(View view)
      Closes all open buffers.
      static boolean closeAllBuffers​(View view, boolean isExiting)
      Closes all open buffers.
      static void closeBuffer​(EditPane editPane, Buffer buffer)
      Close a buffer.
      static boolean closeBuffer​(View view, Buffer buffer)
      Closes a buffer.
      static void closeView​(View view)
      Closes a view.
      static void commitTemporary​(Buffer buffer)
      Adds a temporary buffer to the buffer list.
      static void exit​(View view, boolean reallyExit)
      Exits cleanly from jEdit, prompting the user if any unsaved files should be saved first.
      static EditAction getAction​(java.lang.String name)
      Returns the specified action.
      static ActionContext getActionContext()
      Returns the action context used to store editor actions.
      static java.lang.String[] getActionNames()
      Returns all registered action names.
      static ActionSet getActionSetForAction​(java.lang.String action)
      Returns the action set that contains the specified action.
      static ActionSet[] getActionSets()
      Returns all registered action sets.
      static View getActiveView()
      Returns the currently focused view.
      static View getActiveViewInternal()
      Returns the internal active view, which might be null.
      static Mode[] getAllModes()
      Returns an array of all installed edit modes.
      static boolean getBooleanProperty​(java.lang.String name)
      Returns the value of a boolean property.
      static boolean getBooleanProperty​(java.lang.String name, boolean def)
      Returns the value of a boolean property.
      static Buffer getBuffer​(java.lang.String path)
      Deprecated.
      static int getBufferCount()
      Returns the number of open buffers.
      static BufferManager getBufferManager()
      Returns the buffer manager
      static Buffer[] getBuffers()
      Deprecated.
      static BufferSetManager getBufferSetManager()
      Returns the bufferSet manager.
      static java.lang.String getBuild()
      Returns the internal version.
      static ActionSet getBuiltInActionSet()
      Returns the set of commands built into jEdit.
      static java.awt.Color[][] getColorMatrixProperty​(java.lang.String name)
      Returns the value of a color matrix property.
      static java.awt.Color[][] getColorMatrixProperty​(java.lang.String name, java.awt.Color[][] def)
      Returns the value of a color matrix property.
      static java.awt.Color getColorProperty​(java.lang.String name)
      Returns the value of a color property.
      static java.awt.Color getColorProperty​(java.lang.String name, java.awt.Color def)
      Returns the value of a color property.
      static java.lang.String getCurrentLanguage()
      Returns the current language used by jEdit.
      static double getDoubleProperty​(java.lang.String name, double def)  
      static EditPaneManager getEditPaneManager()
      Returns the Edit Pane manger
      static EditServer getEditServer()
      Returns the edit server instance.
      static Buffer getFirstBuffer()
      Returns the first buffer.
      static View getFirstView()
      Returns the first view.
      static java.awt.Font getFontProperty​(java.lang.String name)
      Returns the value of a font property.
      static java.awt.Font getFontProperty​(java.lang.String name, java.awt.Font def)
      Returns the value of a font property.
      static InputHandler getInputHandler()
      Returns the current input handler (key binding to action mapping)
      static int getIntegerProperty​(java.lang.String name)
      Returns the value of an integer property.
      static int getIntegerProperty​(java.lang.String name, int def)
      Returns the value of an integer property.
      static java.lang.String getJARCacheDirectory()
      Returns the directory where plugin cache files are stored.
      static java.lang.String getJEditHome()
      Returns the jEdit install directory.
      static KeymapManager getKeymapManager()  
      static Buffer getLastBuffer()
      Returns the last buffer.
      static View getLastView()
      Returns the last view.
      static Mode getMode​(java.lang.String name)
      Returns the edit mode with the specified name.
      static Mode[] getModes()  
      static int getNextUntitledBufferId()  
      static java.lang.String[] getNotLoadedPluginJARs()
      Returns a list of plugin JARs pathnames that are not currently loaded by examining the user and system plugin directories.
      static EditPlugin getPlugin​(java.lang.String name)
      Returns the plugin with the specified class name.
      static EditPlugin getPlugin​(java.lang.String name, boolean loadIfNecessary)
      Returns the plugin with the specified class name.
      static PluginJAR getPluginJAR​(java.lang.String path)
      Returns the JAR with the specified path name.
      static PluginJAR[] getPluginJARs()
      Returns an array of installed plugins.
      static EditPlugin[] getPlugins()
      Returns an array of installed plugins.
      static java.util.Properties getProperties()
      Returns the properties object which contains all known jEdit properties.
      static java.lang.String getProperty​(java.lang.String name)
      Fetches a property, returning null if it's not defined.
      static java.lang.String getProperty​(java.lang.String name, java.lang.Object[] args)
      Returns the property with the specified name.
      static java.lang.String getProperty​(java.lang.String name, java.lang.String def)
      Fetches a property, returning the default value if it's not defined.
      static jEdit.JEditPropertyManager getPropertyManager()  
      static java.lang.String getRegisterStatusPrompt​(java.lang.String action)
      Returns the status prompt for the given register action.
      static java.lang.String getSettingsDirectory()
      Returns the path of the directory where user-specific settings are stored.
      static java.lang.String getVersion()
      Returns the jEdit version as a human-readable string.
      static int getViewCount()
      Returns the number of open views.
      static ViewManager getViewManager()
      Returns the view manager
      static View[] getViews()
      Deprecated.
      static boolean isBackgroundModeEnabled()
      Returns true if jEdit was started with the -background command-line switch.
      static boolean isMainThread()
      Returns true if the currently running thread is the main thread.
      static boolean isStartupDone()
      Whether jEdit startup is over.
      static void main​(java.lang.String[] args)
      The main method of the jEdit application.
      static void moveBuffer​(EditPane editPane, int oldPosition, int newPosition)
      Moves a buffer from a old position to a new position in the BufferSet used in an EditPane.
      static Buffer newFile​(EditPane editPane)
      Creates a new `untitled' file.
      static Buffer newFile​(EditPane editPane, java.lang.String dir)
      Creates a new `untitled' file.
      static Buffer newFile​(View view)
      Creates a new `untitled' file.
      static Buffer newFile​(View view, java.lang.String dir)
      Creates a new `untitled' file.
      static View newView​(View view)
      Creates a new view.
      static View newView​(View view, Buffer buffer)
      Creates a new view of a buffer.
      static View newView​(View view, Buffer buffer, boolean plainView)
      Creates a new view of a buffer.
      static View newView​(View view, Buffer buffer, View.ViewConfig config)
      Creates a new view.
      static Buffer openFile​(EditPane editPane, java.lang.String path)
      Opens a file.
      static Buffer openFile​(EditPane editPane, java.lang.String parent, java.lang.String path, boolean newFile, java.util.Hashtable<java.lang.String,​java.lang.Object> props)
      Opens a file.
      static Buffer openFile​(View view, java.lang.String path)
      Opens a file.
      static Buffer openFile​(View view, java.lang.String parent, java.lang.String path, boolean newFile, java.util.Hashtable<java.lang.String,​java.lang.Object> props)
      Opens a file.
      static Buffer openFileAfterStartup​(java.lang.String path)
      Opens a file, either immediately if the application is finished starting up, or after the first view has been created if not.
      static Buffer openFiles​(View view, java.lang.String parent, java.lang.String[] args)
      Opens the file names specified in the argument array.
      static Buffer openTemporary​(View view, java.lang.String parent, java.lang.String path, boolean newFile)
      Opens a temporary buffer.
      static Buffer openTemporary​(View view, java.lang.String parent, java.lang.String path, boolean newFile, boolean untitled)
      Opens a temporary buffer.
      static Buffer openTemporary​(View view, java.lang.String parent, java.lang.String path, boolean newFile, java.util.Hashtable<java.lang.String,​java.lang.Object> props)
      Opens a temporary buffer.
      static Buffer openTemporary​(View view, java.lang.String parent, java.lang.String path, boolean newFile, java.util.Hashtable<java.lang.String,​java.lang.Object> props, boolean untitled)
      Opens a temporary buffer.
      static void propertiesChanged()
      Reloads various settings from the properties.
      static void reloadAllBuffers​(View view, boolean confirm)
      Reloads all open buffers.
      static void reloadModes()
      Reloads all edit modes.
      static void relocateSettings()  
      static void removeActionSet​(ActionSet actionSet)
      Removes an action set from jEdit's list.
      static void removePluginJAR​(PluginJAR jar, boolean exit)
      Unloads the given plugin JAR with the specified path.
      static void resetProperty​(java.lang.String name)
      Resets a property to its default value.
      static void saveAllBuffers​(View view)
      Saves all open buffers.
      static void saveAllBuffers​(View view, boolean confirm)
      Saves all open buffers.
      static void saveSettings()
      Saves all user preferences to disk.
      static void setBooleanProperty​(java.lang.String name, boolean value)
      Sets a boolean property.
      static void setColorMatrixProperty​(java.lang.String name, java.awt.Color[][] value)
      Sets the value of a color matrix property.
      static void setColorProperty​(java.lang.String name, java.awt.Color value)
      Sets the value of a color property.
      static void setDoubleProperty​(java.lang.String name, double value)  
      static void setFontProperty​(java.lang.String name, java.awt.Font value)
      Sets the value of a font property.
      static void setIntegerProperty​(java.lang.String name, int value)
      Sets the value of an integer property.
      static void setProperty​(java.lang.String name, java.lang.String value)
      Sets a property to a new value.
      static void setTemporaryProperty​(java.lang.String name, java.lang.String value)
      Sets a property to a new value.
      static void showMemoryDialog​(View view)
      Performs garbage collection and displays a dialog box showing memory status.
      static void unsetProperty​(java.lang.String name)
      Unsets (clears) a property.
      static void visit​(JEditVisitor visitor)
      Visit the views, editpanes and textareas
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getVersion

        public static java.lang.String getVersion()
        Returns the jEdit version as a human-readable string.
      • getBuild

        public static java.lang.String getBuild()
        Returns the internal version. MiscUtilities.compareStrings() can be used to compare different internal versions.
      • main

        public static void main​(java.lang.String[] args)
        The main method of the jEdit application. This should never be invoked directly.
        Parameters:
        args - The command line arguments
      • getCurrentLanguage

        public static java.lang.String getCurrentLanguage()
        Returns the current language used by jEdit.
        Returns:
        the current language, never null
        Since:
        jEdit 5.0pre1
      • getProperties

        public static java.util.Properties getProperties()
        Returns the properties object which contains all known jEdit properties. Note that as of jEdit 4.2pre10, this returns a new collection, not the existing properties instance.
        Since:
        jEdit 3.1pre4
      • getProperty

        public static java.lang.String getProperty​(java.lang.String name)
        Fetches a property, returning null if it's not defined.
        Parameters:
        name - The property
      • getProperty

        public static java.lang.String getProperty​(java.lang.String name,
                                                   java.lang.String def)
        Fetches a property, returning the default value if it's not defined.
        Parameters:
        name - The property
        def - The default value
      • getProperty

        public static java.lang.String getProperty​(java.lang.String name,
                                                   java.lang.Object[] args)
        Returns the property with the specified name.

        The elements of the args array are substituted into the value of the property in place of strings of the form {n}, where n is an index in the array.

        You can find out more about this feature by reading the documentation for the format method of the java.text.MessageFormat class.

        Parameters:
        name - The property
        args - The positional parameters
      • getBooleanProperty

        public static boolean getBooleanProperty​(java.lang.String name)
        Returns the value of a boolean property.
        Parameters:
        name - The property
      • getBooleanProperty

        public static boolean getBooleanProperty​(java.lang.String name,
                                                 boolean def)
        Returns the value of a boolean property.
        Parameters:
        name - The property
        def - The default value
      • getIntegerProperty

        public static int getIntegerProperty​(java.lang.String name)
        Returns the value of an integer property.
        Parameters:
        name - The property
      • getIntegerProperty

        public static int getIntegerProperty​(java.lang.String name,
                                             int def)
        Returns the value of an integer property.
        Parameters:
        name - The property
        def - The default value
        Since:
        jEdit 4.0pre1
      • getDoubleProperty

        public static double getDoubleProperty​(java.lang.String name,
                                               double def)
      • getFontProperty

        public static java.awt.Font getFontProperty​(java.lang.String name)
        Returns the value of a font property. The family is stored in the name property, the font size is stored in the namesize property, and the font style is stored in namestyle. For example, if name is view.gutter.font, the properties will be named view.gutter.font, view.gutter.fontsize, and view.gutter.fontstyle.
        Parameters:
        name - The property
        Since:
        jEdit 4.0pre1
      • getFontProperty

        public static java.awt.Font getFontProperty​(java.lang.String name,
                                                    java.awt.Font def)
        Returns the value of a font property. The family is stored in the name property, the font size is stored in the namesize property, and the font style is stored in namestyle. For example, if name is view.gutter.font, the properties will be named view.gutter.font, view.gutter.fontsize, and view.gutter.fontstyle.
        Parameters:
        name - The property
        def - The default value
        Since:
        jEdit 4.0pre1
      • getColorProperty

        public static java.awt.Color getColorProperty​(java.lang.String name)
        Returns the value of a color property.
        Parameters:
        name - The property name
        Since:
        jEdit 4.0pre1
      • getColorProperty

        public static java.awt.Color getColorProperty​(java.lang.String name,
                                                      java.awt.Color def)
        Returns the value of a color property.
        Parameters:
        name - The property name
        def - The default value
        Since:
        jEdit 4.0pre1
      • setColorProperty

        public static void setColorProperty​(java.lang.String name,
                                            java.awt.Color value)
        Sets the value of a color property.
        Parameters:
        name - The property name
        value - The value
        Since:
        jEdit 4.0pre1
      • getColorMatrixProperty

        public static java.awt.Color[][] getColorMatrixProperty​(java.lang.String name)
        Returns the value of a color matrix property.
        Parameters:
        name - The property name
        Since:
        jEdit 5.6
      • getColorMatrixProperty

        public static java.awt.Color[][] getColorMatrixProperty​(java.lang.String name,
                                                                java.awt.Color[][] def)
        Returns the value of a color matrix property.
        Parameters:
        name - The property name
        def - The default value
        Since:
        jEdit 5.6
      • setColorMatrixProperty

        public static void setColorMatrixProperty​(java.lang.String name,
                                                  java.awt.Color[][] value)
        Sets the value of a color matrix property.
        Parameters:
        name - The property name
        value - The value
        Since:
        jEdit 5.6
      • setProperty

        public static void setProperty​(java.lang.String name,
                                       java.lang.String value)
        Sets a property to a new value.
        Parameters:
        name - The property
        value - The new value
      • setTemporaryProperty

        public static void setTemporaryProperty​(java.lang.String name,
                                                java.lang.String value)
        Sets a property to a new value. Properties set using this method are not saved to the user properties list.
        Parameters:
        name - The property
        value - The new value
        Since:
        jEdit 2.3final
      • setBooleanProperty

        public static void setBooleanProperty​(java.lang.String name,
                                              boolean value)
        Sets a boolean property.
        Parameters:
        name - The property
        value - The value
      • setIntegerProperty

        public static void setIntegerProperty​(java.lang.String name,
                                              int value)
        Sets the value of an integer property.
        Parameters:
        name - The property
        value - The value
        Since:
        jEdit 4.0pre1
      • setDoubleProperty

        public static void setDoubleProperty​(java.lang.String name,
                                             double value)
      • setFontProperty

        public static void setFontProperty​(java.lang.String name,
                                           java.awt.Font value)
        Sets the value of a font property. The family is stored in the name property, the font size is stored in the namesize property, and the font style is stored in namestyle. For example, if name is view.gutter.font, the properties will be named view.gutter.font, view.gutter.fontsize, and view.gutter.fontstyle.
        Parameters:
        name - The property
        value - The value
        Since:
        jEdit 4.0pre1
      • unsetProperty

        public static void unsetProperty​(java.lang.String name)
        Unsets (clears) a property.
        Parameters:
        name - The property
      • resetProperty

        public static void resetProperty​(java.lang.String name)
        Resets a property to its default value.
        Parameters:
        name - The property
        Since:
        jEdit 2.5pre3
      • propertiesChanged

        public static void propertiesChanged()
        Reloads various settings from the properties.
      • getNotLoadedPluginJARs

        public static java.lang.String[] getNotLoadedPluginJARs()
        Returns a list of plugin JARs pathnames that are not currently loaded by examining the user and system plugin directories.
        Since:
        jEdit 3.2pre1
      • getPlugin

        public static EditPlugin getPlugin​(java.lang.String name)
        Returns the plugin with the specified class name. Only works for plugins that were loaded.
      • getPlugin

        public static EditPlugin getPlugin​(java.lang.String name,
                                           boolean loadIfNecessary)
        Returns the plugin with the specified class name. If * loadIfNecessary is true, the plugin will be searched for, loaded, and activated in case it has not yet been loaded.
        Parameters:
        name - the classname of the main Plugin class.
        loadIfNecessary - - loads plugin + dependencies if it is not loaded yet.
        Since:
        jEdit 4.2pre4
      • getPlugins

        public static EditPlugin[] getPlugins()
        Returns an array of installed plugins.
      • getPluginJARs

        public static PluginJAR[] getPluginJARs()
        Returns an array of installed plugins.
        Since:
        jEdit 4.2pre1
      • getPluginJAR

        public static PluginJAR getPluginJAR​(java.lang.String path)
        Returns the JAR with the specified path name.
        Parameters:
        path - The path name
        Since:
        jEdit 4.2pre1
      • addPluginJAR

        public static void addPluginJAR​(java.lang.String path)
        Loads the plugin JAR with the specified path. Some notes about this method:
        • Calling this at a time other than jEdit startup can have unpredictable results if the plugin has not been updated for the jEdit 4.2 plugin API.
        • You must make sure yourself the plugin is not already loaded.
        • After loading, you just make sure all the plugin's dependencies are satisified before activating the plugin, using the PluginJAR.checkDependencies() method.
        Parameters:
        path - The JAR file path
        Since:
        jEdit 4.2pre1
      • removePluginJAR

        public static void removePluginJAR​(PluginJAR jar,
                                           boolean exit)
        Unloads the given plugin JAR with the specified path. Note that calling this at a time other than jEdit shutdown can have unpredictable results if the plugin has not been updated for the jEdit 4.2 plugin API.
        Parameters:
        jar - The PluginJAR instance
        exit - Set to true if jEdit is exiting; enables some shortcuts so the editor can close faster.
        Since:
        jEdit 4.2pre1
      • getActionContext

        public static ActionContext getActionContext()
        Returns the action context used to store editor actions.
        Since:
        jEdit 4.2pre1
      • addActionSet

        public static void addActionSet​(ActionSet actionSet)
        Adds a new action set to jEdit's list of ActionSets (viewable from the shortcuts option pane). By default, each plugin has one ActionSet, but some plugins may create dynamic action sets, such as ProjectViewer and Console. These plugins must call removeActionSet() when the plugin is unloaded.
        Since:
        jEdit 4.0pre1
        See Also:
        removeActionSet(ActionSet)
      • removeActionSet

        public static void removeActionSet​(ActionSet actionSet)
        Removes an action set from jEdit's list. Plugins that add a dynamic action set must call this method at plugin unload time.
        Since:
        jEdit 4.2pre1
      • getBuiltInActionSet

        public static ActionSet getBuiltInActionSet()
        Returns the set of commands built into jEdit.
        Since:
        jEdit 4.2pre1
      • getActionSets

        public static ActionSet[] getActionSets()
        Returns all registered action sets.
        Returns:
        the ActionSet(s)
        Since:
        jEdit 4.0pre1
      • getAction

        public static EditAction getAction​(java.lang.String name)
        Returns the specified action.
        Parameters:
        name - The action name
      • getActionSetForAction

        public static ActionSet getActionSetForAction​(java.lang.String action)
        Returns the action set that contains the specified action.
        Parameters:
        action - The action
        Since:
        jEdit 4.2pre1
      • getActionNames

        public static java.lang.String[] getActionNames()
        Returns all registered action names.
      • reloadModes

        public static void reloadModes()
        Reloads all edit modes. User defined edit modes are loaded after global modes so that user modes supercede global modes.
        Since:
        jEdit 3.2pre2
      • getMode

        public static Mode getMode​(java.lang.String name)
        Returns the edit mode with the specified name.
        Parameters:
        name - The edit mode
      • getModes

        public static Mode[] getModes()
        Returns:
        an array of installed edit modes that have been selected in the global options. The modes in this array will be sorted by mode name.
      • getAllModes

        public static Mode[] getAllModes()
        Returns an array of all installed edit modes. The modes in this array will be sorted by mode name.
      • openFiles

        public static Buffer openFiles​(View view,
                                       java.lang.String parent,
                                       java.lang.String[] args)
        Opens the file names specified in the argument array. This handles +line and +marker arguments just like the command line parser.
        Parameters:
        parent - The parent directory
        args - The file names to open
        Since:
        jEdit 3.2pre4
      • openFileAfterStartup

        public static Buffer openFileAfterStartup​(java.lang.String path)
        Opens a file, either immediately if the application is finished starting up, or after the first view has been created if not.
        Parameters:
        path - The file path
        Returns:
        the buffer if succesfully loaded immediately, or null otherwise
        Since:
        jEdit 4.5pre1
      • openFile

        public static Buffer openFile​(View view,
                                      java.lang.String path)
        Opens a file. Note that as of jEdit 2.5pre1, this may return null if the buffer could not be opened.
        Parameters:
        view - The view to open the file in
        path - The file path
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 2.4pre1
      • openFile

        public static Buffer openFile​(View view,
                                      java.lang.String parent,
                                      java.lang.String path,
                                      boolean newFile,
                                      java.util.Hashtable<java.lang.String,​java.lang.Object> props)
        Opens a file. This may return null if the buffer could not be opened for some reason.
        Parameters:
        view - The view to open the file in. If it is null, the file will be opened and added to the bufferSet of the current edit pane, but not selected
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk be prompted if it should be reloaded
        props - Buffer-local properties to set in the buffer
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 3.2pre10
      • openFile

        public static Buffer openFile​(EditPane editPane,
                                      java.lang.String path)
        Opens a file. Note that as of jEdit 2.5pre1, this may return null if the buffer could not be opened.
        Parameters:
        editPane - the EditPane to open the file in.
        path - The file path
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 4.3pre17
      • openFile

        public static Buffer openFile​(EditPane editPane,
                                      java.lang.String parent,
                                      java.lang.String path,
                                      boolean newFile,
                                      java.util.Hashtable<java.lang.String,​java.lang.Object> props)
        Opens a file. This may return null if the buffer could not be opened for some reason.
        Parameters:
        editPane - the EditPane to open the file in.
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk be prompted if it should be reloaded
        props - Buffer-local properties to set in the buffer
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 4.3pre17
      • openTemporary

        public static Buffer openTemporary​(View view,
                                           java.lang.String parent,
                                           java.lang.String path,
                                           boolean newFile)
        Opens a temporary buffer. A temporary buffer is like a normal buffer, except that an event is not fired and the buffer is not added to the buffers list.

        If a buffer for the given path was already opened in jEdit, then this instance is returned. Otherwise jEdit will not store a reference to the returned Buffer object.

        This method is thread-safe.

        Parameters:
        view - The view to open the file in
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 3.2pre10
      • openTemporary

        public static Buffer openTemporary​(View view,
                                           java.lang.String parent,
                                           java.lang.String path,
                                           boolean newFile,
                                           boolean untitled)
        Opens a temporary buffer. A temporary buffer is like a normal buffer, except that an event is not fired and the buffer is not added to the buffers list.

        If a buffer for the given path was already opened in jEdit, then this instance is returned. Otherwise jEdit will not store a reference to the returned Buffer object.

        This method is thread-safe.

        Parameters:
        view - The view to open the file in
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk
        untitled - is the buffer untitled
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 5.5pre1
      • openTemporary

        public static Buffer openTemporary​(View view,
                                           java.lang.String parent,
                                           java.lang.String path,
                                           boolean newFile,
                                           java.util.Hashtable<java.lang.String,​java.lang.Object> props)
        Opens a temporary buffer. Details: openTemporary(View, String, String, boolean)
        Parameters:
        view - The view to open the file in
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk
        props - Buffer-local properties to set in the buffer
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 4.3pre10
      • openTemporary

        public static Buffer openTemporary​(View view,
                                           java.lang.String parent,
                                           java.lang.String path,
                                           boolean newFile,
                                           java.util.Hashtable<java.lang.String,​java.lang.Object> props,
                                           boolean untitled)
        Opens a temporary buffer. Details: openTemporary(View, String, String, boolean)
        Parameters:
        view - The view to open the file in
        parent - The parent directory of the file
        path - The path name of the file
        newFile - True if the file should not be loaded from disk
        props - Buffer-local properties to set in the buffer
        untitled - is the buffer untitled
        Returns:
        the buffer, or null if jEdit was unable to load it
        Since:
        jEdit 4.3pre10
      • commitTemporary

        public static void commitTemporary​(Buffer buffer)
        Adds a temporary buffer to the buffer list. This must be done before allowing the user to interact with the buffer in any way.
        Parameters:
        buffer - The buffer
      • newFile

        public static Buffer newFile​(View view)
        Creates a new `untitled' file.
        Parameters:
        view - The view to create the file in
        Returns:
        the new buffer
      • newFile

        public static Buffer newFile​(View view,
                                     java.lang.String dir)
        Creates a new `untitled' file.
        Parameters:
        view - The view to create the file in
        dir - The directory to create the file in
        Returns:
        the new buffer
        Since:
        jEdit 3.1pre2
      • newFile

        public static Buffer newFile​(EditPane editPane)
        Creates a new `untitled' file.
        Parameters:
        editPane - The editPane to create the file in
        Returns:
        the new buffer
        Since:
        jEdit 4.3pre17
      • newFile

        public static Buffer newFile​(EditPane editPane,
                                     java.lang.String dir)
        Creates a new `untitled' file.
        Parameters:
        editPane - The editPane to create the file in
        dir - The directory to create the file in
        Returns:
        the new buffer
        Since:
        jEdit 4.3pre17
      • closeBuffer

        public static boolean closeBuffer​(View view,
                                          Buffer buffer)
        Closes a buffer. If there are unsaved changes, the user is prompted if they should be saved first.
        Parameters:
        view - The view
        buffer - The buffer
        Returns:
        True if the buffer was really closed, false otherwise
      • closeBuffer

        public static void closeBuffer​(EditPane editPane,
                                       Buffer buffer)
        Close a buffer. The buffer is first removed from the EditPane's bufferSet. If the buffer is not in any bufferSet after that, it is closed
        Parameters:
        editPane - the edit pane (it cannot be null)
        buffer - the buffer (it cannot be null)
        Since:
        jEdit 4.3pre15
      • _closeBuffer

        public static void _closeBuffer​(View view,
                                        Buffer buffer)
        Closes the buffer, even if it has unsaved changes.
        Parameters:
        view - The view, may be null
        buffer - The buffer
        Throws:
        java.lang.NullPointerException - if the buffer is null
        Since:
        jEdit 2.2pre1
      • _closeBuffer

        public static void _closeBuffer​(View view,
                                        Buffer buffer,
                                        boolean doNotSave)
        Closes the buffer, even if it has unsaved changes.
        Parameters:
        view - The view, may be null
        buffer - The buffer
        doNotSave - we do not want to keep the autosave file
        Throws:
        java.lang.NullPointerException - if the buffer is null
        Since:
        jEdit 2.2pre1
      • closeAllBuffers

        public static boolean closeAllBuffers​(View view)
        Closes all open buffers.
        Parameters:
        view - The view
        Returns:
        true if all buffers were closed, false otherwise
      • closeAllBuffers

        public static boolean closeAllBuffers​(View view,
                                              boolean isExiting)
        Closes all open buffers.
        Parameters:
        view - The view
        isExiting - This must be false unless this method is being called by the exit() method
        Returns:
        true if all buffers were closed, false otherwise
      • saveAllBuffers

        public static void saveAllBuffers​(View view)
        Saves all open buffers.
        Parameters:
        view - The view
        Since:
        jEdit 4.2pre1
      • saveAllBuffers

        public static void saveAllBuffers​(View view,
                                          boolean confirm)
        Saves all open buffers.
        Parameters:
        view - The view
        confirm - If true, a confirmation dialog will be shown first
        Since:
        jEdit 2.7pre2
      • reloadAllBuffers

        public static void reloadAllBuffers​(View view,
                                            boolean confirm)
        Reloads all open buffers.
        Parameters:
        view - The view
        confirm - If true, a confirmation dialog will be shown first if any buffers are dirty
        Since:
        jEdit 2.7pre2
      • getBuffers

        @Deprecated(since="5.6pre1")
        public static Buffer[] getBuffers()
        Deprecated.
        Returns an array of all open buffers from any View.
        Returns:
        an array of all open buffers
        See Also:
        View.getBuffers()
      • getBufferCount

        public static int getBufferCount()
        Returns the number of open buffers.
      • getFirstBuffer

        public static Buffer getFirstBuffer()
        Returns the first buffer.
      • getLastBuffer

        public static Buffer getLastBuffer()
        Returns the last buffer.
        Returns:
        the last buffer
      • moveBuffer

        public static void moveBuffer​(EditPane editPane,
                                      int oldPosition,
                                      int newPosition)
        Moves a buffer from a old position to a new position in the BufferSet used in an EditPane.
        Parameters:
        editPane - The EditPane in which a buffer is moved
        oldPosition - The position before the move
        newPosition - The position after the move
      • getBufferSetManager

        public static BufferSetManager getBufferSetManager()
        Returns the bufferSet manager.
        Returns:
        the bufferSetManager
        Since:
        jEdit 4.3pre15
      • getBufferManager

        public static BufferManager getBufferManager()
        Returns the buffer manager
        Returns:
        the buffer manager
        Since:
        jEdit 5.6pre1
      • getEditPaneManager

        public static EditPaneManager getEditPaneManager()
        Returns the Edit Pane manger
        Returns:
        the edit pane manager
        Since:
        jEdit 5.6pre1
      • getViewManager

        public static ViewManager getViewManager()
        Returns the view manager
        Returns:
        the view manager
        Since:
        jEdit 5.6pre1
      • getPropertyManager

        public static jEdit.JEditPropertyManager getPropertyManager()
        Returns:
        the propertyManager
        Since:
        jEdit 4.3pre15
      • checkBufferStatus

        public static void checkBufferStatus​(View view)
        Checks each buffer's status on disk and shows the dialog box informing the user that buffers changed on disk, if necessary.
        Parameters:
        view - The view
        Since:
        jEdit 4.2pre1
      • checkBufferStatus

        public static void checkBufferStatus​(View view,
                                             boolean currentBuffer)
        Checks buffer status on disk and shows the dialog box informing the user that buffers changed on disk, if necessary.
        Parameters:
        view - The view
        currentBuffer - indicates whether to check only the current buffer
        Since:
        jEdit 4.2pre1
      • getInputHandler

        public static InputHandler getInputHandler()
        Returns the current input handler (key binding to action mapping)
        See Also:
        InputHandler
      • newView

        public static View newView​(View view)
        Creates a new view.
        Parameters:
        view - An existing view
        Since:
        jEdit 3.2pre2
      • newView

        public static View newView​(View view,
                                   Buffer buffer)
        Creates a new view of a buffer.
        Parameters:
        view - An existing view
        buffer - The buffer
      • newView

        public static View newView​(View view,
                                   Buffer buffer,
                                   boolean plainView)
        Creates a new view of a buffer.
        Parameters:
        view - An existing view
        buffer - The buffer
        plainView - If true, the view will not have dockable windows or tool bars.
        Since:
        4.1pre2
      • newView

        public static View newView​(View view,
                                   Buffer buffer,
                                   View.ViewConfig config)
        Creates a new view.
        Parameters:
        view - An existing view
        buffer - A buffer to display, or null
        config - Encapsulates the view geometry, split configuration and if the view is a plain view
        Since:
        jEdit 4.2pre1
      • closeView

        public static void closeView​(View view)
        Closes a view. jEdit will exit if this was the last open view.
      • getViews

        @Deprecated(since="5.6pre1")
        public static View[] getViews()
        Deprecated.
        Returns an array of all open views.
      • getViewCount

        public static int getViewCount()
        Returns the number of open views.
      • getFirstView

        public static View getFirstView()
        Returns the first view.
      • getLastView

        public static View getLastView()
        Returns the last view.
      • getActiveView

        public static View getActiveView()
        Returns the currently focused view.
        Since:
        jEdit 4.1pre1
      • relocateSettings

        public static void relocateSettings()
      • isStartupDone

        public static boolean isStartupDone()
        Whether jEdit startup is over.
        Since:
        jEdit 4.3pre17
      • isMainThread

        public static boolean isMainThread()
        Returns true if the currently running thread is the main thread.
        Since:
        jEdit 4.2pre1
      • isBackgroundModeEnabled

        public static boolean isBackgroundModeEnabled()
        Returns true if jEdit was started with the -background command-line switch.
        Since:
        jEdit 4.0pre4
      • showMemoryDialog

        public static void showMemoryDialog​(View view)
        Performs garbage collection and displays a dialog box showing memory status.
        Parameters:
        view - The view
        Since:
        jEdit 4.0pre1
      • getJEditHome

        public static java.lang.String getJEditHome()
        Returns the jEdit install directory.
      • getSettingsDirectory

        public static java.lang.String getSettingsDirectory()
        Returns the path of the directory where user-specific settings are stored. This will be null if jEdit was started with the -nosettings command-line switch; do not blindly use this method without checking for a null return value first.

        NOTE: plugins should not use this directory as a base to store their files. Instead, they should use EditPlugin.getPluginHome().

        See Also:
        EditPlugin.getPluginHome()
      • getJARCacheDirectory

        public static java.lang.String getJARCacheDirectory()
        Returns the directory where plugin cache files are stored.
        Since:
        jEdit 4.2pre1
      • backupSettingsFile

        public static void backupSettingsFile​(java.io.File file)
        Backs up the specified file in the settings directory. You should call this on any settings files your plugin writes.
        Parameters:
        file - The file
        Since:
        jEdit 4.0pre1
      • saveSettings

        public static void saveSettings()
        Saves all user preferences to disk.
      • exit

        public static void exit​(View view,
                                boolean reallyExit)
        Exits cleanly from jEdit, prompting the user if any unsaved files should be saved first.
        Parameters:
        view - The view from which this exit was called
        reallyExit - If background mode is enabled and this parameter is true, then jEdit will close all open views instead of exiting entirely.
      • getEditServer

        public static EditServer getEditServer()
        Returns the edit server instance. You can use this to find out the port number jEdit is listening on.
        Since:
        jEdit 4.2pre10
      • getRegisterStatusPrompt

        public static java.lang.String getRegisterStatusPrompt​(java.lang.String action)
        Returns the status prompt for the given register action. Only intended to be called from actions.xml.
        Since:
        jEdit 4.3pre16
      • getKeymapManager

        public static KeymapManager getKeymapManager()
      • getActiveViewInternal

        @Nullable
        public static View getActiveViewInternal()
        Returns the internal active view, which might be null.
        Since:
        4.3pre10
      • getNextUntitledBufferId

        public static int getNextUntitledBufferId()