Class Application


  • @OpenApi
    public class Application
    extends java.lang.Object
    Main class which connects main parts of MagicDraw. This class is singleton, only one instance of this class can exist.
    • Constructor Detail

      • Application

        @OpenApi
        protected Application()
        Constructor of Application.
    • Method Detail

      • loadAliases

        @OpenApi
        public void loadAliases()
                         throws java.lang.Exception
        Loads 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​(boolean visible,
                          boolean silentMode,
                          boolean tryToLoadProject,
                          java.lang.String[] args,
                          @CheckForNull
                          StartupParticipant participant)
                   throws ApplicationExitedException
        Starts 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.
      • 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.