Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jext
Class Jext  view Jext download Jext.java

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

Field Summary
private static java.util.HashMap actionHash
           
static java.lang.String BUILD
          Last Jext's build date.
private static JextFrame builtTextArea
           
private static boolean buttonsHighlight
           
private static org.jext.misc.VersionCheck check
           
static boolean DEBUG
          Debug mode(not final to avoid it being included in other .class files)
private static boolean defaultKeepInMemory
           
private static java.util.Properties defaultProps
           
static boolean DELETE_OLD_SETTINGS
          If true, Jext will delete user settings if this release is newer
private static boolean flatMenus
           
private static boolean goingToKill
           
private static org.gjt.sp.jedit.textarea.DefaultInputHandler inputHandler
           
private static java.util.ArrayList instances
           
private static boolean isServerEnabled
           
static java.lang.String JEXT_HOME
          Jext home directory.
static int JEXT_SERVER_PORT
          Jext server base port number.
private static JextLoader jextLoader
           
private static boolean keepInMemory
           
private static java.lang.String language
           
private static java.util.ArrayList languageEntries
           
private static java.util.zip.ZipFile languagePack
           
static java.util.ArrayList modes
           
static java.util.ArrayList modesFileFilters
           
static java.lang.String[] NEW_LINE
          Available new lines characters
private static java.util.ArrayList plugins
           
private static java.util.Properties props
           
private static java.util.HashMap pythonActionHash
           
static java.lang.String RELEASE
          Current Jext's release.
private static boolean runInBg
           
static java.lang.String SETTINGS_DIRECTORY
          Settings directory.
private static org.jext.gui.SplashScreen splash
           
private static java.lang.String USER_PROPS
           
static java.lang.String usrProps
           
 
Constructor Summary
Jext()
           
 
Method Summary
static void addAction(MenuAction action)
          Add an action listener to the list.
private static void addJextKeyBindings()
          Adds Jext internal key bindings.
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.
private static java.lang.String[] checkArgsForBg(java.lang.String[] args)
           
static void closeToQuit(JextFrame frame)
          Close a JextFrame by calling JextFrame.closeToQuit() 55 and if it it the last window and we are not keeping the server open we close Jext completely.
(package private) static void closeToQuit(JextFrame frame, boolean isKillingServer)
           
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.
(package private) static void finalCleanupAndExit()
          Do the final cleanup that must be done at the real end of the session(when closing the server if running background server, or after killing the last window if no server is running).
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 org.gjt.sp.jedit.textarea.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 org.jext.gui.SplashScreen getSplashScreen()
          Returns splash screen
static int getWindowsCount()
          Returns amount of opened Jext
private static void initActions()
          Load the action listeners.
static void initDirectories()
          Creates the necessary directories.
private static void initModes()
          Initialize syntax colorizing modes.
private static void initPlugins()
          Loads plugins.
static void initProperties()
          Init the properties.
private static void initUI()
           
static boolean isDefaultKeepInMemory()
          Returns true if the backgrounding is enabled.
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.
(package private) static JextFrame newWindow(java.lang.String[] args, boolean toShow)
          Opens a new window, but eventually does not show it.
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 setDefaultKeepInMemory(boolean val)
           
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).
private static void sortModes()
           
static void stopAutoCheck()
          Stop the auto check function.
(package private) static void stopPlugins()
          Stop plugins.
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 java.lang.String RELEASE
Current Jext's release.


BUILD

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


DELETE_OLD_SETTINGS

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


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

language

private static java.lang.String language

languagePack

private static java.util.zip.ZipFile languagePack

languageEntries

private static java.util.ArrayList languageEntries

flatMenus

private static boolean flatMenus

buttonsHighlight

private static boolean buttonsHighlight

jextLoader

private static JextLoader jextLoader

isServerEnabled

private static boolean isServerEnabled

plugins

private static java.util.ArrayList plugins

usrProps

public static java.lang.String usrProps

splash

private static org.jext.gui.SplashScreen splash

props

private static java.util.Properties props

defaultProps

private static java.util.Properties defaultProps

instances

private static java.util.ArrayList instances

actionHash

private static java.util.HashMap actionHash

pythonActionHash

private static java.util.HashMap pythonActionHash

check

private static org.jext.misc.VersionCheck check

inputHandler

private static org.gjt.sp.jedit.textarea.DefaultInputHandler inputHandler

USER_PROPS

private static final java.lang.String USER_PROPS

runInBg

private static boolean runInBg

keepInMemory

private static boolean keepInMemory

defaultKeepInMemory

private static boolean defaultKeepInMemory

goingToKill

private static boolean goingToKill

builtTextArea

private static JextFrame builtTextArea
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 org.gjt.sp.jedit.textarea.DefaultInputHandler getInputHandler()
Returns the input handler.


addAction

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


addPythonAction

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


getAction

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


initActions

private static void initActions()
Load the action listeners.


addJextKeyBindings

private static void addJextKeyBindings()
Adds Jext internal key bindings.


initPlugins

private static void initPlugins()
Loads plugins.


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.


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.


getPlugins

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


newWindow

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


newWindow

public static JextFrame newWindow()
Opens a new window.


newWindow

static JextFrame newWindow(java.lang.String[] args,
                           boolean toShow)
Opens a new window, but eventually does not show it.


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.


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.


getHomeDirectory

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


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.


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.


getProperties

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


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.


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.

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.


loadXMLOneClickActions

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


getLanguageStream

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


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.


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.


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.


sortModes

private static void sortModes()

initUI

private static void initUI()

initModes

private static void initModes()
Initialize syntax colorizing modes.


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.


getBooleanProperty

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


getBooleanProperty

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


getProperty

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


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.


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.


unsetProperty

public static void unsetProperty(java.lang.String name)
Unsets (clears) a 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.


finalCleanupAndExit

static void finalCleanupAndExit()
Do the final cleanup that must be done at the real end of the session(when closing the server if running background server, or after killing the last window if no server is running).


stopPlugins

static void stopPlugins()
Stop plugins.


closeToQuit

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


closeToQuit

static void closeToQuit(JextFrame frame,
                        boolean isKillingServer)

closeWindow

public static void closeWindow(JextFrame frame)

getSplashScreen

public static org.jext.gui.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).


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).


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.


isDefaultKeepInMemory

public static boolean isDefaultKeepInMemory()
Returns true if the backgrounding is enabled.


setDefaultKeepInMemory

public static void setDefaultKeepInMemory(boolean val)

setServerEnabled

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


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.


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.


checkArgsForBg

private static java.lang.String[] checkArgsForBg(java.lang.String[] args)

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 -)