コード例 #1
0
 /** {@inheritDoc} */
 public void postLoad(DAnalysis dAnalysis, Version loadedVersion) {
   super.postLoad(dAnalysis, loadedVersion);
   if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) {
     deleteOldMigrationAnnotations(dAnalysis);
   }
 }
  /** {@inheritDoc} */
  @Override
  public void postLoad(DAnalysis dAnalysis, Version loadedVersion) {
    super.postLoad(dAnalysis, loadedVersion);
    if (loadedVersion.compareTo(
            DiagramRepresentationsFileMigrationParticipantV650.MIGRATION_VERSION)
        < 0) {
      List<Diagram> diagramsToMove =
          DiagramRepresentationsFileMigrationParticipantV650.getDiagramsAtRoot(dAnalysis);
      if (!diagramsToMove.isEmpty()) {
        // Move GMF diagrams from root of the resource to eAnnotation in
        // corresponding DDiagram, and then launch old migrations that
        // haven't been launched on this diagrams.
        new DiagramRepresentationsFileMigrationParticipantV650()
            .moveGMFDiagramsFromRoot(dAnalysis, diagramsToMove);
      }
    }

    if (loadedVersion.compareTo(
            DiagramRepresentationsFileMigrationParticipantV670.MIGRATION_VERSION)
        < 0) {
      // The 6.5.3 maintenance version already contains the migration,
      // migration should be done for versions in
      // [0.0.0, 6.5.3[ U [6.6.0, 6.7.0[.
      if (loadedVersion.compareTo(ALREADY_MIGRATED_VERSION) < 0
          || loadedVersion.compareTo(NOT_MIGRATED_VERSION) >= 0) {
        List<Diagram> diagrams = getGMFDiagrams(dAnalysis);
        if (!diagrams.isEmpty()) {
          DiagramRepresentationsFileMigrationParticipantV670
              diagramRepresentationsFileMigrationParticipantV670 =
                  new DiagramRepresentationsFileMigrationParticipantV670();
          diagramRepresentationsFileMigrationParticipantV670
              .migrateLabelConstraintFromBoundsToLocation(diagrams);
          diagramRepresentationsFileMigrationParticipantV670.migrateGMFBoundsOfBorderedNodes(
              diagrams);
        }
      }
    }
    if (loadedVersion.compareTo(
            DiagramRepresentationsFileMigrationParticipantV680.MIGRATION_VERSION)
        < 0) {
      List<Diagram> diagrams = getGMFDiagrams(dAnalysis);
      if (!diagrams.isEmpty()) {
        DiagramRepresentationsFileMigrationParticipantV680
            diagramRepresentationsFileMigrationParticipantV680 =
                new DiagramRepresentationsFileMigrationParticipantV680();
        diagramRepresentationsFileMigrationParticipantV680.migrateCompartmentsWithLayoutConstraints(
            diagrams);
        diagramRepresentationsFileMigrationParticipantV680.migrateEdgeLabelLocationToBounds(
            diagrams);
      }
    }
    if (loadedVersion.compareTo(
            DiagramRepresentationsFileMigrationParticipantV690.MIGRATION_VERSION)
        < 0) {
      List<Diagram> diagrams = getGMFDiagrams(dAnalysis);
      DiagramRepresentationsFileMigrationParticipantV690
          diagramRepresentationsFileMigrationParticipantV690 =
              new DiagramRepresentationsFileMigrationParticipantV690();
      diagramRepresentationsFileMigrationParticipantV690.migrateEdgeRoutingStyle(
          getGMFDiagrams(dAnalysis));
      diagramRepresentationsFileMigrationParticipantV690
          .migrateVisibilityInconsistenciesBetweenGMFNodeAndDDiagramElement(diagrams);
    }

    // This migration has been introduced in Sirius 1.0.0M6 and in several
    // maintenance versions anterior to Sirius. For a complexity reason and
    // the fact that migration can be re-apply safely, we do not verify each
    // version for which this migration has already been applied.
    if (loadedVersion.compareTo(
            DiagramRepresentationsFileMigrationParticipantV801.MIGRATION_VERSION)
        < 0) {
      List<Diagram> diagrams = getGMFDiagrams(dAnalysis);
      if (!diagrams.isEmpty()) {
        new DiagramRepresentationsFileMigrationParticipantV801()
            .migrateLabelVisibilityInconsistency(diagrams);
      }
    }
  }