org.jext
Class Jext

java.lang.Object
  extended byorg.jext.Jext

public class Jext
extends java.lang.Object

Jext is a fully featured, 100% Pure Java, text editor. It has been mainly designed for programmers, and provides also very useful functions for them (syntax colorization, auto indentation...).

Version:
3.2
Author:
Romain Guy

Field Summary
static java.lang.String BUILD
          Last Jext's build date.
static boolean DEBUG
          Debug mode(not final to avoid it being included in other .class files)
static boolean DELETE_OLD_SETTINGS
          If true, Jext will delete user settings if this release is newer
static java.lang.String JEXT_HOME
          Jext home directory.
static int JEXT_SERVER_PORT
          Jext server base port number.
static java.util.ArrayList modes
           
static java.util.ArrayList modesFileFilters
           
static java.lang.String[] NEW_LINE
          Available new lines characters
static java.lang.String RELEASE
          Current Jext's release.
static java.lang.String SETTINGS_DIRECTORY
          Settings directory.
static java.lang.String usrProps
           
 
Constructor Summary
Jext()
           
 
Method Summary
static void addAction(MenuAction action)
          Add an action listener to the list.
static void addMode(Mode mode)
          Adds a mode to Jext's syntax colorizing modes list
static void addPlugin(Plugin plugin)
          Registers a plugin with the editor.
static void addPythonAction(java.lang.String name, java.lang.String script, boolean editAction)
          Add a python action listener to the list.
static void assocPluginsToModes()
          Makes each mode know what plugins to start when it is selected.
static void closeToQuit(JextFrame frame)
          Close a JextFrame by calling JextFrame.closeToQuit() and if it it the last window and we are not keeping the server open we close Jext completely.
static void closeWindow(JextFrame frame)
           
static void executeScripts(JextFrame parent)
          Execute scripts found in user home directory.
static void exit()
          Exits Jext by closing all the windows.
static MenuAction getAction(java.lang.String action)
          Returns a named action.
static boolean getBooleanProperty(java.lang.String name)
          Returns true if the property value equals to "on" or "true"
static boolean getBooleanProperty(java.lang.String name, java.lang.String def)
          Returns true if the property value equals to "on" or "true"
static boolean getButtonsHighlight()
          Returns true if highlight buttons should not be highlighted on mouse over.
static boolean getFlatMenus()
          Returns true if menu should be flatened.
static java.lang.String getHomeDirectory()
          Jext startup directory is saved during execution.
static DefaultInputHandler getInputHandler()
          Returns the input handler.
static java.util.ArrayList getInstances()
          Some external classes may need to notify each instance of Jext.
static java.lang.String getLanguage()
          Returns current selected language.
static java.io.InputStream getLanguageStream(java.io.InputStream in, java.lang.String fileName)
          Returns an input stream corresponding to selected language.
static Mode getMode(java.lang.String modeName)
          Returns the mode according to its name.
static java.util.ArrayList getModes()
          Returns modes list.
static java.awt.Toolkit getMyToolkit()
          Many methods will need to use a Toolkit.
static Plugin getPlugin(java.lang.String name)
          Returns a plugin by it's class name.
static Plugin[] getPlugins()
          Returns an array of installed plugins.
static java.util.Properties getProperties()
          The XPropertiesHandler needs to get Jext's Properties object to achieve its purpose.
static java.lang.String getProperty(java.lang.String name)
          If we store properties, we need to read them, too !
static java.lang.String getProperty(java.lang.String name, java.lang.Object[] args)
          Returns the property with the specified name, formatting it with the java.text.MessageFormat.format() method.
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 SplashScreen getSplashScreen()
          Returns splash screen
static int getWindowsCount()
          Returns amount of opened Jext
static void initDirectories()
          Creates the necessary directories.
static void initProperties()
          Init the properties.
static boolean isRunningBg()
          As Jext can be runned in background mode, some operations may need to know wether or not current instance is "up" or "crouched".
static boolean isServerEnabled()
          Returns true if the server is enabled.
static void killSplashScreen()
          Kills splash screen
static java.util.zip.ZipEntry languagePackContains(java.lang.String fileName)
           
