Package com.nomagic.magicdraw.core
Class Application
- java.lang.Object
-
- com.nomagic.magicdraw.core.Application
-
@OpenApi public class Application extends java.lang.ObjectMain class which connects main parts of MagicDraw. This class is singleton, only one instance of this class can exist.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classApplication.EnvironmentContains application environment specific constants and utility methods.static classApplication.RuntimeContains application runtime related constants and utility methods.
-
Constructor Summary
Constructors Modifier Constructor Description protectedApplication()Constructor of Application.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActivityAfterStartup(java.lang.Runnable activity)Registered runnable is executed right after MagicDraw application startup.voidaddNewDiagramType(DiagramDescriptor descriptor)Registers new diagram type in the MagicDraw application.voidaddProjectEventListener(ProjectEventListener listener)Method adds new ProjectEventListener.voidaddSaveParticipant(SaveParticipant participant)Registers SaveParticipant for custom actions on project saving.static Application.Environmentenvironment()Gets application environment.CookieSetgetCookieSet()Returns cookie set of the application.EnvironmentOptionsgetEnvironmentOptions()Gets application environment options.GUILoggetGUILog()Returns the interface to log window.static ApplicationgetInstance()Returns single instance of Application.MainFramegetMainFrame()Returns the mainFrame - main MagicDraw GUI component.ProjectgetProject()Returns current active Project.ProjectsManagergetProjectsManager()Returns the projectsManager.java.util.List<SaveParticipant>getSaveParticipants()List of registered SaveParticipants.booleanisTryToLoadProject()Checks if it is allowed to load project on startup.voidloadAliases()Loads alias.properties file into memory.voidremoveProjectEventListener(ProjectEventListener listener)Method removes ProjectEventListener.voidremoveSaveParticipant(SaveParticipant participant)Unregister custom SaveParticipant.static Application.Runtimeruntime()Gets application runtime.voidsetApplicationName(java.lang.String name)Set the name of the application.voidshutdown()Shutdowns the application.voidstart(boolean visible, boolean silentMode, boolean tryToLoadProject, java.lang.String[] args, StartupParticipant participant)Starts the application.voidstart(java.lang.String[] args)Starts the application.
-
-
-
Method Detail
-
loadAliases
@OpenApi public void loadAliases() throws java.lang.ExceptionLoads alias.properties file into memory. If alias were already loaded reload it.- Throws:
java.lang.Exception- in case of some error
-
getEnvironmentOptions
@OpenApi public EnvironmentOptions getEnvironmentOptions()
Gets application environment options.- Returns:
- application environment options.
-
getInstance
@OpenApi public static Application getInstance()
Returns single instance of Application.- Returns:
- single instance of Application.
-
getProject
@CheckForNull @OpenApi public Project getProject()
Returns current active Project.- Returns:
- current project, null if there is no current project.
-
getProjectsManager
@OpenApi public ProjectsManager getProjectsManager()
Returns the projectsManager.- Returns:
- ProjectsManager
-
getMainFrame
@OpenApi public MainFrame getMainFrame()
Returns the mainFrame - main MagicDraw GUI component.- Returns:
- MainFrame
-
setApplicationName
@OpenApi public void setApplicationName(java.lang.String name)
Set the name of the application.- Parameters:
name- application name
-
start
@OpenApi public void start(java.lang.String[] args) throws ApplicationExitedExceptionStarts the application.- Parameters:
args- command line arguments passed to MagicDraw.- Throws:
ApplicationExitedException- in case of some error
-
start
@OpenApi public void start(boolean visible, boolean silentMode, boolean tryToLoadProject, java.lang.String[] args, @CheckForNull StartupParticipant participant) throws ApplicationExitedExceptionStarts the application.- Parameters:
visible- start MagicDraw as visible frame?silentMode- true if GUI must be in silent mode(batch mode).tryToLoadProject- true if application should try to load file passed as argument.args- command line arguments passed to MagicDraw.participant- the participant of startup process. May be null.- Throws:
ApplicationExitedException- if application exists during the startup.
-
shutdown
@OpenApi public void shutdown() throws ApplicationExitedExceptionShutdowns the application. User will be asked to save all opened projects before exiting the application.- Throws:
ApplicationExitedException- in case of some error
-
getGUILog
@OpenApi public GUILog getGUILog()
Returns the interface to log window.- Returns:
- window for writing messages.
-
addProjectEventListener
@OpenApi public final void addProjectEventListener(ProjectEventListener listener)
Method adds new ProjectEventListener.- Parameters:
listener- listener to be added.
-
removeProjectEventListener
@OpenApi public void removeProjectEventListener(ProjectEventListener listener)
Method removes ProjectEventListener.- Parameters:
listener- to be removed.
-
addActivityAfterStartup
@OpenApi public void addActivityAfterStartup(java.lang.Runnable activity)
Registered runnable is executed right after MagicDraw application startup.- Parameters:
activity- runnable to execute.
-
getCookieSet
@OpenApi public final CookieSet getCookieSet()
Returns cookie set of the application.
This cookie set may be used for example to replace standard application CloseCookie with some other.
The example:
CookieSet set = application.getCookieSet();
CloseCookie newCloseCookie = ...;
CloseCookie close = (CloseCookie) set.getCookie(CloseCookie.class);
set.remove(close);
set.add(newCloseCookie);- Returns:
- cookie set of the application.
-
addNewDiagramType
@OpenApi public void addNewDiagramType(DiagramDescriptor descriptor)
Registers new diagram type in the MagicDraw application.- Parameters:
descriptor- descriptor of the new diagram.
-
getSaveParticipants
@OpenApi public java.util.List<SaveParticipant> getSaveParticipants()
List of registered SaveParticipants.- Returns:
- list of registered Save Participants.
-
addSaveParticipant
@OpenApi public void addSaveParticipant(SaveParticipant participant)
Registers SaveParticipant for custom actions on project saving.- Parameters:
participant- the custom SaveParticipant.
-
removeSaveParticipant
@OpenApi public void removeSaveParticipant(SaveParticipant participant)
Unregister custom SaveParticipant.- Parameters:
participant- the custom SaveParticipant.
-
isTryToLoadProject
@OpenApi public boolean isTryToLoadProject()
Checks if it is allowed to load project on startup. Under integrations loading may cause deadlock and is disabled.- Returns:
- true if project may be loaded on application startup.
-
runtime
@OpenApi public static Application.Runtime runtime()
Gets application runtime.- Returns:
- application runtime.
-
environment
@OpenApi public static Application.Environment environment()
Gets application environment.- Returns:
- application environment.
-
-