Class BaseEmfUml2XmiPlugin

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  com.nomagic.magicdraw.emfuml2xmi.BaseEmfUml2XmiPlugin.EclipseUml2XmiFileLoader  
      private class  com.nomagic.magicdraw.emfuml2xmi.BaseEmfUml2XmiPlugin.ImportRunnable  
      private static class  com.nomagic.magicdraw.emfuml2xmi.BaseEmfUml2XmiPlugin.MenuConfigurator
      Menu configurator, increases priority according the version.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseEmfUml2XmiPlugin​(int version, java.lang.String format, java.lang.String optionsGroupId, java.lang.String extension, java.util.List<com.nomagic.xml.Namespace> supportedUmlNamespaces, java.lang.String resourceJarRelativePath, java.lang.String externalToolExportXmiActionId)  
    • Field Detail

      • OPTIONS_DIR_PATH

        private static final java.lang.String OPTIONS_DIR_PATH
        See Also:
        Constant Field Values
      • ALL_KNOWN_UML_URIS

        private static final java.util.List<java.lang.String> ALL_KNOWN_UML_URIS
      • mVersion

        private final int mVersion
        Plugin version used to sort menu actions according plugin version
      • mFormat

        private final java.lang.String mFormat
      • mOptionsGroupId

        private final java.lang.String mOptionsGroupId
      • mExtension

        private final java.lang.String mExtension
      • mSupportedUmlNamespaces

        private final java.util.List<com.nomagic.xml.Namespace> mSupportedUmlNamespaces
      • mSupportedUmlUris

        private final java.util.Set<java.lang.String> mSupportedUmlUris
      • mResourceJarRelativePath

        private final java.lang.String mResourceJarRelativePath
      • mExternalToolExportXmiActionId

        private final java.lang.String mExternalToolExportXmiActionId
      • mOptionsDir

        private java.lang.String mOptionsDir
      • mResourcesJarPath

        private java.lang.String mResourcesJarPath
    • Constructor Detail

      • BaseEmfUml2XmiPlugin

        protected BaseEmfUml2XmiPlugin​(int version,
                                       java.lang.String format,
                                       java.lang.String optionsGroupId,
                                       java.lang.String extension,
                                       java.util.List<com.nomagic.xml.Namespace> supportedUmlNamespaces,
                                       java.lang.String resourceJarRelativePath,
                                       java.lang.String externalToolExportXmiActionId)
    • Method Detail

      • init

        public void init()
        Description copied from class: Plugin
        Plugin initialization method. Every plugin must override this method and do any action related to plugin initialization. For example registers actions configurators to MagicDraw application. This method is called by MagicDraw application during MagicDraw startup.
        Specified by:
        init in class Plugin
      • getFormat

        public final java.lang.String getFormat()
        Returns Eclipse UML2 XMI format supported by plugin.
        Returns:
        Eclipse UML2 XMI format.
      • getFileExtension

        public final java.lang.String getFileExtension()
      • getOptionsGroupID

        public final java.lang.String getOptionsGroupID()
        Returns plugin'e environment options group id.
        Returns:
        options group id.
      • createExporter

        protected abstract com.nomagic.magicdraw.emfuml2xmi.export.BaseEmfUml2Exporter createExporter​(java.lang.String format,
                                                                                                      java.lang.String optionsGroupID)
      • createImporter

        protected abstract com.nomagic.magicdraw.emfuml2xmi.imp0rt.BaseEmfUml2Importer createImporter​(java.lang.String format,
                                                                                                      java.lang.String optionsGroupID)
      • createCleaner

        protected abstract com.nomagic.magicdraw.emfuml2xmi.helpers.BaseEmfUml2Cleaner createCleaner()
      • createOptionsGroup

        protected abstract BaseEmfOptionsGroup createOptionsGroup​(java.lang.String id,
                                                                  java.lang.String format)
      • createCommandLineExporterAction

        protected abstract com.nomagic.magicdraw.emfuml2xmi.export.commandline.BaseEclipseUml2CommandLineExporterAction createCommandLineExporterAction()
      • exportXMI

        @OpenApi
        public void exportXMI​(Project project,
                              java.lang.String destinationDir)
                       throws java.lang.Exception
        Exports given project to Eclipse UML2 XMI
        Parameters:
        project - project to export
        destinationDir - destination directory
        Throws:
        java.lang.Exception
      • exportXMI

        @OpenApi
        public void exportXMI​(Project project,
                              java.lang.String destinationDir,
                              ProgressStatus progressStatus)
                       throws java.lang.Exception
        Exports given project to Eclipse UML2 XMI
        Parameters:
        project - project to export
        destinationDir - destination directory
        progressStatus - export progress status
        Throws:
        java.lang.Exception
      • exportModel

        @OpenApi
        public java.util.Map exportModel​(Project project)
                                  throws java.lang.Exception
        Exports given project to Eclipse UML2 Model
        Parameters:
        project - project to export
        Returns:
        map of exported model (MagicDraw model (or profile) -> Eclipse UML2 model (or profile))
        Throws:
        java.lang.Exception
      • disposeModel

        @OpenApi
        public void disposeModel​(java.util.Collection elements)
        Disposes given elements.
        Parameters:
        elements - collection of Eclipse UML2 element.
      • exportXMI

        private void exportXMI​(Project project,
                               java.lang.String destinationDir,
                               ProgressStatus progress,
                               com.nomagic.magicdraw.emfuml2xmi.export.OverwriteChecker overwriteChecker)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • imp0rt

        @OpenApi
        public void imp0rt​(java.lang.String file)
        Imports (opens) given Eclipse UML2 XMI
        Parameters:
        file - Eclipse UML2 XMI file path
      • addMainMenuConfigurator

        private void addMainMenuConfigurator​(java.lang.String categoryId,
                                             java.lang.String eclipseUml2CategoryId,
                                             MDAction action)
      • getResourceJar

        private static java.io.File getResourceJar​(java.io.File pluginDirectory,
                                                   java.lang.String resourceJarName)
        Get resource jar.
        Parameters:
        pluginDirectory - plugin directory.
        resourceJarName - resource jar name.
        Returns:
        resource jar file.
      • getFileFromSource

        private static java.io.File getFileFromSource​(java.io.File pluginDirectory,
                                                      java.lang.String resourceJarRelativePath)
      • getSilentOverwrite

        private static com.nomagic.magicdraw.emfuml2xmi.export.OverwriteChecker getSilentOverwrite()
      • createExportAction

        private com.nomagic.magicdraw.emfuml2xmi.export.ExportEmfUml2XmiAction createExportAction()
      • createImportAction

        private MDAction createImportAction()
      • close

        public boolean close()
        Description copied from class: Plugin
        MagicDraw calls this method before exiting the application. If at least one plugin returns 'false', MagicDraw application will not exit. Override this method and do any exit specific action(your plugin state saving and etc).
        Specified by:
        close in class Plugin
        Returns:
        true, if plugin can be closed normally; false, if plugin cannot be closed and MagicDraw application can not exit.
      • isSupported

        public boolean isSupported()
        Description copied from class: Plugin
        MagicDraw calls this method to identify if this plugin is supported. Plugin is initialized and started only if this method returns true. Override this method to check specific conditions for the plugin supportability.
        Specified by:
        isSupported in class Plugin
        Returns:
        true, if plugin is supported; false, if plugin is not supported.
      • createUniqueProject

        private static Project createUniqueProject​(java.lang.String absolutePath,
                                                   java.lang.String extension,
                                                   boolean newThread)
      • createProject

        private static Project createProject​(java.lang.String projectName,
                                             boolean newThread)
      • isImportSupported

        private static boolean isImportSupported()
      • getResourcesJarPath

        public final java.lang.String getResourcesJarPath()
      • getOptionsDir

        public final java.lang.String getOptionsDir()
      • getSupportedUmlUris

        public final java.util.Set<java.lang.String> getSupportedUmlUris()
      • createExporter

        private com.nomagic.magicdraw.emfuml2xmi.export.BaseEmfUml2Exporter createExporter()
      • imp0rt

        @CheckForNull
        private Project imp0rt​(java.io.File file)