com.togethersoft.openapi.ide
Interface IdeManager


public interface IdeManager

Interface IdeManager provides the entire IDE's fuctionality.

This interface supplies methods relating to the overall IDE functionality, such as saving the opened files or starting a new process.

IdeManager provides a convenient mechanism for retrieving additional information about the result of certain actions. This information is stored in the IdeErrorInfo object accessible through the setErrorInfo and performCheck methods.

Current IdeManager can be obtained via static IdeManagerAccess.getManager method:


 IdeManager manager = IdeManagerAccess.getManager();

Author:
TogetherSoft
See Also: IdeAccess, performCheck(com.togethersoft.openapi.ide.IdeErrorCheck), setErrorInfo(com.togethersoft.openapi.ide.IdeErrorInfo)

Method Summary
 voidaddCommandAndWait(Runnable command)
           Adds ceratin command to the commands queue and waits while this command is not executed.
 voidaddCommandToQueue(Runnable command)
           Adds specified command to the commands queue.
 voidaddCommandToQueue(Runnable command, String name)
           Adds specified command, identified by it's name, to the commands queue.
 StringbuildDiagramURL(RwiDiagram diagram, RwiElement element)
           Creates URL of a specific kind referring to the specified element of the diagram.
 StringbuildEditorURL(String url, TextPosition position)
           Produces URL of a specific kind, referring to the position in a certain file.
 StringbuildEditorURL(String url, int offset)
           Produces URL of a specific kind, referring to the offset in a certain file.
 Processexec(String command)
           Executes specified command in a separate process.
 Processexec(String command, String fileForOut)
           Executes the specified command in a separate process, with the specifed output file.
 StringexpandMacros(IdeContext context, String command)
           Replaces macros in command with the corresponding values.
 String[]getArguments()
           Returns the list of arguments passed to 'main' method.
 StringgetHomeDirectory()
           Returns fully qualified path of Together's root directory.
 StringgetModuleHomeDirectory(Class moduleClass)
           Returns home folder for the module, defined by it's class.
 StringgetTempFile()
           Returns the name of a temporary file.
 LocalegetUILocale()
           Returns a locale object for the Together's User Interface.
 booleanisGUIEnabled()
           Checks if Together works in GUI or in a command line mode.
 booleanisModuleActive(String moduleClassName)
           Checks the state of the specified activatable module.
 booleanisModuleServiceAvailable(String serviceName)
           Returns true if the service with the specified name is declared by loaded module, false otherwise.
 voidnavigateByURL(String url)
           Opens specified internal URL if its associated handler is visible on the screen.
 voidopenHelp(String url)
           Opens help reffered to by the specified URL.
 voidopenURL(String url)
           Opens specified URL (Universe Resource Locator).
 IdeErrorInfoperformCheck(IdeErrorCheck check)
           Calls run() method of the specified IdeErrorCheck object and returns IdeErrorInfo containing the information about possible errors that occurred.
 voidprintStatus(String text)
           Displays the specified string in the status bar.
 voidsaveAll()
           Saves all opened files which were changed by Together.
 voidsetErrorInfo(IdeErrorInfo info)
           Sets specified result of certain actions.
 voidshowHelp(String targetID, boolean openInDialog, Component parent)
           Opens help with JavaHelp reffered to by the specified targetID, in the specified frame.
 voidshowHelp(java.net.URL url, boolean openInDialog, Component parent)
           Opens help with JavaHelp reffered to by the specified URL.
 voidsynchronize()
           If the data of the opened files change on the disk, automatically reloads these files.

Method Detail

addCommandAndWait

public void addCommandAndWait(Runnable command)
Adds ceratin command to the commands queue and waits while this command is not executed.
Parameters:
command - Runnable object to be added to the queue

addCommandToQueue

public void addCommandToQueue(Runnable command)
Adds specified command to the commands queue.
Parameters:
command - Runnable object to be added to the queue

addCommandToQueue

public void addCommandToQueue(Runnable command, String name)
Adds specified command, identified by it's name, to the commands queue.
Parameters:
command - Runnable object to be added to the queue
name - String name of this command

buildDiagramURL

public String buildDiagramURL(RwiDiagram diagram, RwiElement element)
Creates URL of a specific kind referring to the specified element of the diagram.
Parameters:
diagram - RwiDiagram where this element is located
element - RwiElement object representing the target element
Returns: String URL that contains information about the position of the specified element

buildEditorURL

public String buildEditorURL(String url, TextPosition position)
Produces URL of a specific kind, referring to the position in a certain file. If this file can be opened in the editor, returns URL of the position in this file; otherwise returns initial URL.
Parameters:
url - String URL of a file
position - TextPosition instance
Returns: String URL that contains information about the position in this file, if this file can be opned in the editor; String initial URL otherwise
See Also:
buildEditorURL(java.lang.String,int)

buildEditorURL

public String buildEditorURL(String url, int offset)
Produces URL of a specific kind, referring to the offset in a certain file. If this file can be opened in the editor, returns URL of the position in this file; otherwise returns initial URL.
Parameters:
url - String URL of a file
position - int offset in the file
Returns: String URL that contains information about the position in this file, if this file can be opned in the editor; String initial URL otherwise
See Also:
buildEditorURL(java.lang.String,com.togethersoft.openapi.util.text.TextPosition)

exec

public Process exec(String command)
Executes specified command in a separate process.
Parameters:
command - String system command to be executed
Returns: Process object for managing the subprocess