static void loadInSingleJVMInstance(java.lang.String[] args)
          Attempts to load Jext in a single JVM instance only.
static void loadPlugins(java.lang.String directory)
          Loads all plugins in a directory.
static void loadProps(java.io.InputStream in)
          Deprecated. Maintained only for plugins compliance. Use loadXMLProps() instead of this method.
static void loadXMLActions(java.io.InputStream in, java.lang.String fileName)
          Load a set of actions from an XML file.
static void loadXMLOneClickActions(java.io.InputStream in, java.lang.String fileName)
          Load a set of actions from an XML file.
static void loadXMLProps(java.io.InputStream in, java.lang.String fileName)
          Load a set of properties from an XML file.
static void loadXMLProps(java.io.InputStream in, java.lang.String fileName, boolean toTranslate)
          Load a set of properties from an XML file.
static void main(java.lang.String[] args)
          Start method.
static JextFrame newWindow()
          Opens a new window.
static JextFrame newWindow(java.lang.String[] args)
          Opens a new window.
static void propertiesChanged()
          Notify all instances of Jext and all properties listeners to reload properties.
static void recentChanged(JextFrame instance)
          Notify all instances of Jext but the one which saved the file to reload recent menu
static void saveProps()
          Deprecated. Use saveXMLProps() instead
static void saveXMLProps(java.lang.String description)
          Saves the user's properties to a file using the XML specifications.
static void saveXMLProps(java.lang.String userProps, java.lang.String description)
          Saves the user's properties to a file using the XML specifications.
static void setLanguage(java.lang.String lang)
          Sets the current selected language.
static void setProperty(java.lang.String name, java.lang.String value)
          Set a property.
static void setServerEnabled(boolean on)
          Used by security options panel to remember of the server status.
static void setSplashProgress(int val)
          Set the splash screen progress value after having checked if it isn't null (in case of a new window).
static void setSplashText(java.lang.String text)
          Set the splash screen text value after having checked if it isn't null (in case of a new window).
static void stopAutoCheck()
          Stop the auto check function.
static void stopServer()
          Stops the Jext server which loads every Jext instance in the same JVM.
static void unsetProperty(java.lang.String name)
          Unsets (clears) a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELEASE

public static final java.lang.String RELEASE
Current Jext's release.

See Also:
Constant Field Values

BUILD

public static final java.lang.String BUILD
Last Jext's build date.

See Also:
Constant Field Values

DELETE_OLD_SETTINGS

public static final boolean DELETE_OLD_SETTINGS
If true, Jext will delete user settings if this release is newer

See Also:
Constant Field Values

DEBUG

public static boolean DEBUG
Debug mode(not final to avoid it being included in other .class files)


NEW_LINE

public static final java.lang.String[] NEW_LINE
Available new lines characters


SETTINGS_DIRECTORY

public static final java.lang.String SETTINGS_DIRECTORY
Settings directory.


JEXT_HOME

public static final java.lang.String JEXT_HOME
Jext home directory.


JEXT_SERVER_PORT

public static final int JEXT_SERVER_PORT
Jext server base port number. Used to load all Jext instances with only one JVM.

See Also:
Constant Field Values

modes

public static java.util.ArrayList modes

modesFileFilters

public static java.util.ArrayList modesFileFilters

usrProps

public static java.lang.String usrProps
Constructor Detail

Jext

public Jext()
Method Detail

getButtonsHighlight

public static boolean getButtonsHighlight()
Returns true if highlight buttons should not be highlighted on mouse over.


getFlatMenus

public static boolean getFlatMenus()
Returns true if menu should be flatened.


stopAutoCheck

public static void stopAutoCheck()
Stop the auto check function. We just interrupt the Thread and then 'kill' it.


getInputHandler

public static DefaultInputHandler getInputHandler()
Returns the input handler.


addAction

public static void addAction(MenuAction action)
Add an action listener to the list.

Parameters:
action - The action listener

addPythonAction

public static void addPythonAction(java.lang.String name,
                                   java.lang.String script,
                                   boolean editAction)
Add a python action listener to the list.

Parameters:
name - Internal action name
script - The python source script
editAction - True if this is an edit action

getAction

public static MenuAction getAction(java.lang.String action)
Returns a named action.

