ides.api.core
Class Hub

java.lang.Object
  extended by ides.api.core.Hub

public class Hub
extends java.lang.Object

The main hub of the program. Serves to get references to all objects of interest (such as settings, main window, loaded resources, etc.) Plugins are encouraged to make use of these services.

Author:
Lenko Grigorov

Method Summary
static void addResouceBundle(java.util.ResourceBundle bundle)
          Adds a string resource bundle to the set of bundles which are used to look up strings.
static void displayAlert(java.lang.String message)
          Displays a dialog box that shows an alert message to the user.
static Cache getCache()
          Provides access to the Cache maintained by IDES.
static java.awt.Point getCenteredLocationForDialog(java.awt.Dimension d)
          Suggests the position of the top-left corner for a dialog box with the given dimensions so that it is located in the center of the main window of the application.
static CopyPasteManager getCopyPasteManager()
          Provides access to the cut, copy and paste facility in IDES.
static java.net.URL getIDESResource(java.lang.String name)
          Gets a resource from the IDES JAR file (icons and such).
static IOSubsytem getIOSubsystem()
          Provides access to the IO subsystem of IDES.
static LatexManager getLatexManager()
          Provides access to the LaTeX rendering services in IDES.
static java.net.URL getLocalResource(java.lang.Class<?> context, java.lang.String name)
          Gets a resource from the JAR file of a plugin (icons and such).
static java.awt.Frame getMainWindow()
          Gets the main window of IDES.
static NoticeManager getNoticeManager()
          Provides access to the notice posting services in IDES.
static PersistentProperties getPersistentData()
          Provides access to a list of settings which persist over sessions.
static UndoManager getUndoManager()
          Provides access to the Undo facility in IDES.
static UserInterface getUserInterface()
          Gets the main UI of IDES.
static java.lang.String getUserTextAnnotation(DESModel model)
          Retrieve the user-defined text annotation of the given model.
static Workspace getWorkspace()
          Gets the main workspace.
static void openOptionsPane(java.lang.String title)
          Request that the options dialog box opens up on the screen and shows the options for the OptionsPane with the given title.
static void registerOptionsPane(OptionsPane pane)
          Register an options pane with the options dialog box.
static void setUserTextAnnotation(DESModel model, java.lang.String text)
          Set the user-defined text annotation of the given model.
static void storePersistentData()
          Stores the settings from the list of settings getPersistentData() into the file settings.ini.
static java.lang.String string(java.lang.String key)
          Gets from the resource bundle stringResource the string which corresponds to the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

string

public static java.lang.String string(java.lang.String key)
Gets from the resource bundle stringResource the string which corresponds to the given key. Should be used for any messages and strings to appear in IDES (FIXME: save for the commmands which are managed by an external library?).

Parameters:
key - lookup key for the string
Returns:
the string corresponding to the key
See Also:
stringResource

addResouceBundle

public static void addResouceBundle(java.util.ResourceBundle bundle)
Adds a string resource bundle to the set of bundles which are used to look up strings. Can be used by plugins to add their own string bundles at startup.

Parameters:
bundle - the string resource bundle to be added
See Also:
stringResource, string(String)

getPersistentData

public static PersistentProperties getPersistentData()
Provides access to a list of settings which persist over sessions.

Returns:
the list of persistent settings

storePersistentData

public static void storePersistentData()
Stores the settings from the list of settings getPersistentData() into the file settings.ini. If this fails, it shows a message box to the user.


getMainWindow

public static java.awt.Frame getMainWindow()
Gets the main window of IDES.

Returns:
the main window

getUserInterface

public static UserInterface getUserInterface()
Gets the main UI of IDES.

Returns:
the main UI of IDES

registerOptionsPane

public static void registerOptionsPane(OptionsPane pane)
Register an options pane with the options dialog box. To be called just once per session for each options pane (e.g., when loading IDES or a plugin).

Parameters:
pane - the OptionsPane that will be registered
See Also:
OptionsPane, OptionsWindow

openOptionsPane

public static void openOptionsPane(java.lang.String title)
Request that the options dialog box opens up on the screen and shows the options for the OptionsPane with the given title.

Parameters:
title - the title of the OptionsPane to be displayed
See Also:
OptionsPane, OptionsWindow

displayAlert

public static void displayAlert(java.lang.String message)
Displays a dialog box that shows an alert message to the user. Intended use is to announce errors and problems in an aesthetically-pleasing way.

Parameters:
message - message to be displayed

getCenteredLocationForDialog

public static java.awt.Point getCenteredLocationForDialog(java.awt.Dimension d)
Suggests the position of the top-left corner for a dialog box with the given dimensions so that it is located in the center of the main window of the application.

Parameters:
d - the dimension of the dialog box
Returns:
the suggested position of the top-left corner of the dialog box

getWorkspace

public static Workspace getWorkspace()
Gets the main workspace.

Returns:
the main workspace

getIDESResource

public static java.net.URL getIDESResource(java.lang.String name)
Gets a resource from the IDES JAR file (icons and such).

Parameters:
name - the name of the resource
Returns:
URL that points to the resource

getLocalResource

public static java.net.URL getLocalResource(java.lang.Class<?> context,
                                            java.lang.String name)
Gets a resource from the JAR file of a plugin (icons and such).

Parameters:
context - the context for the local resource (e.g., a class from the plugin)
name - the name of the resource
Returns:
URL that points to the resource

getCache

public static Cache getCache()
Provides access to the Cache maintained by IDES.

Returns:
the Cache maintained by IDES

getLatexManager

public static LatexManager getLatexManager()
Provides access to the LaTeX rendering services in IDES.

Returns:
the IDES LatexManager

getNoticeManager

public static NoticeManager getNoticeManager()
Provides access to the notice posting services in IDES.

Returns:
the IDES NoticeManager

getUndoManager

public static UndoManager getUndoManager()
Provides access to the Undo facility in IDES.

Returns:
the IDES UndoManager

getIOSubsystem

public static IOSubsytem getIOSubsystem()
Provides access to the IO subsystem of IDES.

Returns:
the IDES IO subsystem

getCopyPasteManager

public static CopyPasteManager getCopyPasteManager()
Provides access to the cut, copy and paste facility in IDES.

Returns:
the IDES CopyPasteManager

getUserTextAnnotation

public static java.lang.String getUserTextAnnotation(DESModel model)
Retrieve the user-defined text annotation of the given model. When the model is opened, the text appears in the "Annotations" tab.

Parameters:
model - the model
Returns:
the user-defined text annotation of the given model

setUserTextAnnotation

public static void setUserTextAnnotation(DESModel model,
                                         java.lang.String text)
Set the user-defined text annotation of the given model. When the model is opened, the text appears in the "Annotations" tab.

Parameters:
model - the model
text - the text of the annotation