Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2015-01-21 12:13:29 -0500
committerChristian W. Damus2015-01-21 15:50:49 -0500
commit83de1b8003bf87fcfa260982f15975a117fc71b5 (patch)
tree11cd54d74f3ed70e054854f0e466be6f7c28ce6a
parentc42dda4199efe4f677ce20e510a3eb80f38605a2 (diff)
downloadorg.eclipse.papyrus-83de1b8003bf87fcfa260982f15975a117fc71b5.tar.gz
org.eclipse.papyrus-83de1b8003bf87fcfa260982f15975a117fc71b5.tar.xz
org.eclipse.papyrus-83de1b8003bf87fcfa260982f15975a117fc71b5.zip
436666: "Stereotype repair" pop-up for already upgraded model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=436666 Detect orphaned (dangling) stereotype instances and suggest to delete them. Orphans are treated as a separate group from properly attached stereotype instances of the same schema (broken or not) because they cannot be repaired by profile application; they are not stereotype applications because they have no base elements. Also update some test models that are opened in editors to remove orphaned stereotype instances (which cause tests to hang on the repair dialog). Conflicts: extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java28
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java205
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java39
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml21
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml21
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml79
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml59
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java30
-rw-r--r--tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml45
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml25
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml25
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java56
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java56
14 files changed, 462 insertions, 233 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java
index ca28961f1f6..0d9f524b785 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 436666
*****************************************************************************/
package org.eclipse.papyrus.migration.rsa.transformation;
@@ -17,6 +18,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.TreeIterator;
@@ -148,7 +150,7 @@ public class RepairStereotypes {
try {
final BasicDiagnostic diagnostics = new BasicDiagnostic(Activator.PLUGIN_ID, 0, "Problems in repairing stereotypes", null);
- for (EPackage packageToRepair : descriptor.getZombiePackages()) {
+ for (IAdaptable packageToRepair : descriptor.getZombieSchemas()) {
IRepairAction action = descriptor.getRepairAction(packageToRepair, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION);
descriptor.repair(packageToRepair, action, diagnostics, new NullProgressMonitor());
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java
new file mode 100644
index 00000000000..1287de538cf
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
+
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * Protocol for a grouping of stereotype instances of some schema that are orphaned (no longer attached to any UML elements).
+ */
+public interface IStereotypeOrphanGroup {
+ /**
+ * Queries the schema of the orphaned stereotype instances.
+ *
+ * @return the profile schema
+ */
+ EPackage getSchema();
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java
index a1acffa90aa..1cc14a00c2c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,6 +10,7 @@
* Christian W. Damus (CEA) - Initial API and implementation
* Christian W. Damus - bug 399859
* Christian W. Damus - bug 451338
+ * Christian W. Damus - bug 436666
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -22,6 +23,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
@@ -36,6 +38,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.uml.modelrepair.internal.participants.StereotypesUtil;
import org.eclipse.papyrus.uml.tools.helper.IProfileApplicationDelegate;
@@ -81,11 +84,11 @@ public class ZombieStereotypesDescriptor {
private final Multimap<ProfileContext, EObject> zombies = ArrayListMultimap.create();
- private final Map<EPackage, IRepairAction> suggestedActions = Maps.newHashMap();
+ private final Map<IAdaptable, IRepairAction> suggestedActions = Maps.newHashMap();
private final Function<? super EPackage, Profile> dynamicProfileSupplier;
- private Map<EPackage, Map<IRepairAction.Kind, IRepairAction>> repairActions = Maps.newHashMap();
+ private Map<IAdaptable, Map<IRepairAction.Kind, IRepairAction>> repairActions = Maps.newHashMap();
private Map<EPackage, Profile> definitionToProfileMap = Maps.newHashMap();
@@ -123,7 +126,10 @@ public class ZombieStereotypesDescriptor {
public void analyze(EObject stereotypeApplication) {
EPackage schema = getEPackage(stereotypeApplication);
- if ((schema == null) || (!appliedProfileDefinitions.contains(schema) && couldBeProfileDefinition(schema, stereotypeApplication))) {
+ if ((schema == null)
+ || (!appliedProfileDefinitions.contains(schema) && couldBeProfileDefinition(schema, stereotypeApplication))
+ || (appliedProfileDefinitions.contains(schema) && (UMLUtil.getBaseElement(stereotypeApplication) == null))) {
+
// It's a zombie. Determine the profile-application context that covers this stereotype instance
ProfileContext context = getProfileContext(stereotypeApplication, schema);
@@ -131,11 +137,12 @@ public class ZombieStereotypesDescriptor {
zombies.put(context, stereotypeApplication);
if (newContext && (schema != null)) {
- if (!suggestedActions.containsKey(schema)) {
- suggestedActions.put(schema, computeSuggestedAction(schema));
+ IAdaptable schemaAdaptable = context.getSchemaAdaptable();
+ if (!suggestedActions.containsKey(schemaAdaptable)) {
+ suggestedActions.put(schemaAdaptable, computeSuggestedAction(schemaAdaptable));
} else {
// Already computed the actions previously, but we need to add this new package to the apply-profile action
- ApplyProfileAction applyProfile = (ApplyProfileAction) getRepairAction(schema, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION);
+ ApplyProfileAction applyProfile = (ApplyProfileAction) getRepairAction(schemaAdaptable, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION);
if (applyProfile != null) {
applyProfile.addPackage(context.getApplyingPackage());
}
@@ -164,40 +171,61 @@ public class ZombieStereotypesDescriptor {
return resource;
}
- public Collection<? extends EPackage> getZombiePackages() {
- return ImmutableSet.copyOf(Iterables.transform(zombies.keySet(), new Function<ProfileContext, EPackage>() {
+ /**
+ * Obtains a collection of zombie schemas detected by the stereotype repair analysis and for which {@link IRepairAction}s
+ * are available to remedy problems. Every resulting adaptable
+ * <ul>
+ * <li>adapts to {@link EPackage} to provide the EMF schema that is unresolved or otherwise broken</li>
+ * <li>may possibly adapt to {@link IStereotypeOrphanGroup} representing stereotype applications from a broken schema that are not repairable by profile migration and so are treated separately with a distinct set of available actions
+ * </ul>
+ *
+ * @return the zombie schemas that are detected
+ */
+ public Collection<? extends IAdaptable> getZombieSchemas() {
+ return ImmutableSet.copyOf(Iterables.transform(zombies.keySet(), new Function<ProfileContext, IAdaptable>() {
- public EPackage apply(ProfileContext input) {
- return input.getSchema();
+ public IAdaptable apply(ProfileContext input) {
+ return input.getSchemaAdaptable();
}
}));
}
- public int getZombieCount(EPackage schema) {
+ public int getZombieCount(IAdaptable schema) {
int result = 0;
- for (Map.Entry<ProfileContext, Collection<EObject>> next : zombies.asMap().entrySet()) {
- if (equal(next.getKey().getSchema(), schema, root)) {
- result = result + next.getValue().size();
- }
+
+ for (Map.Entry<ProfileContext, Collection<EObject>> next : Iterables.filter(zombies.asMap().entrySet(), matches(schema))) {
+ result = result + next.getValue().size();
}
return result;
}
- public Collection<? extends EObject> getZombies(EPackage schema) {
- ImmutableList.Builder<EObject> result = ImmutableList.builder();
+ private Predicate<Map.Entry<ProfileContext, ?>> matches(IAdaptable schema) {
+ IStereotypeOrphanGroup orphans = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null);
+ final boolean isOrphanGroup = orphans != null;
+ final EPackage targetSchema = isOrphanGroup ? orphans.getSchema() : AdapterUtils.adapt(schema, EPackage.class, null);
- for (Map.Entry<ProfileContext, Collection<EObject>> next : zombies.asMap().entrySet()) {
- if (equal(next.getKey().getSchema(), schema, root)) {
- result.addAll(next.getValue());
+ return new Predicate<Map.Entry<ProfileContext, ?>>() {
+ public boolean apply(Map.Entry<ProfileContext, ?> input) {
+ ProfileContext context = input.getKey();
+ return (context.isOrphanGroup() == isOrphanGroup) && equal(context.getSchema(), targetSchema, root);
}
+ };
+ }
+
+ public Collection<? extends EObject> getZombies(IAdaptable schema) {
+ ImmutableList.Builder<EObject> result = ImmutableList.builder();
+
+ for (Map.Entry<ProfileContext, Collection<EObject>> next : Iterables.filter(zombies.asMap().entrySet(), matches(schema))) {
+ result.addAll(next.getValue());
}
return result.build();
}
- public boolean repair(EPackage schema, IRepairAction repairAction, DiagnosticChain diagnostics, IProgressMonitor monitor) {
- return repairAction.repair(resource, schema, getZombies(schema), diagnostics, monitor);
+ public boolean repair(IAdaptable schema, IRepairAction repairAction, DiagnosticChain diagnostics, IProgressMonitor monitor) {
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); // Fails if not present
+ return !repairAction.isNull() && repairAction.repair(resource, ePackage, getZombies(schema), diagnostics, monitor);
}
protected EPackage getEPackage(EObject object) {
@@ -205,18 +233,27 @@ public class ZombieStereotypesDescriptor {
return (eclass == null) ? null : eclass.getEPackage();
}
- protected IRepairAction computeSuggestedAction(EPackage schema) {
+ protected IRepairAction computeSuggestedAction(IAdaptable schema) {
// Try options in our preferred order
IRepairAction result = getRepairAction(schema, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION);
+
if (result.isNull()) {
- // This one is always available
- result = getRepairAction(schema, IRepairAction.Kind.NO_OP);
+ IStereotypeOrphanGroup orphanGroup = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null);
+ if (orphanGroup != null) {
+ // Prefer to just delete orphans
+ result = getRepairAction(schema, IRepairAction.Kind.DELETE);
+ }
+
+ if (result.isNull()) {
+ // This one is always available
+ result = getRepairAction(schema, IRepairAction.Kind.NO_OP);
+ }
}
return result;
}
- protected Map<IRepairAction.Kind, IRepairAction> computeFeasibleRepairActions(EPackage schema) {
+ protected Map<IRepairAction.Kind, IRepairAction> computeFeasibleRepairActions(IAdaptable schema) {
Map<IRepairAction.Kind, IRepairAction> result = Maps.newEnumMap(IRepairAction.Kind.class);
// Always available
@@ -224,15 +261,21 @@ public class ZombieStereotypesDescriptor {
result.put(DeleteAction.INSTANCE.kind(), DeleteAction.INSTANCE);
result.put(CreateMarkersAction.INSTANCE.kind(), CreateMarkersAction.INSTANCE);
- IRepairAction applyProfile;
- Collection<Package> packages = getContextPackages(schema);
- Profile profile = findProfile(schema);
- if (profile == null) {
- applyProfile = new ApplyProfileAction(resource, packages, curry(schema, dynamicProfileSupplier));
+ IStereotypeOrphanGroup orphanGroup = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null);
+ if (orphanGroup != null) {
+ // Easy case. Nothing more to add!
} else {
- applyProfile = new ApplyProfileAction(resource, packages, profile, labelProviderService);
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class, null);
+ IRepairAction applyProfile;
+ Collection<Package> packages = getContextPackages(ePackage);
+ Profile profile = findProfile(ePackage);
+ if (profile == null) {
+ applyProfile = new ApplyProfileAction(resource, packages, curry(ePackage, dynamicProfileSupplier));
+ } else {
+ applyProfile = new ApplyProfileAction(resource, packages, profile, labelProviderService);
+ }
+ result.put(applyProfile.kind(), applyProfile);
}
- result.put(applyProfile.kind(), applyProfile);
return result;
}
@@ -259,21 +302,34 @@ public class ZombieStereotypesDescriptor {
return Suppliers.compose(function, Suppliers.ofInstance(input));
}
- public IRepairAction getSuggestedRepairAction(EPackage schema) {
+ public IRepairAction getSuggestedRepairAction(IAdaptable schema) {
return suggestedActions.get(schema);
}
- public IRepairAction getRepairAction(EPackage schema, IRepairAction.Kind kind) {
+ /**
+ * Obtains a repair action of the specified {@code kind} for a broken {@code schema}, if it is available.
+ *
+ * @param schema
+ * a schema to repair
+ * @param kind
+ * the kind of repair action to obtain
+ * @return the requested {@code kind} of action, or {@link IRepairAction#NULL} if the requested {@code kind} is not available for this {@code schema}
+ */
+ public IRepairAction getRepairAction(IAdaptable schema, IRepairAction.Kind kind) {
Map<IRepairAction.Kind, IRepairAction> available = repairActions.get(schema);
if (available == null) {
available = computeFeasibleRepairActions(schema);
repairActions.put(schema, available);
}
- return available.get(kind);
+ IRepairAction result = available.get(kind);
+ if (result == null) {
+ result = IRepairAction.NULL;
+ }
+ return result;
}
- public List<IRepairAction> getAvailableRepairActions(EPackage schema) {
+ public List<IRepairAction> getAvailableRepairActions(IAdaptable schema) {
Map<IRepairAction.Kind, IRepairAction> actions = repairActions.get(schema);
return (actions == null) ? Collections.<IRepairAction> emptyList() : ImmutableList.copyOf(Iterables.filter(actions.values(), IRepairAction.NOT_NULL));
}
@@ -300,8 +356,8 @@ public class ZombieStereotypesDescriptor {
} else {
Element base = getBaseElement(stereotypeApplication);
if (base == null) {
- // Can't make any inference about package context
- result = new ProfileContext(root, schema);
+ // These are orphans
+ result = new ProfileContext(schema);
} else {
// Find the profile application
result = null;
@@ -453,7 +509,7 @@ public class ZombieStereotypesDescriptor {
// Nested types
//
- static class ProfileContext {
+ static class ProfileContext implements IAdaptable {
private final Package applyingPackage;
@@ -471,6 +527,18 @@ public class ZombieStereotypesDescriptor {
this(profileApplication.getApplyingPackage(), schema);
}
+ /**
+ * Creates a descriptor for a group of orphaned stereotype instances of the given {@code schema}.
+ * An orphan group is distinct from the stereotype instances of the same schema that are attached
+ * to base UML elements, because those can be properly managed by the UML2 API.
+ *
+ * @param schema
+ * the XML/Ecore schema of the orphaned stereotype instances
+ */
+ ProfileContext(EPackage schema) {
+ this(null, schema);
+ }
+
private void init() {
String schemaHash = (schema == null) ? null : schema.getNsURI();
hash = Objects.hashCode(applyingPackage, schemaHash);
@@ -484,6 +552,37 @@ public class ZombieStereotypesDescriptor {
return schema;
}
+ public IAdaptable getSchemaAdaptable() {
+ return isOrphanGroup() ? this : new EPackageAdapter(getSchema());
+ }
+
+ /**
+ * Queries whether I represent a group of orphaned stereotype instances.
+ * An orphan group is distinct from the stereotype instances of the same schema that are attached
+ * to base UML elements, because those can be properly managed by the UML2 API.
+ *
+ * @return whether I represent orphaned stereotype instances of some schema
+ */
+ public boolean isOrphanGroup() {
+ return getApplyingPackage() == null;
+ }
+
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ Object result = null;
+
+ if (adapter == EPackage.class) {
+ result = getSchema();
+ } else if ((adapter == IStereotypeOrphanGroup.class) && isOrphanGroup()) {
+ result = new IStereotypeOrphanGroup() {
+ public EPackage getSchema() {
+ return ProfileContext.this.getSchema();
+ }
+ };
+ }
+
+ return result;
+ }
+
@Override
public boolean equals(Object obj) {
boolean result = false;
@@ -505,4 +604,28 @@ public class ZombieStereotypesDescriptor {
return hash;
}
}
+
+ private static final class EPackageAdapter implements IAdaptable {
+ private final EPackage ePackage;
+
+ EPackageAdapter(EPackage ePackage) {
+ super();
+
+ this.ePackage = ePackage;
+ }
+
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ return (adapter == EPackage.class) ? ePackage : null;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof EPackageAdapter) && (((EPackageAdapter) obj).ePackage == ePackage);
+ }
+
+ @Override
+ public int hashCode() {
+ return ePackage.hashCode();
+ }
+ }
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java
index df95dbcb284..8d63b45aec1 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2013, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,6 +12,7 @@
* Christian W. Damus - bug 451338
* Christian W. Damus - bug 451557
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 454997
+ * Christian W. Damus - bug 436666
*
*/
package org.eclipse.papyrus.uml.modelrepair.ui;
@@ -25,6 +26,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -59,8 +61,10 @@ import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.SameShellProvider;
import org.eclipse.jface.wizard.ProgressMonitorPart;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
@@ -68,6 +72,7 @@ import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialo
import org.eclipse.papyrus.infra.tools.util.UIUtil;
import org.eclipse.papyrus.uml.modelrepair.Activator;
import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IRepairAction;
+import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IStereotypeOrphanGroup;
import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.ZombieStereotypesDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
@@ -217,7 +222,7 @@ public class ZombieStereotypesDialog extends TrayDialog {
missingSchemas = Lists.newArrayList();
for (ZombieStereotypesDescriptor next : zombieDescriptors) {
- for (EPackage schema : next.getZombiePackages()) {
+ for (IAdaptable schema : next.getZombieSchemas()) {
missingSchemas.add(new MissingSchema(schema, next));
}
}
@@ -434,8 +439,14 @@ public class ZombieStereotypesDialog extends TrayDialog {
}
void updateAffected(ViewerCell cell) {
- int count = ((MissingSchema) cell.getElement()).getAffectedCount();
- cell.setText(Integer.toString(count));
+ MissingSchema schema = (MissingSchema) cell.getElement();
+ int count = schema.getAffectedCount();
+
+ String text = Integer.toString(count);
+ if (schema.isOrphanGroup()) {
+ text = NLS.bind("{0} dangling stereotypes", text);
+ }
+ cell.setText(text);
}
void updateSchema(ViewerCell cell) {
@@ -453,16 +464,16 @@ public class ZombieStereotypesDialog extends TrayDialog {
private class MissingSchema {
- private final EPackage ePackage;
+ private final IAdaptable schema;
private final ZombieStereotypesDescriptor descriptor;
private IRepairAction selectedAction;
- MissingSchema(EPackage ePackage, ZombieStereotypesDescriptor descriptor) {
- this.ePackage = ePackage;
+ MissingSchema(IAdaptable schema, ZombieStereotypesDescriptor descriptor) {
+ this.schema = schema;
this.descriptor = descriptor;
- this.selectedAction = descriptor.getSuggestedRepairAction(ePackage);
+ this.selectedAction = descriptor.getSuggestedRepairAction(schema);
}
void initialiseRepairAction(Map<String, Profile> brokenNsProfileMap) {
@@ -477,15 +488,19 @@ public class ZombieStereotypesDialog extends TrayDialog {
}
int getAffectedCount() {
- return descriptor.getZombieCount(getSchema());
+ return descriptor.getZombieCount(schema);
}
EPackage getSchema() {
- return ePackage;
+ return AdapterUtils.adapt(schema, EPackage.class, null);
+ }
+
+ boolean isOrphanGroup() {
+ return AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class).isPresent();
}
List<IRepairAction> getRepairActions() {
- return descriptor.getAvailableRepairActions(ePackage);
+ return descriptor.getAvailableRepairActions(schema);
}
IRepairAction getSelectedRepairAction() {
@@ -497,7 +512,7 @@ public class ZombieStereotypesDialog extends TrayDialog {
}
boolean apply(DiagnosticChain diagnostics, IProgressMonitor monitor) {
- return descriptor.repair(getSchema(), getSelectedRepairAction(), diagnostics, monitor);
+ return descriptor.repair(schema, getSelectedRepairAction(), diagnostics, monitor);
}
}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml
index 895a76456b7..9891f8006a8 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml
@@ -1,31 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg">
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg">
<uml:Model xmi:id="_J4wuULjVEeOUcroamP8z5w" name="Model">
- <packageImport xmi:type="uml:PackageImport" xmi:id="_J4wuUbjVEeOUcroamP8z5w">
+ <packageImport xmi:id="_J4wuUbjVEeOUcroamP8z5w">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Class" xmi:id="_Kzml8LjVEeOUcroamP8z5w" name="Person">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public">
+ <ownedAttribute xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_rLtVsLjVEeOUcroamP8z5w" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_rLuj0LjVEeOUcroamP8z5w" value="1"/>
</ownedAttribute>
- <ownedOperation xmi:type="uml:Operation" xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/>
+ <ownedOperation xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/>
</packagedElement>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_XFt30LjVEeOUcroamP8z5w">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <profileApplication xmi:id="_XFt30LjVEeOUcroamP8z5w">
+ <eAnnotations xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg"/>
</eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="j2ee-no-constraints.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/>
- </profileApplication>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_npoWELjVEeOUcroamP8z5w">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_np6p8LjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/>
- </eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
+ <appliedProfile href="j2ee-no-constraints.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/>
</profileApplication>
</uml:Model>
- <ActionLanguage:TextualRepresentation xmi:id="_np74ELjVEeOUcroamP8z5w" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
<j2ee:Bean xmi:id="_WG5mgLtDEeOsE9GQnSNONw" comment="This is a comment." disposition="happy" base_Class="_Kzml8LjVEeOUcroamP8z5w" finder="_mDkXMLjVEeOUcroamP8z5w">
<tag>gold</tag>
<tag>p1</tag>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml
index 5a4dbe9d880..42136560022 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml
@@ -1,31 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg">
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg">
<uml:Model xmi:id="_J4wuULjVEeOUcroamP8z5w" name="Model">
- <packageImport xmi:type="uml:PackageImport" xmi:id="_J4wuUbjVEeOUcroamP8z5w">
+ <packageImport xmi:id="_J4wuUbjVEeOUcroamP8z5w">
<importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Class" xmi:id="_Kzml8LjVEeOUcroamP8z5w" name="Person">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public">
+ <ownedAttribute xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_rLtVsLjVEeOUcroamP8z5w" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_rLuj0LjVEeOUcroamP8z5w" value="1"/>
</ownedAttribute>
- <ownedOperation xmi:type="uml:Operation" xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/>
+ <ownedOperation xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/>
</packagedElement>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_XFt30LjVEeOUcroamP8z5w">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <profileApplication xmi:id="_XFt30LjVEeOUcroamP8z5w">
+ <eAnnotations xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg"/>
</eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="j2ee.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/>
- </profileApplication>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_npoWELjVEeOUcroamP8z5w">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_np6p8LjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/>
- </eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
+ <appliedProfile href="j2ee.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/>
</profileApplication>
</uml:Model>
- <ActionLanguage:TextualRepresentation xmi:id="_np74ELjVEeOUcroamP8z5w" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
<j2ee:Bean xmi:id="_WG5mgLtDEeOsE9GQnSNONw" comment="This is a comment." disposition="happy" base_Class="_Kzml8LjVEeOUcroamP8z5w" finder="_mDkXMLjVEeOUcroamP8z5w">
<tag>gold</tag>
<tag>p1</tag>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml
index ed2c9d13f1b..aa426b736e7 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml
@@ -1,46 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g">
- <uml:Model xmi:id="_vtQUwPlAEeOEp7Wro2yWpw" name="banking">
- <packageImport xmi:type="uml:PackageImport" xmi:id="_vtQUwflAEeOEp7Wro2yWpw">
- <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
- </packageImport>
- <packagedElement xmi:type="uml:Class" xmi:id="_5wJWAPlAEeOEp7Wro2yWpw" name="Account">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_CCiC8PlBEeOEp7Wro2yWpw" name="id" visibility="public" isUnique="false">
- <type xmi:type="uml:PrimitiveType" href="library.uml#_9VhhQPlAEeOEp7Wro2yWpw"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_X0ky8PlBEeOEp7Wro2yWpw" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_X0laAPlBEeOEp7Wro2yWpw" value="1"/>
- </ownedAttribute>
- <ownedAttribute xmi:type="uml:Property" xmi:id="_kF-TIPlBEeOEp7Wro2yWpw" name="signatory" type="_YVg80PlBEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-TIflBEeOEp7Wro2yWpw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-TIvlBEeOEp7Wro2yWpw" value="*"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:Class" xmi:id="_YVg80PlBEeOEp7Wro2yWpw" name="Person">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_amdrwPlBEeOEp7Wro2yWpw" name="ssn" visibility="public" isUnique="false">
- <type xmi:type="uml:DataType" href="library.uml#_AtaNAPJEEeOWJr1T78jdJA"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cTywQPlBEeOEp7Wro2yWpw" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cUEdEPlBEeOEp7Wro2yWpw" value="1"/>
- </ownedAttribute>
- <ownedAttribute xmi:type="uml:Property" xmi:id="_cxZ5UPlBEeOEp7Wro2yWpw" name="name" visibility="public" isUnique="false">
- <type xmi:type="uml:DataType" href="library.uml#_vCcKoPJEEeOWJr1T78jdJA"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_jHClsPlBEeOEp7Wro2yWpw" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_jHLIkPlBEeOEp7Wro2yWpw" value="1"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:Association" xmi:id="_kF-6MPlBEeOEp7Wro2yWpw" name="A_account_person_1" memberEnd="_kF-6MflBEeOEp7Wro2yWpw _kF-TIPlBEeOEp7Wro2yWpw" navigableOwnedEnd="_kF-6MflBEeOEp7Wro2yWpw">
- <ownedEnd xmi:type="uml:Property" xmi:id="_kF-6MflBEeOEp7Wro2yWpw" name="account" type="_5wJWAPlAEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw">
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-6MvlBEeOEp7Wro2yWpw"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-6M_lBEeOEp7Wro2yWpw" value="*"/>
- </ownedEnd>
- </packagedElement>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_FFYv8PlBEeOEp7Wro2yWpw">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_FGT9APlBEeOEp7Wro2yWpw" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/>
- </eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
- </profileApplication>
- </uml:Model>
- <ActionLanguage:TextualRepresentation xmi:id="_FJGyUPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
- <ActionLanguage:TextualRepresentation xmi:id="_QzhLAPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
- <ActionLanguage:TextualRepresentation xmi:id="_fuKlYPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
-</xmi:XMI>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_vtQUwPlAEeOEp7Wro2yWpw" name="banking">
+ <packageImport xmi:id="_vtQUwflAEeOEp7Wro2yWpw">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_5wJWAPlAEeOEp7Wro2yWpw" name="Account">
+ <ownedAttribute xmi:id="_CCiC8PlBEeOEp7Wro2yWpw" name="id" visibility="public" isUnique="false">
+ <type xmi:type="uml:PrimitiveType" href="library.uml#_9VhhQPlAEeOEp7Wro2yWpw"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_X0ky8PlBEeOEp7Wro2yWpw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_X0laAPlBEeOEp7Wro2yWpw" value="1"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_kF-TIPlBEeOEp7Wro2yWpw" name="signatory" type="_YVg80PlBEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-TIflBEeOEp7Wro2yWpw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-TIvlBEeOEp7Wro2yWpw" value="*"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_YVg80PlBEeOEp7Wro2yWpw" name="Person">
+ <ownedAttribute xmi:id="_amdrwPlBEeOEp7Wro2yWpw" name="ssn" visibility="public" isUnique="false">
+ <type xmi:type="uml:DataType" href="library.uml#_AtaNAPJEEeOWJr1T78jdJA"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cTywQPlBEeOEp7Wro2yWpw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cUEdEPlBEeOEp7Wro2yWpw" value="1"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_cxZ5UPlBEeOEp7Wro2yWpw" name="name" visibility="public" isUnique="false">
+ <type xmi:type="uml:DataType" href="library.uml#_vCcKoPJEEeOWJr1T78jdJA"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_jHClsPlBEeOEp7Wro2yWpw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_jHLIkPlBEeOEp7Wro2yWpw" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Association" xmi:id="_kF-6MPlBEeOEp7Wro2yWpw" name="A_account_person_1" memberEnd="_kF-6MflBEeOEp7Wro2yWpw _kF-TIPlBEeOEp7Wro2yWpw" navigableOwnedEnd="_kF-6MflBEeOEp7Wro2yWpw">
+ <ownedEnd xmi:id="_kF-6MflBEeOEp7Wro2yWpw" name="account" type="_5wJWAPlAEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-6MvlBEeOEp7Wro2yWpw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-6M_lBEeOEp7Wro2yWpw" value="*"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml
index 3be4c8d6dc4..06f7daf5a6a 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml
@@ -1,35 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g">
- <uml:Model xmi:id="__mBuMPJDEeOWJr1T78jdJA" name="types">
- <packageImport xmi:type="uml:PackageImport" xmi:id="__mBuMfJDEeOWJr1T78jdJA">
- <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
- </packageImport>
- <packagedElement xmi:type="uml:DataType" xmi:id="_AtaNAPJEEeOWJr1T78jdJA" name="SSN">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_eThWQPJEEeOWJr1T78jdJA" name="ssn" visibility="public" isUnique="false">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gmTRMPJEEeOWJr1T78jdJA" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_gmcbIPJEEeOWJr1T78jdJA" value="1"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:DataType" xmi:id="_vCcKoPJEEeOWJr1T78jdJA" name="Name">
- <ownedAttribute xmi:type="uml:Property" xmi:id="_W65OYPlAEeOEp7Wro2yWpw" name="lastName" visibility="public" isUnique="false">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YAKNUPlAEeOEp7Wro2yWpw" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YAWakPlAEeOEp7Wro2yWpw" value="1"/>
- </ownedAttribute>
- <ownedAttribute xmi:type="uml:Property" xmi:id="_YtJ2MPlAEeOEp7Wro2yWpw" name="firstName" visibility="public" isUnique="false">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_b6Vj4PlAEeOEp7Wro2yWpw" value="1"/>
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_b6kNYPlAEeOEp7Wro2yWpw" value="1"/>
- </ownedAttribute>
- </packagedElement>
- <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_9VhhQPlAEeOEp7Wro2yWpw" name="Identifier"/>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_ZdS5sPlAEeOEp7Wro2yWpw">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ZeInMPlAEeOEp7Wro2yWpw" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/>
- </eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
- </profileApplication>
- </uml:Model>
- <ActionLanguage:TextualRepresentation xmi:id="_ZeLDcPlAEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
-</xmi:XMI>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="__mBuMPJDEeOWJr1T78jdJA" name="types">
+ <packageImport xmi:id="__mBuMfJDEeOWJr1T78jdJA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:DataType" xmi:id="_AtaNAPJEEeOWJr1T78jdJA" name="SSN">
+ <ownedAttribute xmi:id="_eThWQPJEEeOWJr1T78jdJA" name="ssn" visibility="public" isUnique="false">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gmTRMPJEEeOWJr1T78jdJA" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_gmcbIPJEEeOWJr1T78jdJA" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:DataType" xmi:id="_vCcKoPJEEeOWJr1T78jdJA" name="Name">
+ <ownedAttribute xmi:id="_W65OYPlAEeOEp7Wro2yWpw" name="lastName" visibility="public" isUnique="false">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YAKNUPlAEeOEp7Wro2yWpw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YAWakPlAEeOEp7Wro2yWpw" value="1"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_YtJ2MPlAEeOEp7Wro2yWpw" name="firstName" visibility="public" isUnique="false">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_b6Vj4PlAEeOEp7Wro2yWpw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_b6kNYPlAEeOEp7Wro2yWpw" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_9VhhQPlAEeOEp7Wro2yWpw" name="Identifier"/>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java
index 209265b22ee..1b25b93e04a 100644
--- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
* Christian W. Damus - bug 399859
+ * Christian W. Damus - bug 436666
*
*/
package org.eclipse.papyrus.uml.decoratormodel.tests;
@@ -22,12 +23,14 @@ import static org.junit.Assert.fail;
import java.util.Collection;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
@@ -69,9 +72,10 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat
public void wrongProfileVersion() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject) getTestProfile()));
- assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema)));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) getTestProfile()));
+ assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -89,9 +93,10 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat
public void missingProfileApplication() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject) getTestProfile()));
- assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema)));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) getTestProfile()));
+ assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -109,8 +114,9 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat
public void missingSchema() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(schema));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(ePackage));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -135,7 +141,7 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat
houseKeeper.setField("zombies", snippet.getZombieStereotypes(decoratorModelResource));
}
- void repair(final EPackage schema, final IRepairAction action) {
+ void repair(final IAdaptable schema, final IRepairAction action) {
try {
TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() {
@@ -150,8 +156,8 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat
}
}
- EPackage getOnlyZombieSchema() {
- Collection<? extends EPackage> schemata = zombies.getZombiePackages();
+ IAdaptable getOnlyZombieSchema() {
+ Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas();
assertThat("Wrong number of zombie packages", schemata.size(), is(1));
return schemata.iterator().next();
}
diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml
index 2f74f16776f..a06d55939f7 100644
--- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml
+++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml
@@ -1,28 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g">
- <uml:Model xmi:id="_IXDeQBf8EeSLM5AVoLTKwA" name="Model">
- <packageImport xmi:type="uml:PackageImport" xmi:id="_IXEFUBf8EeSLM5AVoLTKwA">
- <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
- </packageImport>
- <packagedElement xmi:type="uml:Class" xmi:id="_JOhRwBf8EeSLM5AVoLTKwA" name="Container">
- <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_LkcAQBf8EeSLM5AVoLTKwA" name="RedefinableTemplateSignature1" parameter="_T3jF8Bf8EeSLM5AVoLTKwA">
- <ownedParameter xmi:type="uml:ClassifierTemplateParameter" xmi:id="_T3jF8Bf8EeSLM5AVoLTKwA" parameteredElement="_WiCWQBf8EeSLM5AVoLTKwA">
- <ownedParameteredElement xmi:type="uml:Class" xmi:id="_WiCWQBf8EeSLM5AVoLTKwA" name="T" templateParameter="_T3jF8Bf8EeSLM5AVoLTKwA"/>
- </ownedParameter>
- </ownedTemplateSignature>
- <ownedAttribute xmi:type="uml:Property" xmi:id="_dG048Bf8EeSLM5AVoLTKwA" name="size" isReadOnly="true" isDerived="true">
- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer"/>
- </ownedAttribute>
- <ownedOperation xmi:type="uml:Operation" xmi:id="_qsvVABf8EeSLM5AVoLTKwA" name="add">
- <ownedParameter xmi:type="uml:Parameter" xmi:id="_29UV0Bf8EeSLM5AVoLTKwA" name="element" type="_WiCWQBf8EeSLM5AVoLTKwA" effect="read"/>
- </ownedOperation>
- </packagedElement>
- <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_ex7I0Bf8EeSLM5AVoLTKwA">
- <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_eyRHEBf8EeSLM5AVoLTKwA" source="http://www.eclipse.org/uml2/2.0.0/UML">
- <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/>
- </eAnnotations>
- <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/>
- </profileApplication>
- </uml:Model>
- <ActionLanguage:TextualRepresentation xmi:id="_e56nMBf8EeSLM5AVoLTKwA" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/>
-</xmi:XMI>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_IXDeQBf8EeSLM5AVoLTKwA" name="Model">
+ <packageImport xmi:id="_IXEFUBf8EeSLM5AVoLTKwA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_JOhRwBf8EeSLM5AVoLTKwA" name="Container">
+ <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_LkcAQBf8EeSLM5AVoLTKwA" name="RedefinableTemplateSignature1" parameter="_T3jF8Bf8EeSLM5AVoLTKwA">
+ <ownedParameter xmi:type="uml:ClassifierTemplateParameter" xmi:id="_T3jF8Bf8EeSLM5AVoLTKwA" parameteredElement="_WiCWQBf8EeSLM5AVoLTKwA">
+ <ownedParameteredElement xmi:type="uml:Class" xmi:id="_WiCWQBf8EeSLM5AVoLTKwA" name="T" templateParameter="_T3jF8Bf8EeSLM5AVoLTKwA"/>
+ </ownedParameter>
+ </ownedTemplateSignature>
+ <ownedAttribute xmi:id="_dG048Bf8EeSLM5AVoLTKwA" name="size" isReadOnly="true" isDerived="true">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer"/>
+ </ownedAttribute>
+ <ownedOperation xmi:id="_qsvVABf8EeSLM5AVoLTKwA" name="add">
+ <ownedParameter xmi:id="_29UV0Bf8EeSLM5AVoLTKwA" name="element" type="_WiCWQBf8EeSLM5AVoLTKwA" effect="read"/>
+ </ownedOperation>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml
new file mode 100644
index 00000000000..8e3c20b8fc2
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MyProfile="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0 platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g">
+ <uml:Model xmi:id="_dvVSIMASEeOtPYrql1dzPg" name="Model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_dvVSIcASEeOtPYrql1dzPg">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_eiqzkMASEeOtPYrql1dzPg" name="Class1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_gM4SoMASEeOtPYrql1dzPg" name="Attribute1"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_xMJ3MMASEeOtPYrql1dzPg" name="Attribute2"/>
+ </packagedElement>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_kovZ8MASEeOtPYrql1dzPg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ko_4oMASEeOtPYrql1dzPg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_GdQvQMAREeOtPYrql1dzPg"/>
+ </profileApplication>
+ </uml:Model>
+ <MyProfile:Stereo xmi:id="_mPac0MASEeOtPYrql1dzPg" alertLevel="yellow" appliesTo="_gM4SoMASEeOtPYrql1dzPg _xMJ3MMASEeOtPYrql1dzPg">
+ <tag>p2</tag>
+ <tag>silver</tag>
+ <name xmi:type="MyProfile:Name" xmi:id="_2vm4sMASEeOtPYrql1dzPg" lastName="Damus" firstName="Christian">
+ <initials>W</initials>
+ </name>
+ </MyProfile:Stereo>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml
new file mode 100644
index 00000000000..c26ab64a5dd
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MyProfile="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0 platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_V3LqIMASEeOtPYrql1dzPg">
+ <uml:Model xmi:id="_dvVSIMASEeOtPYrql1dzPg" name="Model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_dvVSIcASEeOtPYrql1dzPg">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_eiqzkMASEeOtPYrql1dzPg" name="Class1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_gM4SoMASEeOtPYrql1dzPg" name="Attribute1"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_xMJ3MMASEeOtPYrql1dzPg" name="Attribute2"/>
+ </packagedElement>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_kovZ8MASEeOtPYrql1dzPg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ko_4oMASEeOtPYrql1dzPg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_GdQvQMAREeOtPYrql1dzPg"/>
+ </profileApplication>
+ </uml:Model>
+ <MyProfile:Stereo xmi:id="_mPac0MASEeOtPYrql1dzPg" alertLevel="yellow" appliesTo="_gM4SoMASEeOtPYrql1dzPg _xMJ3MMASEeOtPYrql1dzPg">
+ <tag>p2</tag>
+ <tag>silver</tag>
+ <name xmi:type="MyProfile:Name" xmi:id="_2vm4sMASEeOtPYrql1dzPg" lastName="Damus" firstName="Christian">
+ <initials>W</initials>
+ </name>
+ </MyProfile:Stereo>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
index e0030b067e3..8052e7b85ea 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA and others.
+ * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
+ * Christian W. Damus - bug 436666
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -24,6 +25,7 @@ import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collection;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.common.util.URI;
@@ -33,6 +35,7 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
@@ -95,9 +98,10 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
public void wrongProfileVersion() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject)profile));
- assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema)));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile));
+ assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -115,9 +119,10 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
public void missingProfileApplication() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject)profile));
- assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema)));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile));
+ assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -135,8 +140,9 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
public void missingSchema() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
- assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(schema));
+ IAdaptable schema = getOnlyZombieSchema();
+ EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(ePackage));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -153,7 +159,7 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
public void deleteStereotypes() {
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
- EPackage schema = getOnlyZombieSchema();
+ IAdaptable schema = getOnlyZombieSchema();
IRepairAction action = zombies.getRepairAction(schema, IRepairAction.Kind.DELETE);
assertThat("Wrong repair action", action.kind(), is(IRepairAction.Kind.DELETE));
@@ -172,14 +178,14 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
URI profileURI = URI.createPlatformPluginURI("org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml", true);
profile = UML2Util.load(modelSet.getResourceSet(), profileURI, UMLPackage.Literals.PROFILE);
stereotype = profile.getOwnedStereotype("Stereo");
- class1 = (Class)modelSet.getModel().getOwnedType("Class1");
+ class1 = (Class) modelSet.getModel().getOwnedType("Class1");
fixture = houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant(profile)), "dispose", modelSet.getResourceSet());
fixture.start(modelSet.getResourceSet());
houseKeeper.setField("zombies", fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel()));
}
- void repair(final EPackage schema, final IRepairAction action) {
+ void repair(final IAdaptable schema, final IRepairAction action) {
try {
TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() {
@@ -194,8 +200,8 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
}
}
- EPackage getOnlyZombieSchema() {
- Collection<? extends EPackage> schemata = zombies.getZombiePackages();
+ IAdaptable getOnlyZombieSchema() {
+ Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas();
assertThat("Wrong number of zombie packages", schemata.size(), is(1));
return schemata.iterator().next();
}
@@ -207,41 +213,41 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
// Verify an Enumeration value stored as an XML attribute
Object value = application.eGet(eclass.getEStructuralFeature("alertLevel"));
- assertThat("Alert level is not yellow", (value instanceof Enumerator) && ((Enumerator)value).getLiteral().equals("yellow"), is(true));
+ assertThat("Alert level is not yellow", (value instanceof Enumerator) && ((Enumerator) value).getLiteral().equals("yellow"), is(true));
// Verify a multi-valued attribute stored as XML elements
value = application.eGet(eclass.getEStructuralFeature("tag"));
- assertThat("Wrong tags found", value, is((Object)Arrays.asList("p2", "silver")));
+ assertThat("Wrong tags found", value, is((Object) Arrays.asList("p2", "silver")));
// Verify a reference value stored as an XML IDREFS attribute
value = application.eGet(eclass.getEStructuralFeature("appliesTo"));
- assertThat("Wrong appliesTo found", value, is((Object)class1.getOwnedAttributes()));
+ assertThat("Wrong appliesTo found", value, is((Object) class1.getOwnedAttributes()));
// Verify a contained EObject that is a complex DataType value
value = application.eGet(eclass.getEStructuralFeature("name"));
{
assertThat("Value is not an EList", value, instanceOf(EList.class));
- EList<?> list = (EList<?>)value;
+ EList<?> list = (EList<?>) value;
assertThat("List has wrong number of elements", list.size(), is(1));
value = list.get(0);
assertThat("Value is not an EObject", value, instanceOf(EObject.class));
- EObject name = (EObject)value;
+ EObject name = (EObject) value;
EClass dataType = name.eClass();
- assertThat("Wrong firstName", name.eGet(dataType.getEStructuralFeature("firstName")), is((Object)"Christian"));
- assertThat("Wrong lastName", name.eGet(dataType.getEStructuralFeature("lastName")), is((Object)"Damus"));
- assertThat("Wrong initials", name.eGet(dataType.getEStructuralFeature("initials")), is((Object)Arrays.asList("W")));
+ assertThat("Wrong firstName", name.eGet(dataType.getEStructuralFeature("firstName")), is((Object) "Christian"));
+ assertThat("Wrong lastName", name.eGet(dataType.getEStructuralFeature("lastName")), is((Object) "Damus"));
+ assertThat("Wrong initials", name.eGet(dataType.getEStructuralFeature("initials")), is((Object) Arrays.asList("W")));
}
}
ExtendedMetaData getExtendedMetadata() {
ExtendedMetaData result = ExtendedMetaData.INSTANCE;
- Object option = ((XMLResource)modelSet.getModelResource()).getDefaultSaveOptions().get(XMLResource.OPTION_EXTENDED_META_DATA);
- if(option instanceof ExtendedMetaData) {
- result = (ExtendedMetaData)option;
+ Object option = ((XMLResource) modelSet.getModelResource()).getDefaultSaveOptions().get(XMLResource.OPTION_EXTENDED_META_DATA);
+ if (option instanceof ExtendedMetaData) {
+ result = (ExtendedMetaData) option;
}
return result;
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
index b80a274cd72..8ec42f5237b 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,6 +10,7 @@
* Christian W. Damus (CEA) - Initial API and implementation
* Christian W. Damus - bug 455248
* Christian W. Damus - bug 455329
+ * Christian W. Damus - bug 436666
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -27,6 +28,9 @@ import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Set;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.ECollections;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
@@ -90,7 +94,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
@Test
@PluginResource("/resources/regression/bug434302/nested-profiles-nonamespace.uml")
public void nestedProfileApplicationsMissingNamespace_bug434302() {
- EPackage schema = getOnlyZombieSchema();
+ IAdaptable schema = getOnlyZombieSchema();
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -119,7 +123,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
@Test
@PluginResource("/resources/regression/bug434302/nested-profiles-2pkgs1profile.uml")
public void nestedProfileApplications2Pkgs1Profile_bug434302() {
- EPackage schema = getOnlyZombieSchema();
+ IAdaptable schema = getOnlyZombieSchema();
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -173,7 +177,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
@Bug("436666")
@PluginResource("/resources/regression/bug436666/model2-missing-schemalocation.uml")
public void nestedPackageSchemaMissing_bug436666() {
- EPackage schema = getOnlyZombieSchema();
+ IAdaptable schema = getOnlyZombieSchema();
IRepairAction action = zombies.getSuggestedRepairAction(schema);
assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION));
@@ -232,6 +236,44 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
assertThat("Should not have found zombie stereotypes", zombies, nullValue());
}
+ /**
+ * Tests that orphaned stereotype instances are correctly detected where they are of the currently applied profile schema.
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=436666
+ */
+ @Test
+ @Bug("436666")
+ @PluginResource("/resources/regression/bug436666/orphans-of-valid-schema.uml")
+ public void orphansOfValidSchema_bug436666() {
+ IAdaptable schema = getOnlyZombieSchema();
+ IRepairAction action = zombies.getSuggestedRepairAction(schema);
+ assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.DELETE));
+
+ repair(schema, action);
+
+ // The stereotype applications were deleted
+ assertThat(model.eResource().getContents(), is(ECollections.singletonEList((EObject) model)));
+ }
+
+ /**
+ * Tests that orphaned stereotype instances are correctly detected where they are of a profile version that is not currently applied.
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=436666
+ */
+ @Test
+ @Bug("436666")
+ @PluginResource("/resources/regression/bug436666/orphans-of-wrong-profile-version.uml")
+ public void orphansOfWrongProfileVersion_bug436666() {
+ IAdaptable schema = getOnlyZombieSchema();
+ IRepairAction action = zombies.getSuggestedRepairAction(schema);
+ assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.DELETE));
+
+ repair(schema, action);
+
+ // The stereotype applications were deleted
+ assertThat(model.eResource().getContents(), is(ECollections.singletonEList((EObject) model)));
+ }
+
//
// Test framework
//
@@ -319,7 +361,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant((Profile) null)), "dispose", modelSet.getResourceSet());
}
- void repair(final EPackage schema, final IRepairAction action) {
+ void repair(final IAdaptable schema, final IRepairAction action) {
try {
TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() {
@@ -334,8 +376,8 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
}
}
- EPackage getOnlyZombieSchema() {
- Collection<? extends EPackage> schemata = zombies.getZombiePackages();
+ IAdaptable getOnlyZombieSchema() {
+ Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas();
assertThat("Wrong number of zombie packages", schemata.size(), is(1));
return schemata.iterator().next();
}

Back to the top