Class CompareUtil

java.lang.Object
com.nomagic.magicdraw.merge.CompareUtil
Direct Known Subclasses:
MergeUtil

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

    • CompareUtil

      public CompareUtil()
  • Method Details

    • compareProjects

      @CheckForNull public static ProjectDifference compareProjects(Project project, ProjectDescriptor baseProjectDescriptor, ErrorHandler<Exception> errorHandler, Optimization optimization) throws 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:
      IllegalStateException - if merge is not available
    • getDifference

      @CheckForNull public static ProjectDifference getDifference(Project targetProject, ProjectDescriptor source, @CheckForNull ProjectDescriptor ancestor, ErrorHandler<Exception> errorHandler, Optimization optimization) throws 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:
      IllegalStateException - if merge is not available
    • getDifference

      @Deprecated(since="2022xRefresh2", forRemoval=true) @CheckForNull public static ProjectDifference getDifference(Project targetProject, ProjectDescriptor source, @CheckForNull ProjectDescriptor ancestor, ErrorHandler<Exception> errorHandler, Optimization optimization, @CheckForNull Set<ModuleInfo> modules) throws IllegalStateException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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 - (deprecated - it has no effect in Teamwork Cloud) request modules for read-write merge mode. Restriction/constraints apply for read-write module merge mode.
      Returns:
      project difference.
      Throws:
      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 IllegalStateException
      Show project difference GUI.
      Parameters:
      projectDifference - project difference.
      Throws:
      IllegalStateException - if diff is not available