Parameters:
action - The action

assocPluginsToModes

public static void assocPluginsToModes()
Makes each mode know what plugins to start when it is selected.


loadPlugins

public static void loadPlugins(java.lang.String directory)
Loads all plugins in a directory.

Parameters:
directory - The directory

addPlugin

public static void addPlugin(Plugin plugin)
Registers a plugin with the editor. This will also call the start() method of the plugin.


getPlugin

public static Plugin getPlugin(java.lang.String name)
Returns a plugin by it's class name.

Parameters:
name - The plugin to return

getPlugins

public static Plugin[] getPlugins()
Returns an array of installed plugins.


newWindow

public static JextFrame newWindow(java.lang.String[] args)
Opens a new window.

Parameters:
args - Parameters from command line

newWindow

public static JextFrame newWindow()
Opens a new window.


getWindowsCount

public static int getWindowsCount()
Returns amount of opened Jext


propertiesChanged

public static void propertiesChanged()
Notify all instances of Jext and all properties listeners to reload properties.


recentChanged

public static void recentChanged(JextFrame instance)
Notify all instances of Jext but the one which saved the file to reload recent menu


getInstances

public static java.util.ArrayList getInstances()
Some external classes may need to notify each instance of Jext. XTree does.

Returns:
A ArrayList containing all instances of Jext

getMyToolkit

public static java.awt.Toolkit getMyToolkit()
Many methods will need to use a Toolkit. This method simply avoid to write too many lines of code.

Returns:
The default Toolkit

getHomeDirectory

public static java.lang.String getHomeDirectory()
Jext startup directory is saved during execution.

Returns:
Jext's startup directory

saveProps

public static void saveProps()
Deprecated. Use saveXMLProps() instead

Store the properties on the HD. After having set up the properties, we need to store'em in a file.


saveXMLProps

public static void saveXMLProps(java.lang.String description)
Saves the user's properties to a file using the XML specifications.

Parameters:
description - is a String containing a little description of the properties file. This String is stored on topmost of the user's properties file. Can be set to null.

saveXMLProps

public static void saveXMLProps(java.lang.String userProps,
                                java.lang.String description)
Saves the user's properties to a file using the XML specifications.

Parameters:
userProps - is the path to the file in which properties will be stored. If it is set to null, properties are not saved at all.
description - is a String containing a little description of the properties file. This String is stored on topmost of the user's properties file. Can be set to null.

getProperties

public static java.util.Properties getProperties()
The XPropertiesHandler needs to get Jext's Properties object to achieve its purpose.

Returns:
The current Properties object

loadXMLProps

public static void loadXMLProps(java.io.InputStream in,
                                java.lang.String fileName)
Load a set of properties from an XML file. This method, and not the caller, will search for the translated version of the XML.

Parameters:
in - An InputStream is specified to load properties from a JAR file
fileName - The XML filename

loadXMLProps

public static void loadXMLProps(java.io.InputStream in,
                                java.lang.String fileName,
                                boolean toTranslate)
Load a set of properties from an XML file. It is provided for when the caller already provides the translated file(for instance for the plugin translation); in this case toTranslate must be true, otherwise it will be translated the default way.

Parameters:
in - An InputStream is specified to load properties from a JAR file
fileName - The XML filename
Since:
Jext3.2pre1

loadXMLActions

public static void loadXMLActions(java.io.InputStream in,
                                  java.lang.String fileName)
Load a set of actions from an XML file.

Parameters:
in - An InputStream is specified to load properties from a JAR file
fileName - The XML filename

loadXMLOneClickActions

public static void loadXMLOneClickActions(java.io.InputStream in,
                                          java.lang.String fileName)
Load a set of actions from an XML file.

Parameters:
in - An InputStream is specified to load properties from a JAR file
fileName - The XML filename

getLanguageStream

public static java.io.InputStream getLanguageStream(java.io.InputStream in,
                                                    java.lang.String fileName)
Returns an input stream corresponding to selected language.

Parameters:
in - The default stream
fileName - The requested file

languagePackContains

public static java.util.zip.ZipEntry languagePackContains(java.lang.String fileName)

loadProps

public static void loadProps(java.io.InputStream in)
Deprecated. Maintained only for plugins compliance. Use loadXMLProps() instead of this method.

