File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/resource/persistence Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 1313import java .io .IOException ;
1414import java .util .ArrayList ;
1515import java .util .List ;
16+ import java .util .Stack ;
1617
1718import org .eclipse .emf .common .notify .Adapter ;
1819import org .eclipse .emf .common .notify .Notification ;
@@ -87,17 +88,23 @@ static void installProxyNodeModel(final Resource resource) {
8788 }
8889
8990 private static ProxyCompositeNode installProxyNodeModel (final EObject eObject , final List <EObject > map ) {
90- ProxyCompositeNode result = new ProxyCompositeNode ();
91- eObject .eAdapters ().add (result );
91+ Stack <EObject > stack = new Stack <>(); // NOPMD LooseCoupling
92+ stack .push (eObject );
93+ ProxyCompositeNode rootComposite = new ProxyCompositeNode ();
94+ eObject .eAdapters ().add (rootComposite );
9295 map .add (eObject );
9396
94- for (FeatureIterator <EObject > it = (FeatureIterator <EObject >) eObject .eContents ().iterator (); it .hasNext ();) {
95- EObject child = it .next ();
96- if (!it .feature ().isTransient ()) {
97- installProxyNodeModel (child , map );
97+ while (!stack .isEmpty ()) {
98+ for (FeatureIterator <EObject > it = (FeatureIterator <EObject >) stack .pop ().eContents ().reversed ().iterator (); it .hasNext ();) {
99+ EObject child = it .next ();
100+ if (!it .feature ().isTransient ()) {
101+ child .eAdapters ().add (new ProxyCompositeNode ());
102+ map .add (child );
103+ stack .push (child );
104+ }
98105 }
99106 }
100- return result ;
107+ return rootComposite ;
101108 }
102109
103110 /**
You can’t perform that action at this time.
0 commit comments