Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 36011 Details for
Bug 129178
NPE on MSLUtil.destroy(...) when using FeatureMaps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to delegate to EcoreUtil.remove()
bugzilla129178.patch (text/plain), 4.46 KB, created by
Chris McGee
on 2006-03-09 14:42:35 EST
(
hide
)
Description:
Patch to delegate to EcoreUtil.remove()
Filename:
MIME Type:
Creator:
Chris McGee
Created:
2006-03-09 14:42:35 EST
Size:
4.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.emf.core.compatibility >Index: src/org/eclipse/gmf/runtime/emf/core/internal/util/MSLUtil.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.emf.core.compatibility/src/org/eclipse/gmf/runtime/emf/core/internal/util/MSLUtil.java,v >retrieving revision 1.2 >diff -u -r1.2 MSLUtil.java >--- src/org/eclipse/gmf/runtime/emf/core/internal/util/MSLUtil.java 22 Feb 2006 17:55:31 -0000 1.2 >+++ src/org/eclipse/gmf/runtime/emf/core/internal/util/MSLUtil.java 9 Mar 2006 19:02:46 -0000 >@@ -44,6 +44,7 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.resource.ResourceSet; > import org.eclipse.emf.ecore.util.EcoreUtil; >+import org.eclipse.emf.ecore.util.FeatureMapUtil; > import org.eclipse.emf.ecore.xmi.XMLResource; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.emf.transaction.impl.InternalTransaction; >@@ -239,12 +240,7 @@ > && (resource != null)) > uriFragment = resource.getURIFragment(eObject); > >- EReference reference = eObject.eContainmentFeature(); >- >- if (reference.isMany()) >- ((Collection) container.eGet(reference)).remove(eObject); >- else >- container.eSet(reference, null); >+ EcoreUtil.remove(eObject); > > if ((options & MDestroyOption.NO_EVENTS) == 0) > sendDestroyEvent(domain, eObject); >@@ -1016,9 +1012,7 @@ > private static class TeardownAction { > > private EObject container = null; >- > private EReference reference = null; >- > private EObject object = null; > > /** >@@ -1036,19 +1030,13 @@ > * Execute the action. > */ > public void execute() { >- > if (object == null) { >- > if (container.eIsSet(reference)) { >- >- if (reference.isMany()) { >- >+ if (FeatureMapUtil.isMany(container, reference)) { > List objects = (List) container.eGet(reference); > > if (reference.isContainment()) { >- > if (!objects.isEmpty()) { >- > Collection destroyed = new ArrayList(objects); > > for (Iterator i = destroyed.iterator(); i >@@ -1057,9 +1045,7 @@ > } > > } else { >- > if (!objects.isEmpty()) { >- > Collection detached = new ArrayList(objects); > > for (Iterator i = detached.iterator(); i >@@ -1067,36 +1053,29 @@ > > EObject eObject = (EObject) i.next(); > >- ((Collection) container.eGet(reference)) >- .remove(eObject); >+ EcoreUtil.remove(container,reference,eObject); > } > } > } > > } else { >- > if (reference.isContainment()) { >- > object = (EObject) container.eGet(reference); > > if (object != null) > EObjectUtil.destroy(object); >- } else >- container.eSet(reference, null); >+ } else { >+ object = (EObject)container.eGet(reference); >+ EcoreUtil.remove(container, reference, object); >+ } > } > } > > } else { >- >- if (reference.isContainment()) >+ if (reference.isContainment()) { > EObjectUtil.destroy(object); >- >- else { >- >- if (reference.isMany()) >- ((Collection) container.eGet(reference)).remove(object); >- else >- container.eSet(reference, null); >+ } else { >+ EcoreUtil.remove(container, reference, object); > } > } > } >@@ -1109,8 +1088,7 @@ > EObject newObject, EReference reference, EClass type, > EObject referencer) { > >- if (reference.isMany()) { >- >+ if (FeatureMapUtil.isMany(referencer, reference)) { > List list = (List) referencer.eGet(reference); > > int position = list.indexOf(eObject); >@@ -1125,7 +1103,7 @@ > referencer.eSet(reference, newObject); > > else >- referencer.eSet(reference, null); >+ referencer.eUnset(reference); > } > > /** >@@ -1140,7 +1118,6 @@ > boolean ignore = false; > > for (Iterator k = ignoredObjects.iterator(); k.hasNext();) { >- > EObject ignored = (EObject) k.next(); > > if (EObjectUtil.contains(ignored, referencer)) { >@@ -1151,8 +1128,7 @@ > > if (!ignore) { > >- if (reference.isMany()) { >- >+ if (FeatureMapUtil.isMany(referencer, reference)) { > EList list = (EList) referencer.eGet(reference); > int existingIndex = list.indexOf(replacement); > >@@ -1165,7 +1141,6 @@ > int index = list.indexOf(referenced); > list.add(index, replacement); > } >- > } else > referencer.eSet(reference, replacement); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 129178
: 36011