Class jEdit
- java.lang.Object
-
- org.gjt.sp.jedit.jEdit
-
public class jEdit extends java.lang.ObjectThe main class of the jEdit text editor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classjEdit.JEditPropertyManager
-
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 voidaddActionSet(ActionSet actionSet)Adds a new action set to jEdit's list of ActionSets (viewable from the shortcuts option pane).static voidaddPluginJAR(java.lang.String path)Loads the plugin JAR with the specified path.static voidbackupSettingsFile(java.io.File file)Backs up the specified file in the settings directory.static voidcheckBufferStatus(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 voidcheckBufferStatus(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 booleancloseAllBuffers(View view)Closes all open buffers.static booleancloseAllBuffers(View view, boolean isExiting)Closes all open buffers.static voidcloseBuffer(EditPane editPane, Buffer buffer)Close a buffer.static booleancloseBuffer(View view, Buffer buffer)Closes a buffer.static voidcloseView(View view)Closes a view.static voidcommitTemporary(Buffer buffer)Adds a temporary buffer to the buffer list.static voidexit(View view, boolean reallyExit)Exits cleanly from jEdit, prompting the user if any unsaved files should be saved first.static EditActiongetAction(java.lang.String name)Returns the specified action.static ActionContextgetActionContext()Returns the action context used to store editor actions.static java.lang.String[]getActionNames()Returns all registered action names.static ActionSetgetActionSetForAction(java.lang.String action)Returns the action set that contains the specified action.static ActionSet[]getActionSets()Returns all registered action sets.static ViewgetActiveView()Returns the currently focused view.static ViewgetActiveViewInternal()Returns the internal active view, which might be null.static Mode[]getAllModes()Returns an array of all installed edit modes.static booleangetBooleanProperty(java.lang.String name)Returns the value of a boolean property.static booleangetBooleanProperty(java.lang.String name, boolean def)Returns the value of a boolean property.static BuffergetBuffer(java.lang.String path)Deprecated.static intgetBufferCount()Returns the number of open buffers.static BufferManagergetBufferManager()Returns the buffer managerstatic Buffer[]getBuffers()Deprecated.static BufferSetManagergetBufferSetManager()Returns the bufferSet manager.static java.lang.StringgetBuild()Returns the internal version.static ActionSetgetBuiltInActionSet()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.ColorgetColorProperty(java.lang.String name)Returns the value of a color property.static java.awt.ColorgetColorProperty(java.lang.String name, java.awt.Color def)Returns the value of a color property.static java.lang.StringgetCurrentLanguage()Returns the current language used by jEdit.static doublegetDoubleProperty(java.lang.String name, double def)static EditPaneManagergetEditPaneManager()Returns the Edit Pane mangerstatic EditServergetEditServer()Returns the edit server instance.static BuffergetFirstBuffer()Returns the first buffer.static ViewgetFirstView()Returns the first view.static java.awt.FontgetFontProperty(java.lang.String name)Returns the value of a font property.static java.awt.FontgetFontProperty(java.lang.String name, java.awt.Font def)Returns the value of a font property.static InputHandlergetInputHandler()Returns the current input handler (key binding to action mapping)static intgetIntegerProperty(java.lang.String name)Returns the value of an integer property.static intgetIntegerProperty(java.lang.String name, int def)Returns the value of an integer property.static java.lang.StringgetJARCacheDirectory()Returns the directory where plugin cache files are stored.static java.lang.StringgetJEditHome()Returns the jEdit install directory.static KeymapManagergetKeymapManager()static BuffergetLastBuffer()Returns the last buffer.static ViewgetLastView()Returns the last view.static ModegetMode(java.lang.String name)Returns the edit mode with the specified name.static Mode[]getModes()static intgetNextUntitledBufferId()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 EditPlugingetPlugin(java.lang.String name)Returns the plugin with the specified class name.static EditPlugingetPlugin(java.lang.String name, boolean loadIfNecessary)Returns the plugin with the specified class name.static PluginJARgetPluginJAR(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.PropertiesgetProperties()Returns the properties object which contains all known jEdit properties.static java.lang.StringgetProperty(java.lang.String name)Fetches a property, returning null if it's not defined.static java.lang.StringgetProperty(java.lang.String name, java.lang.Object[] args)Returns the property with the specified name.static java.lang.StringgetProperty(java.lang.String name, java.lang.String def)Fetches a property, returning the default value if it's not defined.static jEdit.JEditPropertyManagergetPropertyManager()static java.lang.StringgetRegisterStatusPrompt(java.lang.String action)Returns the status prompt for the given register action.static java.lang.StringgetSettingsDirectory()Returns the path of the directory where user-specific settings are stored.static java.lang.StringgetVersion()Returns the jEdit version as a human-readable string.static intgetViewCount()Returns the number of open views.static ViewManagergetViewManager()Returns the view managerstatic View[]getViews()Deprecated.static booleanisBackgroundModeEnabled()Returns true if jEdit was started with the-backgroundcommand-line switch.static booleanisMainThread()Returns true if the currently running thread is the main thread.static booleanisStartupDone()Whether jEdit startup is over.static voidmain(java.lang.String[] args)The main method of the jEdit application.static voidmoveBuffer(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 BuffernewFile(EditPane editPane)Creates a new `untitled' file.static BuffernewFile(EditPane editPane, java.lang.String dir)Creates a new `untitled' file.static BuffernewFile(View view)Creates a new `untitled' file.static BuffernewFile(View view, java.lang.String dir)Creates a new `untitled' file.static ViewnewView(View view)Creates a new view.static ViewnewView(View view, Buffer buffer)Creates a new view of a buffer.static ViewnewView(View view, Buffer buffer, boolean plainView)Creates a new view of a buffer.static ViewnewView(View view, Buffer buffer, View.ViewConfig config)Creates a new view.static BufferopenFile(EditPane editPane, java.lang.String path)Opens a file.static BufferopenFile(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 BufferopenFile(View view, java.lang.String path)Opens a file.static BufferopenFile(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 BufferopenFileAfterStartup(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 BufferopenFiles(View view, java.lang.String parent, java.lang.String[] args)Opens the file names specified in the argument array.static BufferopenTemporary(View view, java.lang.String parent, java.lang.String path, boolean newFile)Opens a temporary buffer.static BufferopenTemporary(View view, java.lang.String parent, java.lang.String path, boolean newFile, boolean untitled)Opens a temporary buffer.static BufferopenTemporary(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 BufferopenTemporary(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 voidpropertiesChanged()Reloads various settings from the properties.static voidreloadAllBuffers(View view, boolean confirm)Reloads all open buffers.static voidreloadModes()Reloads all edit modes.static voidrelocateSettings()static voidremoveActionSet(ActionSet actionSet)Removes an action set from jEdit's list.static voidremovePluginJAR(PluginJAR jar, boolean exit)Unloads the given plugin JAR with the specified path.static voidresetProperty(java.lang.String name)Resets a property to its default value.static voidsaveAllBuffers(View view)Saves all open buffers.static voidsaveAllBuffers(View view, boolean confirm)Saves all open buffers.static voidsaveSettings()Saves all user preferences to disk.static voidsetBooleanProperty(java.lang.String name, boolean value)Sets a boolean property.static voidsetColorMatrixProperty(java.lang.String name, java.awt.Color[][] value)Sets the value of a color matrix property.static voidsetColorProperty(java.lang.String name, java.awt.Color value)Sets the value of a color property.static voidsetDoubleProperty(java.lang.String name, double value)static voidsetFontProperty(java.lang.String name, java.awt.Font value)Sets the value of a font property.static voidsetIntegerProperty(java.lang.String name, int value)Sets the value of an integer property.static voidsetProperty(java.lang.String name, java.lang.String value)Sets a property to a new value.static voidsetTemporaryProperty(java.lang.String name, java.lang.String value)Sets a property to a new value.static voidshowMemoryDialog(View view)Performs garbage collection and displays a dialog box showing memory status.static voidunsetProperty(java.lang.String name)Unsets (clears) a property.static voidvisit(JEditVisitor visitor)Visit the views, editpanes and textareas
-
-
-
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 propertydef- 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
argsarray are substituted into the value of the property in place of strings of the form{n}, wherenis an index in the array.You can find out more about this feature by reading the documentation for the
formatmethod of thejava.text.MessageFormatclass.- Parameters:
name- The propertyargs- 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 propertydef- 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 propertydef- 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 thenameproperty, the font size is stored in thenamesizeproperty, and the font style is stored innamestyle. For example, ifnameisview.gutter.font, the properties will be namedview.gutter.font,view.gutter.fontsize, andview.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 thenameproperty, the font size is stored in thenamesizeproperty, and the font style is stored innamestyle. For example, ifnameisview.gutter.font, the properties will be namedview.gutter.font,view.gutter.fontsize, andview.gutter.fontstyle.- Parameters:
name- The propertydef- 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 namedef- 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 namevalue- 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 namedef- 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 namevalue- 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 propertyvalue- 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 propertyvalue- 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 propertyvalue- The value
-
setIntegerProperty
public static void setIntegerProperty(java.lang.String name, int value)Sets the value of an integer property.- Parameters:
name- The propertyvalue- 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 thenameproperty, the font size is stored in thenamesizeproperty, and the font style is stored innamestyle. For example, ifnameisview.gutter.font, the properties will be namedview.gutter.font,view.gutter.fontsize, andview.gutter.fontstyle.- Parameters:
name- The propertyvalue- 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 *loadIfNecessaryis 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- ThePluginJARinstanceexit- 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 directoryargs- 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 inpath- 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 selectedparent- The parent directory of the filepath- The path name of the filenewFile- True if the file should not be loaded from disk be prompted if it should be reloadedprops- 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 filepath- The path name of the filenewFile- True if the file should not be loaded from disk be prompted if it should be reloadedprops- 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
pathwas 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 inparent- The parent directory of the filepath- The path name of the filenewFile- 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
pathwas 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 inparent- The parent directory of the filepath- The path name of the filenewFile- True if the file should not be loaded from diskuntitled- 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 inparent- The parent directory of the filepath- The path name of the filenewFile- True if the file should not be loaded from diskprops- 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 inparent- The parent directory of the filepath- The path name of the filenewFile- True if the file should not be loaded from diskprops- Buffer-local properties to set in the bufferuntitled- 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 indir- 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 indir- 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 viewbuffer- 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 nullbuffer- 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 nullbuffer- The bufferdoNotSave- 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 viewisExiting- 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 viewconfirm- 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 viewconfirm- If true, a confirmation dialog will be shown first if any buffers are dirty- Since:
- jEdit 2.7pre2
-
_getBuffer
@Deprecated(since="5.6pre1") public static Buffer _getBuffer(java.lang.String path)
Deprecated.Returns the buffer with the specified path name. The path name must be an absolute, canonical, path.- Parameters:
path- The path name- Returns:
- the searched buffer, or null if it is not already open
- Since:
- jEdit 4.2pre7
- See Also:
MiscUtilities.constructPath(String,String),MiscUtilities.resolveSymlinks(String),BufferManager.getBuffer(String)
-
getBuffer
@Deprecated(since="5.6pre1") public static Buffer getBuffer(java.lang.String path)
Deprecated.Returns the buffer with the specified path name. The path name must be an absolute path. This method automatically resolves symbolic links. If performance is critical, cache the canonical path and callBufferManager.getBuffer(String)instead.- Parameters:
path- The path name- Returns:
- the searched buffer, or null if it is not already open
- See Also:
MiscUtilities.constructPath(String,String),MiscUtilities.resolveSymlinks(String)
-
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 movedoldPosition- The position before the movenewPosition- 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 viewcurrentBuffer- 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 viewbuffer- The buffer
-
newView
public static View newView(View view, Buffer buffer, boolean plainView)
Creates a new view of a buffer.- Parameters:
view- An existing viewbuffer- The bufferplainView- 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 viewbuffer- A buffer to display, or nullconfig- 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-backgroundcommand-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 benullif jEdit was started with the-nosettingscommand-line switch; do not blindly use this method without checking for anullreturn 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 calledreallyExit- 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
-
visit
public static void visit(JEditVisitor visitor)
Visit the views, editpanes and textareas- Parameters:
visitor- the visitor- Since:
- jEdit 4.3pre13
- See Also:
ViewManager.forEach(Consumer),BufferManager.forEach(Consumer)
-
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 fromactions.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()
-
-