Load a set of properties.

Parameters:
in - An InputStream is specified to load properties from a JAR file

initDirectories

public static void initDirectories()
Creates the necessary directories.


initProperties

public static void initProperties()
Init the properties.


setLanguage

public static void setLanguage(java.lang.String lang)
Sets the current selected language.

Parameters:
lang - The label of the language

getLanguage

public static java.lang.String getLanguage()
Returns current selected language.


executeScripts

public static void executeScripts(JextFrame parent)
Execute scripts found in user home directory.


getMode

public static Mode getMode(java.lang.String modeName)
Returns the mode according to its name.


getModes

public static java.util.ArrayList getModes()
Returns modes list.


addMode

public static void addMode(Mode mode)
Adds a mode to Jext's syntax colorizing modes list


setProperty

public static void setProperty(java.lang.String name,
                               java.lang.String value)
Set a property.

Parameters:
name - Property's name
value - The value to store as name

getBooleanProperty

public static boolean getBooleanProperty(java.lang.String name)
Returns true if the property value equals to "on" or "true"

Parameters:
name - The name of the property to read

getBooleanProperty

public static boolean getBooleanProperty(java.lang.String name,
                                         java.lang.String def)
Returns true if the property value equals to "on" or "true"

Parameters:
name - The name of the property to read

getProperty

public static java.lang.String getProperty(java.lang.String name)
If we store properties, we need to read them, too !

Parameters:
name - The name of the property to read
Returns:
The value of the specified property

getProperty

public static final 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 final java.lang.String getProperty(java.lang.String name,
                                                 java.lang.Object[] args)
Returns the property with the specified name, formatting it with the java.text.MessageFormat.format() method.

Parameters:
name - The property
args - The positional parameters

unsetProperty

public static void unsetProperty(java.lang.String name)
Unsets (clears) a property.

Parameters:
name - The property

exit

public static void exit()
Exits Jext by closing all the windows. If backgrounding, it doesn't kill the jext server. This is synchronized because creating two windows at a time can be problematic.


closeToQuit

public static void closeToQuit(JextFrame frame)
Close a JextFrame by calling JextFrame.closeToQuit() and if it it the last window and we are not keeping the server open we close Jext completely.


closeWindow

public static void closeWindow(JextFrame frame)

getSplashScreen

public static SplashScreen getSplashScreen()
Returns splash screen


setSplashProgress

public static void setSplashProgress(int val)
Set the splash screen progress value after having checked if it isn't null (in case of a new window).

Parameters:
val - The new value

setSplashText

public static void setSplashText(java.lang.String text)
Set the splash screen text value after having checked if it isn't null (in case of a new window).

Parameters:
text - The new text

killSplashScreen

public static void killSplashScreen()
Kills splash screen


stopServer

public static void stopServer()
Stops the Jext server which loads every Jext instance in the same JVM.


isServerEnabled

public static boolean isServerEnabled()
Returns true if the server is enabled.


setServerEnabled

public static void setServerEnabled(boolean on)
Used by security options panel to remember of the server status.

Parameters:
on - If true, the server will be runned at next start

loadInSingleJVMInstance

public static void loadInSingleJVMInstance(java.lang.String[] args)
Attempts to load Jext in a single JVM instance only. If this instance of Jext is the very first to be loaded, then a ServerSocket is opened. Otherwise, this instance attemps to connect on to a specific socket port to tell other Jext instance to create a new window. This avoids to load on JVM for each launch of Jext. Opened port is securised so that no security hole is created.

Parameters:
args - The arguments of the new Jext window

isRunningBg

public static boolean isRunningBg()
As Jext can be runned in background mode, some operations may need to know wether or not current instance is "up" or "crouched". This is the purpose of this method.

Returns:
A true boolean value is returned whenever Jext is running in background mode

main

public static void main(java.lang.String[] args)
Start method. Load the property file, set the look and feel, create a new GUI, load the options. If a file name is specified as first argument, we pass it to the window contructor which will construct its full path (because you can specify, for example, ..\..\test.java or ~\jext.props or ...../hello.cpp - both / and \ can be used -)



Copyright © 2002 Romain Guy.