Class StrangeEons
- java.lang.Object
-
- ca.cgjennings.apps.arkham.StrangeEons
-
public final class StrangeEons extends java.lang.Object
This is the core Strange Eons application. There is only one instance of this class available, which can be obtained by callinggetApplication()
.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StrangeEons.LogEntry
A record added to the application log.static interface
StrangeEons.PluginLoadingListener
An event interface implemented by classes that will listen for plug-ins to be loaded or unloaded.static class
StrangeEons.ReleaseType
Describes the type of release by which this build was made available to the public.
-
Field Summary
Fields Modifier and Type Field Description static java.util.logging.Logger
log
The shared logger for application log messages.static java.lang.String
MARKUP_TARGET_PROPERTY
The name of a property change event that is fired when the current markup target changes.static int
RECOMMENDED_MEMORY_IN_MB
The recommended minimum value for the maximum memory setting (-Xmx
) for the virtual machine, in megabytes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activatePlugin(Plugin plugin)
Shows anACTIVATED
plug-in that is currently loaded.void
activatePlugin(Plugin plugin, int modifiers, boolean show)
Shows or hides anACTIVATED
plug-in that is currently loaded.static void
addEditor(StrangeEonsEditor editor)
Adds a new editor, causing it it to become visible and available to the user.void
addExitTask(java.lang.Runnable task)
Registers a task to be performed when Strange Eons is exiting.void
addPluginLoadingListener(StrangeEons.PluginLoadingListener listener)
Adds a new listener to be notified when plug-ins are loaded or unloaded.void
addPropertyChangeListener(java.beans.PropertyChangeListener li)
Adds a new property change listener that will be notified when any property change event is fired by the application.void
addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener li)
Adds a new property change listener that will be notified when property change events for the named property are fired by the application.void
addStartupTask(java.lang.Runnable task)
Registers a task to be performed when Strange Eons is has started up and is ready to use.StrangeEonsEditor
createEditor(java.lang.String classMapKey)
Creates a new editor for the component type specified by a key from a class map.void
deleteOnStartup(java.io.File toDelete, boolean delete)
Adds or removes a marker indicating that a file should be deleted when the application is next started.void
fileBugReport(java.lang.String description, java.lang.Throwable ex)
Initiates a bug report that can be submitted by the user.static StrangeEonsEditor
getActiveEditor()
Returns the active editor, ornull
if no editor is active.static GameComponent
getActiveGameComponent()
Returns the game component edited by the active editor, ornull
if there either is no active editor, or if the active editor is not a game component editor.static StrangeEons
getApplication()
Returns the single instance ofStrangeEons
once the application has been initialized.static int
getBuildNumber()
Returns the build number of this version of the application.CommandLineArguments
getCommandLineArguments()
Returns the command line arguments that were passed to the application from the command line when the application was started.MarkupTarget
getCurrentMarkupTarget()
Returns the current application-wide markup target, ornull
if there is no currently valid target.static int
getEditionNumber()
Returns the edition number of this version of the application.Plugin
getLoadedPlugin(java.lang.String pluginIdentifier)
Given the class name of a plug-in, return itsPlugin
instance if it is currently installed and loaded.If the plug-in class is not installed, is disabled, or it failed to initialize properly, this method returnsnull
.Plugin
getLoadedPluginByName(java.lang.String name)
Finds a loadedPlugin
with the specified name.If there is no matching plug-in, returnsnull
.Plugin[]
getLoadedPlugins()
Returns a (possibly empty) array of the currently loaded plug-ins.static java.util.List<StrangeEons.LogEntry>
getLogEntries()
Returns the current contents of the application log.MarkupTarget
getMarkupTarget()
Returns the most recently valid markup target.NamedObjectDatabase
getNamedObjects()
Returns the global named object database for the application.static Project
getOpenProject()
Returns the current open project, ornull
if no project is open.static ExportContainer[]
getRegisteredExportContainers()
Returns an array of the registered export containers.static StrangeEons.ReleaseType
getReleaseType()
Returns the type of this release of the application.static java.awt.Window
getSafeStartupParentWindow()
Returns a window that can be used as a parent window for dialog boxes.static ScriptRunnerState
getScriptRunner()
If the app is in "script runner" mode, returns an object that can be queried for additional information and used to manage the mode's behaviour.static java.lang.String
getUrlForDocPage(java.lang.String baseDocFileName)
Returns the full URL of a Strange Eons documentation page given a base file name.static java.io.File
getUserStorageFile(java.lang.String child)
Returns a file that can be used to store user data.static java.lang.String
getVersionString()
Returns a string that describes this release of Strange Eons.static StrangeEonsAppWindow
getWindow()
Returns the main application window.void
insertMarkup(java.lang.String markup)
Inserts a string into the most recently valid application-wide markup target.void
insertMarkupTags(java.lang.String prefix, java.lang.String suffix)
Surrounds the selection in the current markup target with the prefix and suffix.static boolean
isNonInteractive()
Returns whether the app is running in non-interactive mode.void
loadPlugins()
static void
main(java.lang.String[] args)
This method is called when the application first starts as part of passing control of the process to the application.static void
registerExportContainer(ExportContainer ec)
Register a new export container capable of exporting file collections.void
removePluginLoadingListener(StrangeEons.PluginLoadingListener listener)
Removes a previously added listener for plug-in load events.void
removePropertyChangeListener(java.beans.PropertyChangeListener li)
Removes a previously added listener that listens for all property change events.void
removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener li)
Removes a previously added listener that listens for the named property to change.boolean
requestNewMarkupTarget(java.lang.Object potentialTarget)
Explicitly requests that the current application-wideMarkupTarget
be set to a specific object.static void
setWaitCursor(boolean appIsBusy)
This is a convenience method that sets or unsets a wait cursor on the main application window.static boolean
testJavaVersion(int... versionTokens)
Returnstrue
if the installed version of Java is equal to or greater than the version specified.java.lang.String
toString()
Returns a basic string description of the application, in the following format:[StrangeEons <i>version</i>, <i>release type</i> release, build <i>number</i>]
.void
unloadPlugins()
static void
unregisterExportContainer(ExportContainer ec)
Unregister a registered export container type.boolean
willDeleteOnStartup(java.io.File toCheck)
Returnstrue
if a file has been marked for deletion on the next application start by passing it todeleteOnStartup(java.io.File, boolean)
.
-
-
-
Field Detail
-
log
public static final java.util.logging.Logger log
The shared logger for application log messages.
-
RECOMMENDED_MEMORY_IN_MB
public static final int RECOMMENDED_MEMORY_IN_MB
The recommended minimum value for the maximum memory setting (-Xmx
) for the virtual machine, in megabytes. Higher values are better if your system can support it.- See Also:
- Constant Field Values
-
MARKUP_TARGET_PROPERTY
public static java.lang.String MARKUP_TARGET_PROPERTY
The name of a property change event that is fired when the current markup target changes.
-
-
Method Detail
-
getVersionString
public static java.lang.String getVersionString()
Returns a string that describes this release of Strange Eons.- Returns:
- the public version description of the application
-
getEditionNumber
public static int getEditionNumber()
Returns the edition number of this version of the application. For example, releases of Strange Eons 3 would return the value 3. Different editions of Strange Eons typically have extensive differences in their public APIs.- Returns:
- the edition for this version of Strange Eons
-
getBuildNumber
public static int getBuildNumber()
Returns the build number of this version of the application. The build number uniquely identifies each release of Strange Eons, and is the most accurate way to determine the version of the application that is running. Higher build numbers represent later releases. The build number can be used to conditionally disable features that rely on a certain version of Strange Eons when the user is running an older version. For example, if a feature used by your plug-in was introduced in build 2942, you can check for it with code like the following:if( StrangeEons.getBuildNumber() >= 2942 ) { // enable feature } else { // disable feature }
- Returns:
- the build number of this release
-
getReleaseType
public static StrangeEons.ReleaseType getReleaseType()
Returns the type of this release of the application.- Returns:
- the kind of release, such as
ALPHA
orBETA
.
-
testJavaVersion
public static boolean testJavaVersion(int... versionTokens)
Returnstrue
if the installed version of Java is equal to or greater than the version specified. For example, to check if the installed version is Java 6 update 10 or newer, call:isJavaVersion( 1, 6, 0, 10 )
.- Parameters:
versionTokens
- the version number tokens to check; index 1 is the major version number, index 2 is the minor version number, and index 3 is the update number (index 0 has never been anything but 1 at the time of this writing)- Returns:
true
if the installed version of Java is equal to or greater than the specified version
-
getApplication
public static StrangeEons getApplication()
Returns the single instance ofStrangeEons
once the application has been initialized. (The application becomes initialized after libraries and themes have been loaded, but just before extension plug-ins are loaded.) If the application is not yet initialized, this method returnsnull
.- Returns:
- the application instance
-
getWindow
public static StrangeEonsAppWindow getWindow()
Returns the main application window. If called while the application is starting, the window might not yet exist, in which casenull
is returned. (The window is guaranteed to exists before extension plug-ins begin to load.)- Returns:
- the main application window
-
getActiveEditor
public static StrangeEonsEditor getActiveEditor()
Returns the active editor, ornull
if no editor is active. This is a convenience method that returnsnull
if the application window has not been created yet, or else forwards the call to the application window.- Returns:
- the active editor, or
null
-
getActiveGameComponent
public static GameComponent getActiveGameComponent()
Returns the game component edited by the active editor, ornull
if there either is no active editor, or if the active editor is not a game component editor.- Returns:
- the actively edited component, or
null
-
createEditor
public StrangeEonsEditor createEditor(java.lang.String classMapKey) throws java.lang.InstantiationException
Creates a new editor for the component type specified by a key from a class map. The new editor will be added to the main application window and a reference to it will be returned.Resource Script Entries: If the class map key is associated with a resource script rather than a component class or DIY script, then the script might create any number of editors, including zero. In this case, the new editor will be inferred by observing whether the active editor changes after running the script. If it does change, then it is assumed that the newly active editor was created by the script; otherwise it is assumed that the script did not create an editor and
null
is returned.- Parameters:
classMapKey
- a key for an editor specified in a loaded class map file- Returns:
- an editor for the given key, or
null
if no new editor is created - Throws:
java.lang.IllegalArgumentException
- if the class map key is not a valid key from an entry that was added this sessionCoreComponents.MissingCoreComponentException
- if a core library is required to create the editor and the user declines to install itjava.lang.InstantiationException
- if an error occurs while instantiating the editor- See Also:
ClassMap
,ClassMap.Entry.getKey()
-
addEditor
public static void addEditor(StrangeEonsEditor editor)
Adds a new editor, causing it it to become visible and available to the user. The editor will be placed on the main application window tab strip (that is, the editor will start attached). This is a convenience method that forwards the call to the application window.- Parameters:
editor
- the editor to be added- Throws:
java.lang.NullPointerException
- ifeditor
isnull
java.lang.IllegalStateException
- if the application window doesn't exist
-
getOpenProject
public static Project getOpenProject()
Returns the current open project, ornull
if no project is open. (At most one project can be open at any given time.) This is a convenience method that returnsnull
if the application window has not been created yet, or else forwards the call to the application window.- Returns:
- the current open project, or
null
- See Also:
StrangeEonsAppWindow.getOpenProject()
-
isNonInteractive
public static boolean isNonInteractive()
Returns whether the app is running in non-interactive mode. When running in non-interactive mode, windows are not shown automatically (including the splash screen). Non-interactive mode is normally used to perform some automated task, such as running a script.Making the main app window visible will immediately end non-interactive mode if enabled.
Note that performing an action that assumes or relies on the app window may throw an exception when running in non-interactive mode.
- Returns:
- true if running in non-interactive mode
-
getScriptRunner
public static ScriptRunnerState getScriptRunner()
If the app is in "script runner" mode, returns an object that can be queried for additional information and used to manage the mode's behaviour. Returns null if the app is running normally. Script runner mode is activated by passing a command line argument-run
(or--run
) and a file path for a script file. When running in run script mode, the app begins in a non-interactive mode without automatically showing the app window.- Returns:
- the run script mode helper responsible for running the command line script file, or null
- See Also:
CommandLineArguments.run
-
loadPlugins
public void loadPlugins()
Reloaded plug-ins that are of theACTIVATED
orINJECTED
types. Currently loaded plug-ins of these types will first be unloaded, and then all plug-ins found in plug-in bundles that are currently enabled will be started. This method has no effect on null null null null null null null null null null null libraries, themes, or extension plug-ins.- Throws:
java.lang.AssertionError
- if not called from the event dispatch thread- See Also:
unloadPlugins()
,BundleInstaller.loadPluginBundles()
,BundleInstaller.getInstalledPlugins()
-
unloadPlugins
public void unloadPlugins()
Causes all currently loadedACTIVATED
andINJECTED
plug-ins to be unloaded. This method has no effect on libraries, themes, or extension plug-ins.- See Also:
loadPlugins()
,StrangeEons.PluginLoadingListener
-
addPluginLoadingListener
public void addPluginLoadingListener(StrangeEons.PluginLoadingListener listener)
Adds a new listener to be notified when plug-ins are loaded or unloaded.- Parameters:
listener
- the listener to add- Throws:
java.lang.NullPointerException
- if the listener isnull
- See Also:
StrangeEons.PluginLoadingListener
-
removePluginLoadingListener
public void removePluginLoadingListener(StrangeEons.PluginLoadingListener listener)
Removes a previously added listener for plug-in load events.- Parameters:
listener
- the listener to remove
-
getLoadedPlugin
public Plugin getLoadedPlugin(java.lang.String pluginIdentifier)
Given the class name of a plug-in, return itsPlugin
instance if it is currently installed and loaded.If the plug-in class is not installed, is disabled, or it failed to initialize properly, this method returnsnull
.- Parameters:
pluginIdentifier
-- Returns:
- the
Plugin
instance for the class, ornull
- Throws:
java.lang.NullPointerException
- ifpluginClass
isnull
- See Also:
BundleInstaller.getInstalledPlugins()
,BundleInstaller.getBundleFileForUUID(java.util.UUID)
,PluginBundle.getPluginRoot()
-
getLoadedPluginByName
public Plugin getLoadedPluginByName(java.lang.String name)
Finds a loadedPlugin
with the specified name.If there is no matching plug-in, returnsnull
. Plug-ins are not required to have unique names: if more than one plug-in matches, this method returns one of them at random. Moreover, some plug-ins are localized and will have a different name depending on the current interface language. To guarantee a specific plug-in class, either usegetLoadedPlugin(java.lang.String)
or find the plug-in by its UUID.- Parameters:
name
- the plug-in name presented to the user- Returns:
- the
Plugin
instance for the class, ornull
- Throws:
java.lang.NullPointerException
- ifpluginClass
isnull
-
activatePlugin
public void activatePlugin(Plugin plugin)
Shows anACTIVATED
plug-in that is currently loaded. If the plug-in is currently showing then it will be hidden first, then re-shown.- Parameters:
plugin
- the plug-in to activate- See Also:
activatePlugin(ca.cgjennings.apps.arkham.plugins.Plugin, int, boolean)
-
activatePlugin
public void activatePlugin(Plugin plugin, int modifiers, boolean show)
Shows or hides anACTIVATED
plug-in that is currently loaded. APluginContext
will be created for the plug-in and used to activate it as if the user had selected it from the Toolbox menu. The value ofmodifiers
is a logical or of modifier key codes (seePluginContext.getModifiers()
) that will be marked as pressed. To activate the plug-in without indicating any special modifier keys, pass 0. Ifshow
istrue
, then the plug-in will be asked to show itself, otherwise to hide itself. The exact behaviours implied by the terms "show" and "hide" depend on the plug-in, but generally a show request executes the plug-in behaviour or makes the plug-in's dialog visible, while a hide request stops the behaviour or makes the dialog invisible. Many plug-ins are implemented as modal dialogs and therefore do not have a hide behaviour, as they stop the main application until the plug-in window is closed.Note: The general contract for plug-in behaviour states that a plug-in will only be shown if its
isPluginShowing
method returnsfalse
, and vice-versa. Although most plug-ins do not rely on this guarantee, you should not violate it unless the plug-in's documentation explicitly permits it.- Parameters:
plugin
- the plug-in to be activatedmodifiers
- the set of control key modifiers to activate the plug-in withshow
- iftrue
, the plug-in should show/start itself, otherwise, hide/stop itself- Throws:
java.lang.IllegalArgumentException
- ifplugin
is not aPlugin.ACTIVATED
type
-
getLoadedPlugins
public Plugin[] getLoadedPlugins()
Returns a (possibly empty) array of the currently loaded plug-ins.- Returns:
- an array of the activated or injected plug-ins that are loaded
- See Also:
loadPlugins()
-
getUserStorageFile
public static java.io.File getUserStorageFile(java.lang.String child)
Returns a file that can be used to store user data. For example, a plug-in might use this to create a folder for storing cached data. All of the files returned by this method will be located in a special system-dependent storage folder. Ifchild
isnull
, then the storage folder itself will be returned. Otherwise,child
is taken to be a relative path, and the returned file will combine the storage folder with this relative location. For example, on a UNIX system, calling this method with child "test.txt" might return~/.StrangeEons3/test.txt
.To locate a subfolder in user storage, specify a relative path using '/' as the directory separator character. (Slashes will be converted to the platform-specific separator character automatically.) For example,
"myplugin/cachefile"
would refer to the file cachefile in the myplugin subfolder of the user storage folder.An effort will be made to create any needed folders between the storage folder and the requested file, if they do not already exist. If
child
ends with/
, then the last path entry inchild
is also treated as a folder name and created if mising.- Parameters:
child
-- Returns:
- the folder in which per-user files are stored, or the
child
within that folder - Throws:
java.lang.IllegalArgumentException
- if the returned file would not be located in the system-dependent storage folder (for example, ifchild
starts with "..")
-
deleteOnStartup
public void deleteOnStartup(java.io.File toDelete, boolean delete)
Adds or removes a marker indicating that a file should be deleted when the application is next started. On the next application start, an attempt is made to delete all files so marked. Any file marked for deletion with this method must be located in the user storage folder.- Parameters:
toDelete
- the file to delete at startupdelete
- whether the record to delete should be added or removed- Throws:
java.lang.NullPointerException
- if the file isnull
java.lang.IllegalArgumentException
- if the file to be deleted is not in the user storage folder
-
willDeleteOnStartup
public boolean willDeleteOnStartup(java.io.File toCheck)
Returnstrue
if a file has been marked for deletion on the next application start by passing it todeleteOnStartup(java.io.File, boolean)
. Note that it is not guaranteed that the file will actually be deleted, only that it is marked and that an attempt to delete it will be made.- Parameters:
toCheck
- the file to check- Returns:
true
if the file will be deleted the next time the application starts- Throws:
java.lang.NullPointerException
- if the file isnull
-
addExitTask
public void addExitTask(java.lang.Runnable task)
Registers a task to be performed when Strange Eons is exiting. Exit tasks are run only when it is certain that the application will exit; for example, the user will already have been given a chance to save editors with unsaved changes.Exit tasks are performed calling the
run()
method of thetask
object. A description of each task will be logged atLevel.INFO
by calling the task'stoString()
method just before it runs. If a task throws an exception, it will be logged but it will not prevent other exit tasks from running.Tasks are not guaranteed to run in a particular order; they may run from any thread and may even run concurrently. In general, do not expect to be able to open a window or perform other actions on the event dispatch thread; to do so safely you would need to use
invokeLater
and the application will probably exit before such code will get a chance to run.Tasks are not guaranteed to run if the application is terminated abnormally, including use of the terminate command from the script debugger.
- Parameters:
task
- code to be called as part of the application shutdown process
-
addStartupTask
public void addStartupTask(java.lang.Runnable task)
Registers a task to be performed when Strange Eons is has started up and is ready to use. If called after Strange Eons has already finished starting, the task will run immediately.Startup tasks are performed calling the
run()
method of thetask
object. A description of each task will be logged atLevel.INFO
by calling the task'stoString()
method just before it runs. If a task throws an exception, it will be logged but it will not prevent other tasks from running.Unlike exit tasks, startup tasks run on the event dispatch thread in the order that they were registered.
- Parameters:
task
- code to be called once the app has started
-
getMarkupTarget
public MarkupTarget getMarkupTarget()
Returns the most recently valid markup target. Returnsnull
if there has either never been a valid target, or if the most recently valid target is no currently valid (for example, if it has been disabled since it became the current target). When responding to user action, this is normally the markup target that you want since intervening user action is likely to change the current target. For example, if the user selects a menu item to activate your code, the act of opening the menu would clear the current target, causinggetCurrentMarkupTarget()
to returnnull
.- Returns:
- the most recent valid markup target, or
null
- See Also:
getCurrentMarkupTarget()
-
getCurrentMarkupTarget
public MarkupTarget getCurrentMarkupTarget()
Returns the current application-wide markup target, ornull
if there is no currently valid target.- Returns:
- the current markup target, or
null
- See Also:
getMarkupTarget()
,requestNewMarkupTarget(java.lang.Object)
-
requestNewMarkupTarget
public boolean requestNewMarkupTarget(java.lang.Object potentialTarget)
Explicitly requests that the current application-wideMarkupTarget
be set to a specific object. If the request succeeds,true
is returned. In order to succeed, the new target must either benull
(to clear the current target) or a (strictly) valid markup target. If the current target changes, a property change event will be fired forMARKUP_TARGET_PROPERTY
.- Parameters:
potentialTarget
- the object which may become the new target- Returns:
true
if the requested object is the markup target when this method returns- See Also:
MarkupTargetFactory.isValidTarget(java.lang.Object, boolean)
-
insertMarkup
public void insertMarkup(java.lang.String markup)
Inserts a string into the most recently valid application-wide markup target. The current selection, if any, will be replaced. If there is no such target, this method has no effect.- Parameters:
markup
- the markup text to insert into the markup target- See Also:
MarkupTarget.setSelectedText(java.lang.String)
-
insertMarkupTags
public void insertMarkupTags(java.lang.String prefix, java.lang.String suffix)
Surrounds the selection in the current markup target with the prefix and suffix. If the selection is already surrounded by prefix and suffix, or if the selection already includes the prefix and suffix, then the prefix and suffix are instead deleted from the selection. If no markup target is available, this method has no effect.- Parameters:
prefix
- the text to insert before the selectionsuffix
- the text to insert after the selection- See Also:
MarkupTarget.tagSelectedText(java.lang.String, java.lang.String, boolean)
-
getNamedObjects
public NamedObjectDatabase getNamedObjects()
Returns the global named object database for the application. The named object database associates names with objects so that they can be shared between scripts. Two common uses for this database:- Creating an object to hold functions that will be used by multiple
scripts later on. For example, a plug-in that adds new game component
types could register a named object in its extension plug-in that defines
a library of functions used by the individual DIY scripts. This can be
more efficient than calling
useLibrary
in every component script because the library code only needs to be compiled once. - Sharing information between scripts, or between different runs of the same script. For example, one script could store information about a game that is used by other scripts later on. The scripts that use this data might not even be from the same plug-in.
Once set, a named object will remain available until it is explicitly removed or the application terminates. If scripts in different plug-ins need to access a named object, you should set the bundle priorities in the root files of the various plug-ins to ensure that the plug-in that creates the named object is loaded before the plug-ins that rely on it.
The database returned from this method provides special support for scripting. When accessed from a script, the database appears to be an object whose properties are the names of stored objects. Named objects can thus be set and looked up using array and property syntax:
Eons.namedObjects.myNamedObject = function() { println( 'hello' ); }; Eons.namedObjects.myNamedObject(); // A name cannot be used if it already has an object assigned to it, // but you can remove the association with the delete keyword: delete Eons.namedObjects.myNamedObject;
- Returns:
- the global shared named object database
- Creating an object to hold functions that will be used by multiple
scripts later on. For example, a plug-in that adds new game component
types could register a named object in its extension plug-in that defines
a library of functions used by the individual DIY scripts. This can be
more efficient than calling
-
fileBugReport
public void fileBugReport(java.lang.String description, java.lang.Throwable ex)
Initiates a bug report that can be submitted by the user. An optional description and exception information will be included as part of the report if provided. The exact details of how the report is filed and what steps the user must complete are subject to change.- Parameters:
description
- text to include with the report, ornull
ex
- an exception that is relevant to the bug being reported, ornull
-
getLogEntries
public static java.util.List<StrangeEons.LogEntry> getLogEntries()
Returns the current contents of the application log. The application log contains the messages posted to the logger, except those filtered out because of the logging level that was active at the time.- Returns:
- the contents of the application log
-
setWaitCursor
public static void setWaitCursor(boolean appIsBusy)
This is a convenience method that sets or unsets a wait cursor on the main application window. If the application window is not available yet, then this method does nothing. Otherwise, it forwards the call to the application window as if you had calledStrangeEons.getWindow().setWaitCursor( appIsBusy )
.This method nests: if you set a wait cursor four times, then you must unset it four times before a regular cursor will be restored. To ensure that the wait cursor is removed, you should place the call to unset the wait cursor in a
finally
clause:StrangeEons.setWaitCursor( true ); try { // do some things } finally { StrangeEons.setWaitCursor( false ); }
This method can be called from outside of the event dispatch thread.
- Parameters:
appIsBusy
-true
to set the wait cursor,false
to unset it
-
getCommandLineArguments
public CommandLineArguments getCommandLineArguments()
Returns the command line arguments that were passed to the application from the command line when the application was started.- Returns:
- the command line arguments passed to the application
-
getSafeStartupParentWindow
public static java.awt.Window getSafeStartupParentWindow()
Returns a window that can be used as a parent window for dialog boxes. During startup, this method will return the splash window. Once the application window is visible, that will be returned instead. In the event that this method is called before the splash window appears, this method will returnnull
; however it is not normally possible for plug-in code to execute before the splash window is available.Note that plug-ins should not routinely open dialog boxes during application startup; this method is meant to be used primarily for displaying critical error messages.
- Returns:
- a window that can safely be used as a parent window
- Throws:
java.lang.AssertionError
- if called from outside the Event Dispatch Thead- See Also:
ErrorDialog.displayError(java.lang.String, java.lang.Throwable)
-
main
public static void main(java.lang.String[] args)
This method is called when the application first starts as part of passing control of the process to the application. Calling this method again will throw an exception.- Parameters:
args
- the command line arguments being passed to the application- Throws:
java.lang.IllegalStateException
- if the method has already been called
-
toString
public java.lang.String toString()
Returns a basic string description of the application, in the following format:[StrangeEons <i>version</i>, <i>release type</i> release, build <i>number</i>]
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string describing the application
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener li)
Adds a new property change listener that will be notified when any property change event is fired by the application.- Parameters:
li
- the listener to add
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener li)
Removes a previously added listener that listens for all property change events.- Parameters:
li
- the listener to remove
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener li)
Adds a new property change listener that will be notified when property change events for the named property are fired by the application.- Parameters:
property
- name of the property to listen forli
- the listener to add
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener li)
Removes a previously added listener that listens for the named property to change.- Parameters:
property
- name of the property to stop listening forli
- the listener to remove
-
registerExportContainer
public static void registerExportContainer(ExportContainer ec)
Register a new export container capable of exporting file collections.- Parameters:
ec
- the container type to register- Throws:
java.lang.NullPointerException
- if the container or its identifier arenull
java.lang.IllegalArgumentException
- if a container type with this type's identifier is already registered
-
unregisterExportContainer
public static void unregisterExportContainer(ExportContainer ec)
Unregister a registered export container type.- Parameters:
ec
- the container type to unregister
-
getRegisteredExportContainers
public static ExportContainer[] getRegisteredExportContainers()
Returns an array of the registered export containers.- Returns:
- a (possibly empty) array of all container types that are currently registered
-
getUrlForDocPage
public static java.lang.String getUrlForDocPage(java.lang.String baseDocFileName)
Returns the full URL of a Strange Eons documentation page given a base file name. If the name superficially looks like it is already ahttp[s]
URL then it is returned unchanged. A doc page can be the main index page (index
) or a page in one of the submanuals: the user manual (prefixum-
), the dev manual (prefixdm-
), or the translation manual (prefixtm-
). If the base name is notindex
and does not start with one of the specified manual prefixes, it is assumed to be a shortened name for a user manual page and that prefix is prepended. The name can include a hash fragment after the base name to link to a specific section of the page.Note that these rules may change in the future if the documentation is reorganized.
- Parameters:
baseDocFileName
- base name of a documentation page, such asdm-first-plugin
- Returns:
- a complete URL for the document
-
-