public class jEdit
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
jEdit.JEditPropertyManager |
Modifier and Type | Method and 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)
Returns the buffer with the specified path name.
|
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)
Returns the buffer with the specified path name.
|
static int |
getBufferCount()
Returns the number of open buffers.
|
static Buffer[] |
getBuffers()
Returns an array of all open buffers from any View.
|
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 |
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 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 View[] |
getViews()
Returns an array of all open views.
|
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 |
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
|
public static java.lang.String getVersion()
public static java.lang.String getBuild()
public static void main(java.lang.String[] args)
args
- The command line argumentspublic static java.lang.String getCurrentLanguage()
public static java.util.Properties getProperties()
public static java.lang.String getProperty(java.lang.String name)
name
- The propertypublic static java.lang.String getProperty(java.lang.String name, java.lang.String def)
name
- The propertydef
- The default valuepublic static java.lang.String getProperty(java.lang.String name, java.lang.Object[] args)
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.
name
- The propertyargs
- The positional parameterspublic static boolean getBooleanProperty(java.lang.String name)
name
- The propertypublic static boolean getBooleanProperty(java.lang.String name, boolean def)
name
- The propertydef
- The default valuepublic static int getIntegerProperty(java.lang.String name)
name
- The propertypublic static int getIntegerProperty(java.lang.String name, int def)
name
- The propertydef
- The default valuepublic static double getDoubleProperty(java.lang.String name, double def)
public static java.awt.Font getFontProperty(java.lang.String name)
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
.name
- The propertypublic static java.awt.Font getFontProperty(java.lang.String name, java.awt.Font def)
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
.name
- The propertydef
- The default valuepublic static java.awt.Color getColorProperty(java.lang.String name)
name
- The property namepublic static java.awt.Color getColorProperty(java.lang.String name, java.awt.Color def)
name
- The property namedef
- The default valuepublic static void setColorProperty(java.lang.String name, java.awt.Color value)
name
- The property namevalue
- The valuepublic static void setProperty(java.lang.String name, java.lang.String value)
name
- The propertyvalue
- The new valuepublic static void setTemporaryProperty(java.lang.String name, java.lang.String value)
name
- The propertyvalue
- The new valuepublic static void setBooleanProperty(java.lang.String name, boolean value)
name
- The propertyvalue
- The valuepublic static void setIntegerProperty(java.lang.String name, int value)
name
- The propertyvalue
- The valuepublic static void setDoubleProperty(java.lang.String name, double value)
public static void setFontProperty(java.lang.String name, java.awt.Font value)
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
.name
- The propertyvalue
- The valuepublic static void unsetProperty(java.lang.String name)
name
- The propertypublic static void resetProperty(java.lang.String name)
name
- The propertypublic static void propertiesChanged()
public static java.lang.String[] getNotLoadedPluginJARs()
public static EditPlugin getPlugin(java.lang.String name)
public static EditPlugin getPlugin(java.lang.String name, boolean loadIfNecessary)
loadIfNecessary
is true, the plugin will be searched for,
loaded, and activated in case it has not yet been loaded.name
- the classname of the main Plugin class.loadIfNecessary
- - loads plugin + dependencies if it is not loaded yet.public static EditPlugin[] getPlugins()
public static PluginJAR[] getPluginJARs()
public static PluginJAR getPluginJAR(java.lang.String path)
path
- The path namepublic static void addPluginJAR(java.lang.String path)
PluginJAR.checkDependencies()
method.
path
- The JAR file pathpublic static void removePluginJAR(PluginJAR jar, boolean exit)
jar
- The PluginJAR
instanceexit
- Set to true if jEdit is exiting; enables some
shortcuts so the editor can close faster.public static ActionContext getActionContext()
public static void addActionSet(ActionSet actionSet)
removeActionSet(ActionSet)
public static void removeActionSet(ActionSet actionSet)
public static ActionSet getBuiltInActionSet()
public static ActionSet[] getActionSets()
public static EditAction getAction(java.lang.String name)
name
- The action namepublic static ActionSet getActionSetForAction(java.lang.String action)
action
- The actionpublic static java.lang.String[] getActionNames()
public static void reloadModes()
public static Mode getMode(java.lang.String name)
name
- The edit modepublic static Mode[] getModes()
public static Mode[] getAllModes()
public static Buffer openFiles(View view, java.lang.String parent, java.lang.String[] args)
parent
- The parent directoryargs
- The file names to openpublic static Buffer openFileAfterStartup(java.lang.String path)
path
- The file pathpublic static Buffer openFile(View view, java.lang.String path)
view
- The view to open the file inpath
- The file pathpublic 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)
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 bufferpublic static Buffer openFile(EditPane editPane, java.lang.String path)
editPane
- the EditPane to open the file in.path
- The file pathpublic 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)
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 bufferpublic static Buffer openTemporary(View view, java.lang.String parent, java.lang.String path, boolean newFile)
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.
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 diskpublic static Buffer openTemporary(View view, java.lang.String parent, java.lang.String path, boolean newFile, boolean untitled)
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.
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 untitledpublic 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)
openTemporary(View, String, String, boolean)
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 bufferpublic 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)
openTemporary(View, String, String, boolean)
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 untitledpublic static void commitTemporary(Buffer buffer)
buffer
- The bufferpublic static Buffer newFile(View view)
view
- The view to create the file inpublic static Buffer newFile(View view, java.lang.String dir)
view
- The view to create the file indir
- The directory to create the file inpublic static Buffer newFile(EditPane editPane)
editPane
- The editPane to create the file inpublic static Buffer newFile(EditPane editPane, java.lang.String dir)
editPane
- The editPane to create the file indir
- The directory to create the file inpublic static boolean closeBuffer(View view, Buffer buffer)
view
- The viewbuffer
- The bufferpublic static void closeBuffer(EditPane editPane, Buffer buffer)
editPane
- the edit pane (it cannot be null)buffer
- the buffer (it cannot be null)public static void _closeBuffer(View view, Buffer buffer)
view
- The view, may be nullbuffer
- The bufferjava.lang.NullPointerException
- if the buffer is nullpublic static void _closeBuffer(View view, Buffer buffer, boolean doNotSave)
view
- The view, may be nullbuffer
- The bufferdoNotSave
- we do not want to keep the autosave filejava.lang.NullPointerException
- if the buffer is nullpublic static boolean closeAllBuffers(View view)
view
- The viewpublic static boolean closeAllBuffers(View view, boolean isExiting)
view
- The viewisExiting
- This must be false unless this method is
being called by the exit() methodpublic static void saveAllBuffers(View view)
view
- The viewpublic static void saveAllBuffers(View view, boolean confirm)
view
- The viewconfirm
- If true, a confirmation dialog will be shown firstpublic static void reloadAllBuffers(View view, boolean confirm)
view
- The viewconfirm
- If true, a confirmation dialog will be shown first
if any buffers are dirtypublic static Buffer _getBuffer(java.lang.String path)
path
- The path nameMiscUtilities.constructPath(String,String)
,
MiscUtilities.resolveSymlinks(String)
,
getBuffer(String)
public static Buffer getBuffer(java.lang.String path)
_getBuffer(String)
instead.path
- The path nameMiscUtilities.constructPath(String,String)
,
MiscUtilities.resolveSymlinks(String)
public static Buffer[] getBuffers()
View.getBuffers()
public static int getBufferCount()
public static Buffer getFirstBuffer()
public static Buffer getLastBuffer()
public static void moveBuffer(EditPane editPane, int oldPosition, int newPosition)
editPane
- The EditPane in which a buffer is movedoldPosition
- The position before the movenewPosition
- The position after the movepublic static BufferSetManager getBufferSetManager()
public static jEdit.JEditPropertyManager getPropertyManager()
public static void checkBufferStatus(View view)
view
- The viewpublic static void checkBufferStatus(View view, boolean currentBuffer)
view
- The viewcurrentBuffer
- indicates whether to check only the current bufferpublic static InputHandler getInputHandler()
InputHandler
public static View newView(View view)
view
- An existing viewpublic static View newView(View view, Buffer buffer)
view
- An existing viewbuffer
- The bufferpublic static View newView(View view, Buffer buffer, boolean plainView)
view
- An existing viewbuffer
- The bufferplainView
- If true, the view will not have dockable windows or
tool bars.public static View newView(View view, Buffer buffer, View.ViewConfig config)
view
- An existing viewbuffer
- A buffer to display, or nullconfig
- Encapsulates the view geometry, split configuration
and if the view is a plain viewpublic static void closeView(View view)
public static View[] getViews()
public static int getViewCount()
public static View getFirstView()
public static View getLastView()
public static View getActiveView()
public static void relocateSettings()
public static boolean isStartupDone()
public static boolean isMainThread()
public static boolean isBackgroundModeEnabled()
-background
command-line switch.public static void showMemoryDialog(View view)
view
- The viewpublic static java.lang.String getJEditHome()
public static java.lang.String getSettingsDirectory()
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().
EditPlugin.getPluginHome()
public static java.lang.String getJARCacheDirectory()
public static void backupSettingsFile(java.io.File file)
file
- The filepublic static void saveSettings()
public static void exit(View view, boolean reallyExit)
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.public static EditServer getEditServer()
public static void visit(JEditVisitor visitor)
visitor
- the visitorpublic static java.lang.String getRegisterStatusPrompt(java.lang.String action)
actions.xml
.public static KeymapManager getKeymapManager()
public static View getActiveViewInternal()
public static int getNextUntitledBufferId()