summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-12-19 10:33:10 (EST)
committerStephan Born2013-01-25 12:36:33 (EST)
commit872773214cf090cd56d2df8c66de01f910b1d6d4 (patch)
tree1130618c55aa16abfcff2de07cddb5c2d4f8457d
parentaca9fbc844db8970d5fba27b8dc108e4bea902b2 (diff)
downloadorg.eclipse.stardust.ui.web-872773214cf090cd56d2df8c66de01f910b1d6d4.zip
org.eclipse.stardust.ui.web-872773214cf090cd56d2df8c66de01f910b1d6d4.tar.gz
org.eclipse.stardust.ui.web-872773214cf090cd56d2df8c66de01f910b1d6d4.tar.bz2
Jira-ID: CRNT-27424 Pepper: External Packages and Filereferences not removed from XPDL correctly when Structured Data changed to local reference
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@61658 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ExternalReferenceChangeTracker.java61
1 files changed, 27 insertions, 34 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ExternalReferenceChangeTracker.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ExternalReferenceChangeTracker.java
index 0573876..1f02b30 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ExternalReferenceChangeTracker.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ExternalReferenceChangeTracker.java
@@ -37,47 +37,39 @@ public class ExternalReferenceChangeTracker implements ChangePostprocessor
{
Collection<EObject> removedList = change.getRemovedElements();
- Collection<EObject> modifiedList = change.getModifiedElements();
- if ( !removedList.isEmpty())
+ ModelType model = null;
+
+ if (!removedList.isEmpty())
{
EObject removedElement = (EObject) removedList.toArray()[0];
if (removedElement.eContainer() instanceof ChangeDescriptionImpl)
{
- ChangeDescriptionImpl changeDescription = (ChangeDescriptionImpl) removedElement.eContainer();
+ ChangeDescriptionImpl changeDescription = (ChangeDescriptionImpl) removedElement
+ .eContainer();
EObject container = changeDescription.getOldContainer(removedElement);
- trackExternalReferences(change, container);
+ model = ModelUtils.findContainingModel(container);
+ List<String> uris = ModelUtils.getURIsForExternalPackages(model);
+ for (Iterator<String> i = uris.iterator(); i.hasNext();)
+ {
+ String uri = i.next();
+ WebModelerConnectionManager cm = (WebModelerConnectionManager) model
+ .getConnectionManager();
+ Connection connection = (Connection) cm.findConnection(uri);
+ List<EObject> references = this.getExternalReferences(model,
+ (Connection) connection);
+ if (references.size() == 1)
+ {
+ ExternalPackage externalReference = (ExternalPackage) references.get(0);
+ removeConnection(externalReference);
+ model.getExternalPackages().getExternalPackage()
+ .remove(externalReference);
+ change.markAlsoRemoved(externalReference);
+ change.markAlsoModified(model);
+ }
+ }
}
- }
- if ( !modifiedList.isEmpty())
- {
- EObject modifiedElement = (EObject) modifiedList.toArray()[0];
- trackExternalReferences(change, modifiedElement);
- }
-
- }
-
- private void trackExternalReferences(Modification change, EObject container)
- {
- ModelType model;
- model = ModelUtils.findContainingModel(container);
- List<String> uris = ModelUtils.getURIsForExternalPackages(model);
- for (Iterator<String> i = uris.iterator(); i.hasNext();)
- {
- String uri = i.next();
- WebModelerConnectionManager cm = (WebModelerConnectionManager) model.getConnectionManager();
- Connection connection = (Connection) cm.findConnection(uri);
- List<EObject> references = this.getExternalReferences(model,
- (Connection) connection);
- if (references.size() == 1)
- {
- ExternalPackage externalReference = (ExternalPackage) references.get(0);
- removeConnection(externalReference);
- model.getExternalPackages().getExternalPackage().remove(externalReference);
- change.markAlsoRemoved(externalReference);
- change.markAlsoModified(model);
- }
}
}
@@ -88,7 +80,8 @@ public class ExternalReferenceChangeTracker implements ChangePostprocessor
IConnectionManager.URI_ATTRIBUTE_NAME);
ConnectionImpl connection = (ConnectionImpl) model.getConnectionManager()
.findConnection(uri);
- WebModelerConnectionManager man = (WebModelerConnectionManager) model.getConnectionManager();
+ WebModelerConnectionManager man = (WebModelerConnectionManager) model
+ .getConnectionManager();
man.getRepository().getConnection().remove(connection);
}