diff options
author | Pauline DEVILLE | 2018-09-11 09:22:31 +0000 |
---|---|---|
committer | Patrick Tessier | 2018-09-14 13:48:33 +0000 |
commit | 913270db4d26b2b356ad836e68f4d4e58407c24c (patch) | |
tree | 78132a2b081f26922137d38966a397df83b20dc7 | |
parent | 0251aafed886233a3137dca7e0046ce45b4a4891 (diff) | |
download | org.eclipse.papyrus-913270db4d26b2b356ad836e68f4d4e58407c24c.tar.gz org.eclipse.papyrus-913270db4d26b2b356ad836e68f4d4e58407c24c.tar.xz org.eclipse.papyrus-913270db4d26b2b356ad836e68f4d4e58407c24c.zip |
Bug 538914 - [toolsmiths][ProfileMigrationTool] ClassCastException in
ChangeLowerMultiplicityFromPropertyMigrator and
ChangeUpperMultiplicityFromPropertyMigrator
Change-Id: I62f7eea9ff9535d76389d61aa8eaed60afce891c
Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
4 files changed, 30 insertions, 22 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 d6cf47bc92a..b3b393a10f7 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.101.qualifier +Bundle-Version: 0.7.102.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 660ffc67cfd..25dc488beba 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.101-SNAPSHOT</version> + <version>0.7.102-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/property/ChangeLowerMultiplicityFromPropertyMigrator.java b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeLowerMultiplicityFromPropertyMigrator.java index c5221e98a9d..442007889ee 100644 --- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeLowerMultiplicityFromPropertyMigrator.java +++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeLowerMultiplicityFromPropertyMigrator.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 538914 * *****************************************************************************/ @@ -82,7 +83,7 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato * 2] the treeNode is a added node * 2.1] the added element is a LiteraglInteger * 2.3] the structural feature referencing this added element is the lowerValue of a Property - * + * * @param treeNode * @return true if the treeNode represent the current change */ @@ -110,10 +111,13 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato } else if (TreeNodeUtils.isAddType(treeNode, MigratorProfileApplication.appliedProfile)) { // on first modification of the multiplicity, the lieteralInteget is add EObject element = TreeNodeUtils.getAddedElement(treeNode); if (element instanceof LiteralInteger) { - EStructuralFeature structuralFeature = TreeNodeUtils.getAddedStructuralFeature(treeNode); - if (structuralFeature == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue()) { - if (!(TreeNodeUtils.isAddType(treeNode.getParent(), MigratorProfileApplication.appliedProfile) && TreeNodeUtils.getAddedElement(treeNode.getParent()) instanceof Property)) { // when it is not an newly add property - return true; + Element property = ((LiteralInteger) element).getOwner(); + if (property instanceof Property) { + EStructuralFeature structuralFeature = TreeNodeUtils.getAddedStructuralFeature(treeNode); + if (structuralFeature == UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue()) { + if (!(TreeNodeUtils.isAddType(treeNode.getParent(), MigratorProfileApplication.appliedProfile) && TreeNodeUtils.getAddedElement(treeNode.getParent()) instanceof Property)) { // when it is not an newly add property + return true; + } } } } @@ -209,7 +213,7 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the value of the preference for the specific dialog - * + * * @return true if the dialog should be display */ private boolean isDisplayDialogPreference() { @@ -249,7 +253,7 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the changed element - * + * * @return the changed element */ @Override @@ -259,7 +263,7 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the new value of the feature - * + * * @return the new value of the feature */ @Override @@ -269,7 +273,7 @@ public class ChangeLowerMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the structural feature which is modified - * + * * @return the structural feature which is modified */ @Override diff --git a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeUpperMultiplicityFromPropertyMigrator.java b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeUpperMultiplicityFromPropertyMigrator.java index 11d609a5ab2..847a77ec2f9 100644 --- a/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeUpperMultiplicityFromPropertyMigrator.java +++ b/plugins/toolsmiths/profilemigration/org.eclipse.papyrus.toolsmiths.profilemigration/src/org/eclipse/papyrus/toolsmiths/profilemigration/internal/migrators/atomic/property/ChangeUpperMultiplicityFromPropertyMigrator.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 538914 * *****************************************************************************/ package org.eclipse.papyrus.toolsmiths.profilemigration.internal.migrators.atomic.property; @@ -82,7 +83,7 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato * 2] the treeNode is a added node * 2.1] the added element is a LiteralUnlimitedNatural * 2.3] the structural feature referencing this added element is the upperValue of a Property - * + * * @param treeNode * @return true if the treeNode represent the current change */ @@ -110,10 +111,13 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato } else if (TreeNodeUtils.isAddType(treeNode, MigratorProfileApplication.appliedProfile)) { // on first modification of the multiplicity, the lieteralInteget is add EObject element = TreeNodeUtils.getAddedElement(treeNode); if (element instanceof LiteralUnlimitedNatural) { - EStructuralFeature structuralFeature = TreeNodeUtils.getAddedStructuralFeature(treeNode); - if (structuralFeature == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue()) { - if (!(TreeNodeUtils.isAddType(treeNode.getParent(), MigratorProfileApplication.appliedProfile) && TreeNodeUtils.getAddedElement(treeNode.getParent()) instanceof Property)) { // when it is not an newly add property - return true; + Element property = ((LiteralUnlimitedNatural) element).getOwner(); + if (property instanceof Property) { + EStructuralFeature structuralFeature = TreeNodeUtils.getAddedStructuralFeature(treeNode); + if (structuralFeature == UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue()) { + if (!(TreeNodeUtils.isAddType(treeNode.getParent(), MigratorProfileApplication.appliedProfile) && TreeNodeUtils.getAddedElement(treeNode.getParent()) instanceof Property)) { // when it is not an newly add property + return true; + } } } } @@ -209,7 +213,7 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the value of the preference for the specific dialog - * + * * @return true if the dialog should be display */ private boolean isDisplayDialogPreference() { @@ -249,7 +253,7 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the changed element - * + * * @return the changed element */ @Override @@ -259,7 +263,7 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the new value of the feature - * + * * @return the new value of the feature */ @Override @@ -269,7 +273,7 @@ public class ChangeUpperMultiplicityFromPropertyMigrator extends AbstractMigrato /** * Get the structural feature which is modified - * + * * @return the structural feature which is modified */ @Override |