exec

public Process exec(String command, String fileForOut)
Executes the specified command in a separate process, with the specifed output file.
Parameters:
command - String system command to be executed
fileForOut - String name of the output file of this process
Returns: Process object for managing the subprocess

expandMacros

public String expandMacros(IdeContext context, String command)
Replaces macros in command with the corresponding values. See external tools guide for supported macro set.
Parameters:
context - IdeContext object that represents the Context (e.g. current selection) to be used by the macros. Some macros need non-global information (class, file, etc.) to execute. If null is passed, only those macros that do not require this information can be executed
command - String Source for macro substitution
Returns: null if some macros cannot be executed, or String command with macros replaced with the corresponding values, if all macros where successfully processed.

getArguments

public String[] getArguments()
Returns the list of arguments passed to 'main' method.
Returns: String array with arguments

getHomeDirectory

public String getHomeDirectory()
Returns fully qualified path of Together's root directory. For example, if Together is installed in C:\Cases\Together, then this method will return "C:\Cases\Together".
Returns: String fully qualified path of Together's root directory

getModuleHomeDirectory

public String getModuleHomeDirectory(Class moduleClass)
Returns home folder for the module, defined by it's class.
Parameters:
module - Class
Returns: String home folder for this module

getTempFile

public String getTempFile()
Returns the name of a temporary file.
Returns: String name of not existing temporary file

getUILocale

public Locale getUILocale()
Returns a locale object for the Together's User Interface.
Returns: Locale object for the Together's User Interface

isGUIEnabled

public boolean isGUIEnabled()
Checks if Together works in GUI or in a command line mode. Together may perform many useful tasks in the command-line mode. In this case GUI is not shown. Modules should coordinate own GUI with this setting.
Returns: true if it is allowed to display GUI

isModuleActive

public boolean isModuleActive(String moduleClassName)
Checks the state of the specified activatable module. Returns true if activatable module is active.
Parameters:
moduleClassName - String name of the activatable module class
Returns: true if module is activated, false otherwise

isModuleServiceAvailable

public boolean isModuleServiceAvailable(String serviceName)
Returns true if the service with the specified name is declared by loaded module, false otherwise.
Parameters:
serviceName - String name of the service to be checked
Returns: true if this service is available, false otherwise.

navigateByURL

public void navigateByURL(String url)
Opens specified internal URL if its associated handler is visible on the screen.

For example, for an URL to a diagram Together will open that diagram only if the diagram pane is visible on the screen. For an URL to a file Together will open this file in the text editor only if the editor pane is visible on the screen.

Parameters:
url - String internal URL (an URL to a diagram, file etc)
See Also:
openURL(java.lang.String)

openHelp

public void openHelp(String url)
Opens help reffered to by the specified URL. "Open" means that IDE will handle specified URL corresponding to its protocol's type. For example, for the http protocol IDE will show the help reffered to by the URL.
Parameters:
url - the string with URL

openURL

public void openURL(String url)
Opens specified URL (Universe Resource Locator).

"Open" means that IDE will handle specified URL in accordance with its protocol's type. For example, for the http protocol IDE will show the data reffered to by the URL in the default browser.

The URL's handler will be focused. For example, for an http address Together will focus the browser, for internal URL (to a file, diagram etc.) it will focus the corresponding pane.

Parameters:
url - String URL
See Also:
navigateByURL(java.lang.String)

performCheck

public IdeErrorInfo performCheck(IdeErrorCheck check)
Calls run() method of the specified IdeErrorCheck object and returns IdeErrorInfo containing the information about possible errors that occurred.
Parameters:
check - IdeErrorCheck instance whose run method will be called
Returns: IdeErrorInfo
See Also:
IdeErrorCheck, IdeErrorInfo

printStatus

public void printStatus(String text)
Displays the specified string in the status bar.
Parameters:
text - String to be displayed

saveAll

public void saveAll()
Saves all opened files which were changed by Together.
See Also:
synchronize()

setErrorInfo

public void setErrorInfo(IdeErrorInfo info)
Sets specified result of certain actions. As there is only one IdeErrorInfo object that stores errors information, this method overwrites the previous IdeErrorInfo value.
Parameters:
info - IdeErrorInfo instance that stores error details
See Also:
IdeErrorInfo, performCheck(com.togethersoft.openapi.ide.IdeErrorCheck)

showHelp

public void showHelp(String targetID, boolean openInDialog, Component parent)
Opens help with JavaHelp reffered to by the specified targetID, in the specified frame.
Parameters:
targetID - String ID defined in the help map file
openInDialog - boolean flag that defines where this help is diaplayed. If true, shows help in the modal dialog, otherwise in the frame. If this method is invoked from a modal dialog set this parameter to true.
parent - Cmoopnent dialog where the help was invoked. Should not be null if openInDialog = true

showHelp

public void showHelp(java.net.URL url, boolean openInDialog, Component parent)
Opens help with JavaHelp reffered to by the specified URL.
Parameters:
url - String URL
openInDialog - boolean flag that defines where this help is diaplayed. If true, shows help in the modal dialog, otherwise in the frame. If this method is invoked from a modal dialog set this parameter to true.
parent - Cmoopnent dialog where the help was invoked. Should not be null if openInDialog = true

synchronize

public void synchronize()
If the data of the opened files change on the disk, automatically reloads these files.