This is the main class of the application. All the methods in this class are static methods, so they are called with the following syntax, from both macros and plugins:
jEdit.method(parameters) |
Here are a few key methods:
public static Buffer openFile( | View | view, |
String | path) ; |
Opens the file named path in the given View. To open a file in the current view, use the predefined variable view for the first parameter.
public static Buffer newFile(
View view)
;
This creates a new buffer captioned Untitled-<n>in the given View.
public static boolean closeBuffer( | View | view, |
Buffer | buffer) ; |
Closes the buffer named buffer in the view named view. The user will be prompted to save the buffer before closing if there are unsaved changes.
public static void saveAllBuffers( | View | view, |
boolean | confirm) ; |
This saves all open buffers with unsaved changes in the given View. The parameter confirm determines whether jEdit initially asks for confirmation of the save operation.
public static boolean closeAllBuffers( | View | view) ; |
Closes all buffers in the given View. A dialog window will be displayed for any buffers with unsaved changes to obtain user instructions.
public static void exit( | View | view, |
boolean | reallyExit) ; |
This method causes jEdit to exit. If reallyExit is false and jEdit is running in background mode, the application will simply close all buffers and views and remain in background mode.
public static String getProperty( | String | name) ; |
Returns the value of the property named by name, or null if the property is undefined.
public static void setProperty( | String | name, |
String | property) ; |
Sets the property named by name with the value property. An existing property is overwritten.
public static boolean getBooleanProperty( | String | name) ; |
Returns a boolean value of true or false for the property named by name by examining the contents of the property; returns false if the property cannot be found.
public static void setBooleanProperty( | String | name, |
boolean | value) ; |
Sets the property named by name to value. The boolean value is stored internally as the string "true" or "false".
public static int getIntegerProperty( | String | name, |
int | defaultValue) ; |
Returns the integer value of the property named by name. If the property value is not a valid numeric string, returns defaultValue instead.
public static void setIntegerProperty( | String | name, |
int | value) ; |
Sets the property named by name to value.
public static Color getColorProperty( | String | name) ; |
Returns the value of the specified property as a java.awt.Color instance, or null if the color value cannot be parsed.
public static void setColorProperty( | String | name, |
Color | value) ; |
Sets the property named by name to the textual representation of the color instance named by value.
public static Font getFontProperty( | String | name) ; |
Returns the value of the specified property as a java.awt.Font instance, or null if the font specification cannot be parsed.
public static void setFontProperty( | String | name, |
Font | value) ; |
Sets the property named by name to the textual representation of the font instance stored in value.
public static void setTemporaryProperty( | String | name, |
String | property) ; |
This sets a property that will be stored during the current jEdit session only. This method is useful for storing a value obtained by one macro for use by another macro, because it does not clutter up the user properties file on disk.
public static String getJEditHome(
void)
;
Returns the path of the directory containing the jEdit executable file.
public static String getSettingsDirectory( | void) ; |
Returns the path of the directory in which user-specific settings are stored. This will be null if jEdit was started with the -nosettings command-line switch; so do not blindly use this method without checking for a null return value first.
The jEdit object also maintains a number of collections which are useful in some situations. They include the following:
public static EditAction[] getActions(
void)
;
Returns an array of "actions" or short routines maintained and used by the editor.
public static EditAction getAction( | String | action) ; |
Returns the action named action, or null if it does not exist.
public static Properties getProperties(
void)
;
Returns a Java Properties object (a class derived from Hashtable) holding all properties currently used by the program. The constituent properties fall into three categories: application properties, "site" properties, and "user" properties. Site properties take precedence over application properties with the same "key" or name, and user properties take precedence over both application and site properties. User settings are written to a file named properties in the user settings directory upon program exit or whenever jEdit.saveSettings() is called.
public static Buffer[] getBuffers(
void)
;
Returns an array of open buffers.
public static int getBufferCount(
void)
;
Returns the number of open buffers.
public static Buffer getBuffer( | String | path) ; |
Returns the Buffer object containing the file named path. or null if the buffer does not exist.
public static Mode[] getModes(
void)
;
Returns an array containing all editing modes used by jEdit.
public static Mode getMode(
String name)
;
Returns the editing mode named by name, or null if such a mode does not exist.
public static EditPlugin[] getPlugins(
void)
;
Returns an array containing all loaded plugins.
plugin static EditPlugin getPlugin( | String | name) ; |
Returns the plugin named by name, or null if such a plugin does not exist.