Commit 94759bf9 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ fixed issue where dependencies are omitted when multiple component extensions are defined

parent 8faa3aa1
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
package de.ugoe.cs.swe.T3Q;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -14,10 +15,12 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.xtext.CrossReference;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;

@@ -364,10 +367,13 @@ public class DependencyAnalyzer implements Callable<TTCN3Dependency> {
		HashSet<String> rids = new HashSet<>();
		Map<EObject, Collection<Setting>> crossReferences = EcoreUtil.CrossReferencer.find(Lists.newArrayList(d));
		//TODO: this may be slow
		TreeMap<Integer, EObject> offsetCrossReferences = new TreeMap<>();
		TreeMap<String, EObject> offsetCrossReferences = new TreeMap<>();
		for (EObject o : crossReferences.keySet()) {
			int offset = NodeModelUtils.getNode(crossReferences.get(o).iterator().next().getEObject()).getOffset();
			offsetCrossReferences.put(offset, o);
			offset = NodeModelUtils.getNode(crossReferences.get(o).iterator().next().getEObject()).getOffset();
			int targetOffset = NodeModelUtils.getNode(o).getOffset();
			//TODO: there ought to be more elegant way but it's hard to get the exact offset of the reference
			offsetCrossReferences.put(offset+"->"+targetOffset, o);
		}

		for (EObject o : offsetCrossReferences.values()) {