public void resolve( String identifier, org.emftext.language.petrinets.Setting container, org.eclipse.emf.ecore.EReference reference, int position, boolean resolveFuzzy, final org.emftext.language.petrinets.resource.petrinets.IPetrinetsReferenceResolveResult< org.eclipse.emf.ecore.EStructuralFeature> result) { EClassifier type; if (container.eContainer() instanceof ProducingArc) { ProducingArc arc = (ProducingArc) container.eContainer(); type = FunctionCallAnalysisHelper.getInstance().getType(arc.getOutput()); } else { ConstructorCall cc = (ConstructorCall) container.eContainer(); type = cc.getType(); } List<EStructuralFeature> candidates = new ArrayList<EStructuralFeature>(); if (type != null && type instanceof EClass) { EClass c = (EClass) type; candidates.addAll(c.getEAllStructuralFeatures()); } else if (type instanceof EDataType) { EAttribute dummy = EcoreFactory.eINSTANCE.createEAttribute(); dummy.setName(type.getName()); dummy.setEType(type); dummy.setUpperBound(1); dummy.setLowerBound(1); candidates.add(dummy); } for (EStructuralFeature eStructuralFeature : candidates) { if (resolveFuzzy) { result.addMapping(eStructuralFeature.getName(), eStructuralFeature); } else if (identifier.equals(eStructuralFeature.getName())) { result.addMapping(eStructuralFeature.getName(), eStructuralFeature); } } }
public void resolve( String identifier, org.emftext.language.petrinets.ProducingArc container, org.eclipse.emf.ecore.EReference reference, int position, boolean resolveFuzzy, final org.emftext.language.petrinets.resource.petrinets.IPetrinetsReferenceResolveResult< org.emftext.language.petrinets.Transition> result) { PetriNet pn = (PetriNet) container.eContainer(); EList<Component> components = pn.getComponents(); for (Component component : components) { if (component instanceof Transition) { if (resolveFuzzy) { result.addMapping(component.getName(), (Transition) component); } else if (component.getName().equals(identifier)) { result.addMapping(component.getName(), (Transition) component); return; } } } }