Class CompareUtil

  • Direct Known Subclasses:
    MergeUtil

    @OpenApiAll
    public class CompareUtil
    extends java.lang.Object
    Allows using MagicDraw project merge core to compare projects (find project differences). See Open API manual for the usage details.
    • Constructor Detail

      • CompareUtil

        public CompareUtil()
    • Method Detail

      • compareProjects

        @CheckForNull
        public static ProjectDifference compareProjects​(Project project,
                                                        ProjectDescriptor baseProjectDescriptor,
                                                        ErrorHandler<java.lang.Exception> errorHandler,
                                                        Optimization optimization)
                                                 throws java.lang.IllegalStateException
        Compare projects. On success project difference is returned and the base project is active project.
        Parameters:
        project - target project.
        baseProjectDescriptor - source project descriptor.
        errorHandler - invoked if error occurs. Allows to perform custom action.
        optimization - optimization option.`
        Returns:
        project difference.
        Throws:
        java.lang.IllegalStateException - if merge is not available
      • getDifference

        @CheckForNull
        public static ProjectDifference getDifference​(Project targetProject,
                                                      ProjectDescriptor source,
                                                      @CheckForNull
                                                      ProjectDescriptor ancestor,
                                                      ErrorHandler<java.lang.Exception> errorHandler,
                                                      Optimization optimization)
                                               throws java.lang.IllegalStateException
        Discover project difference. On success project difference is returned and ancestor project is active project.
        Parameters:
        targetProject - target project.
        source - source project descriptor.
        ancestor - ancestor project descriptor. Used only for 3-way merge, null for 2-way merge.
        errorHandler - invoked if error occurs. Allows to perform custom action.
        optimization - optimization option.
        Returns:
        project difference.
        Throws:
        java.lang.IllegalStateException - if merge is not available
      • getDifference

        @CheckForNull
        public static ProjectDifference getDifference​(Project targetProject,
                                                      ProjectDescriptor source,
                                                      @CheckForNull
                                                      ProjectDescriptor ancestor,
                                                      ErrorHandler<java.lang.Exception> errorHandler,
                                                      Optimization optimization,
                                                      @CheckForNull
                                                      java.util.Set<ModuleInfo> modules)
                                               throws java.lang.IllegalStateException
        Discover project difference. On success project difference is returned and ancestor project is active project.
        Parameters:
        targetProject - target project.
        source - source project descriptor.
        ancestor - ancestor project descriptor. Used only for 3-way merge, null for 2-way merge.
        errorHandler - invoked if error occurs. Allows to perform custom action.
        optimization - optimization option.
        modules - request modules for read-write merge mode. Restriction/constraints apply for read-write module merge mode. Invoke ProjectDifference.getRejectedModules() to find out which modules did not qualify for read-write merge mode.
        Returns:
        project difference.
        Throws:
        java.lang.IllegalStateException - if merge is not available
      • restore

        public static void restore​(ProjectDifference difference)
        Dispose project difference.
        Parameters:
        difference - project difference.
      • showDifferenceGUI

        public static void showDifferenceGUI​(ProjectDifference projectDifference)
                                      throws java.lang.IllegalStateException
        Show project difference GUI.
        Parameters:
        projectDifference - project difference.
        Throws:
        java.lang.IllegalStateException - if diff is not available