mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
[resource] clear adapters on root element when unloading
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372563
This commit is contained in:
parent
ec5fb021ac
commit
a2945fc474
2 changed files with 5 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
|||
package org.eclipse.xtext.parser.antlr;
|
||||
|
||||
import static com.google.common.collect.Lists.*;
|
||||
import static java.util.Collections.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -47,6 +48,7 @@ public interface IReferableElementsUnloader {
|
|||
// => first calculate all fragments, then proxify elements starting form root.
|
||||
List<Pair<EObject, URI>> elementsToUnload = newArrayList();
|
||||
elementsToUnload.add(Tuples.create(root, EcoreUtil.getURI(root)));
|
||||
root.eAdapters().clear();
|
||||
for (Iterator<EObject> i = EcoreUtil.getAllProperContents(root, false); i.hasNext();) {
|
||||
EObject element = i.next();
|
||||
elementsToUnload.add(Tuples.create(element, EcoreUtil.getURI(element)));
|
||||
|
|
|
@ -34,8 +34,10 @@ public class GenericUnloaderTest extends Assert {
|
|||
e.printStackTrace();
|
||||
fail("Unload does not cope with contentAdpaters");
|
||||
}
|
||||
// isEmtpy() does not work in EMF 3.5
|
||||
assertEquals(0, root.eAdapters().size());
|
||||
}
|
||||
|
||||
|
||||
protected EPackage createExample() {
|
||||
ResourceSetImpl resourceSet = new ResourceSetImpl();
|
||||
Resource resource = new XMIResourceImpl(URI.createURI("test"));
|
||||
|
@ -47,6 +49,4 @@ public class GenericUnloaderTest extends Assert {
|
|||
return root;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue