Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2018-09-17 12:36:38 -0400
committerPatrick Tessier2018-09-24 04:43:27 -0400
commit01085f6167ea8690cbdfa982f203708b543f604b (patch)
tree48b77e38162e9be08b8dba8e5ccd33b6f5e1696d /plugins
parent0ca6d11883244da61c4bda6fd2147e7067d878ee (diff)
downloadorg.eclipse.papyrus-01085f6167ea8690cbdfa982f203708b543f604b.tar.gz
org.eclipse.papyrus-01085f6167ea8690cbdfa982f203708b543f604b.tar.xz
org.eclipse.papyrus-01085f6167ea8690cbdfa982f203708b543f604b.zip
Bug 539160 - [Toolsmiths][ProfileMigrationTool] This tool detect a
change when we move an element in the same element Change-Id: Ib02f9e0896905fb1dfa6e8edb0bfd79947b9893a Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/META-INF/MANIFEST.MF2
-rw-r--r--plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/pom.xml2
-rw-r--r--plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/enumeration/MoveEnumerationLiteralFromEnumerationMigrator.java12
-rw-r--r--plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/packages/MovePackageMigrator.java25
-rw-r--r--plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/profile/MoveProfileMigrator.java24
5 files changed, 37 insertions, 28 deletions
diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/META-INF/MANIFEST.MF b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/META-INF/MANIFEST.MF
index a5e47869a61..3822e547046 100644
--- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/META-INF/MANIFEST.MF
+++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.toolsmiths.profilemigration;singleton:=true
-Bundle-Version: 0.7.103.qualifier
+Bundle-Version: 0.7.200.qualifier
Bundle-ClassPath: .
Require-Bundle: org.eclipse.ui,
com.google.guava;bundle-version="21.0.0",
diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/pom.xml b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/pom.xml
index 76a5de42bbd..a2b3afcced7 100644
--- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/pom.xml
+++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.toolsmiths.profilemigration</artifactId>
- <version>0.7.103-SNAPSHOT</version>
+ <version>0.7.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/enumeration/MoveEnumerationLiteralFromEnumerationMigrator.java b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/enumeration/MoveEnumerationLiteralFromEnumerationMigrator.java
index 669a08ccb4e..7cb95d79504 100644
--- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/enumeration/MoveEnumerationLiteralFromEnumerationMigrator.java
+++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/enumeration/MoveEnumerationLiteralFromEnumerationMigrator.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
+ * Copyright (c) 2017, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 539160
*
*****************************************************************************/
package org.eclipse.papyrus.toolsmiths.profilemigration.internal.migrators.atomic.enumeration;
@@ -50,6 +51,7 @@ public class MoveEnumerationLiteralFromEnumerationMigrator extends DeleteEnumera
* 1] the treeNode is a moved node
* 2] the moved element is a EnumerationLiteral
* 3] the new container is in the currently profile use for the migration
+ * 4] the new container is different to the current container
*
* @param treeNode
* @return true if the treeNode represent the current change
@@ -58,7 +60,7 @@ public class MoveEnumerationLiteralFromEnumerationMigrator extends DeleteEnumera
if (TreeNodeUtils.isMoveChange(treeNode)) {
Object element = TreeNodeUtils.getMovedElement(treeNode);
EObject oldContainer = TreeNodeUtils.getMovedSourceContainer(treeNode, MigratorProfileApplication.comparison);
- if (element instanceof EnumerationLiteral && oldContainer != null && oldContainer instanceof Enumeration) {
+ if (element instanceof EnumerationLiteral && oldContainer != null && oldContainer instanceof Enumeration && oldContainer != ((EnumerationLiteral) element).getOwner()) {
if (TreeNodeUtils.getNearestProfile(treeNode) == MigratorProfileApplication.appliedProfile) {
return true;
}
@@ -80,7 +82,7 @@ public class MoveEnumerationLiteralFromEnumerationMigrator extends DeleteEnumera
/**
* Get the new container of the element
- *
+ *
* @return the new container of the element
*/
@Override
@@ -90,7 +92,7 @@ public class MoveEnumerationLiteralFromEnumerationMigrator extends DeleteEnumera
/**
* Get the old container of the element (before the move)
- *
+ *
* @return the old container of the element
*/
@Override
@@ -111,7 +113,7 @@ public class MoveEnumerationLiteralFromEnumerationMigrator extends DeleteEnumera
/**
* Get the moved element
- *
+ *
* @return the moved element
*/
@Override
diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/packages/MovePackageMigrator.java b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/packages/MovePackageMigrator.java
index 24165d63410..53f072879d6 100644
--- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/packages/MovePackageMigrator.java
+++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/packages/MovePackageMigrator.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
+ * Copyright (c) 2017, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 539160
*
*****************************************************************************/
package org.eclipse.papyrus.toolsmiths.profilemigration.internal.migrators.atomic.packages;
@@ -39,7 +40,7 @@ import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
/**
- *
+ *
* If a package is moved to another profile then the migration tool shall focus
* on the preservation of the stereotype applications available at the profiled model.
*
@@ -50,7 +51,7 @@ import org.eclipse.uml2.uml.Stereotype;
* profiled model then the migration tool asks the designer if the profile should
* be applied. If the designer answers 'yes' every stereotype application shall remain
* conversely if the answer is 'no' then every stereotype application shall be deleted.
- *
+ *
*/
public class MovePackageMigrator extends AbstractMigrator implements IMovePackageMigrator {
@@ -75,6 +76,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
* 1] the treeNode is a moved node
* 2] the moved element is a Package and not a Profile
* 3] the new container is in the currently profile use for the migration
+ * 4] the new container is different to the current container
*
* @param treeNode
* @return true if the treeNode represent the current change
@@ -82,8 +84,9 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
public static boolean isValid(TreeNode treeNode) {
if (TreeNodeUtils.isMoveChange(treeNode)) {
Object element = TreeNodeUtils.getMovedElement(treeNode);
- if (element instanceof Package && !(element instanceof Profile)) {
- if (TreeNodeUtils.getMovedSourceContainer(treeNode, MigratorProfileApplication.comparison) == MigratorProfileApplication.appliedProfile) {
+ EObject oldContainer = TreeNodeUtils.getMovedSourceContainer(treeNode, MigratorProfileApplication.comparison);
+ if (element instanceof Package && !(element instanceof Profile) && oldContainer != ((Package) element).getOwner()) {
+ if (oldContainer == MigratorProfileApplication.appliedProfile) {
return true;
}
}
@@ -178,7 +181,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the value of the preference for the specific dialog
- *
+ *
* @return true if the dialog should be display
*/
private boolean isDisplayDialogPreference() {
@@ -188,7 +191,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the moved package
- *
+ *
* @return the movedPackage
*/
@Override
@@ -198,7 +201,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the new container
- *
+ *
* @return the newContainer
*/
@Override
@@ -208,7 +211,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the new container of the element
- *
+ *
* @return the new container of the element
*/
@Override
@@ -218,7 +221,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the old container of the element (before the move)
- *
+ *
* @return the old container of the element
*/
@Override
@@ -228,7 +231,7 @@ public class MovePackageMigrator extends AbstractMigrator implements IMovePackag
/**
* Get the moved element
- *
+ *
* @return the moved element
*/
@Override
diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/profile/MoveProfileMigrator.java b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/profile/MoveProfileMigrator.java
index 61d896ca587..005976de59b 100644
--- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/profile/MoveProfileMigrator.java
+++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/profile/MoveProfileMigrator.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
+ * Copyright (c) 2017, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 539160
*
*****************************************************************************/
package org.eclipse.papyrus.toolsmiths.profilemigration.internal.migrators.atomic.profile;
@@ -18,6 +19,7 @@ package org.eclipse.papyrus.toolsmiths.profilemigration.internal.migrators.atomi
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.toolsmiths.profilemigration.MigratorProfileApplication;
@@ -39,10 +41,10 @@ import org.eclipse.uml2.uml.Stereotype;
/**
* If a profile is moved to another profile then the migration tool shall focus
* on the preservation of the stereotype applications available at the profiled model.
- *
+ *
* If the profile was moved in a profile that is already applied on the profiled
* model then the migration is trivial and every stereotype application shall remain.
- *
+ *
* If the profile was moved in a profile that is not already applied on the profiled model
* then the migration tool asks the designer if the moved profile should be reapplied.
* If the designer answers 'yes' every stereotype application shall remain conversely if
@@ -71,6 +73,7 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
* 1] the treeNode is a moved node
* 2] the moved element is a Profile
* 3] the moved profile is the currently profile use for the migration
+ * 4] the new container is different to the current container
*
* @param treeNode
* @return true if the treeNode represent the current change
@@ -78,7 +81,8 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
public static boolean isValid(TreeNode treeNode) {
if (TreeNodeUtils.isMoveChange(treeNode)) {
Object element = TreeNodeUtils.getMovedElement(treeNode);
- if (element instanceof Profile) {
+ EObject oldContainer = TreeNodeUtils.getMovedSourceContainer(treeNode, MigratorProfileApplication.comparison);
+ if (element instanceof Profile && oldContainer != ((Profile) element).getOwner()) {
if (element == MigratorProfileApplication.appliedProfile) {
return true;
}
@@ -152,7 +156,7 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
/**
* Get the value of the preference for the specific dialog
- *
+ *
* @return true if the dialog should be display
*/
private boolean isDisplayDialogPreference() {
@@ -162,17 +166,17 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
/**
* Get the new container of the element
- *
+ *
* @return the new container of the element
*/
@Override
public Element getTargetContainer() {
- return (Element) newContainer;
+ return newContainer;
}
/**
* Get the old container of the element (before the move)
- *
+ *
* @return the old container of the element
*/
@Override
@@ -182,7 +186,7 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
/**
* Get the moved element
- *
+ *
* @return the moved element
*/
@Override
@@ -192,7 +196,7 @@ public class MoveProfileMigrator extends AbstractMigrator implements IMoveProfil
/**
* Get the moved profile
- *
+ *
* @return the moved profile
*/
@Override

Back to the top