use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddAllocationContextAssemblyContext method getAssemblyContext.
private AssemblyContext getAssemblyContext(AllocationContext allocationContext) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(org.palladiosimulator.pcm.system.System.class);
filter.add(AssemblyContext.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, allocationContext.eResource().getResourceSet());
dialog.setProvidedService(AssemblyContext.class);
dialog.open();
return (AssemblyContext) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddAllocationContextEventChannel method getEventChannel.
private EventChannel getEventChannel(AllocationContext allocationContext) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(org.palladiosimulator.pcm.system.System.class);
filter.add(EventChannel.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, allocationContext.eResource().getResourceSet());
dialog.setProvidedService(EventChannel.class);
dialog.open();
return (EventChannel) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddInfrastructureProvidedRole method getInfrastructureInterface.
private InfrastructureInterface getInfrastructureInterface(InfrastructureProvidedRole role) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(InfrastructureInterface.class);
// Additional Child References
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
// Creating the dialog
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, role.eResource().getResourceSet());
// Setting the needed object type
dialog.setProvidedService(InfrastructureInterface.class);
dialog.open();
return (InfrastructureInterface) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddOperationRequiredRole method getOperationInterface.
private OperationInterface getOperationInterface(OperationRequiredRole role) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(OperationInterface.class);
// Additional Child References
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
// Creating the dialog
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, role.eResource().getResourceSet());
// Setting the needed object type
dialog.setProvidedService(OperationInterface.class);
dialog.open();
return (OperationInterface) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project xtext-core by eclipse.
the class EObjectSnapshotProvider method createEObjectSnapshots.
protected Map<EObject, IEObjectSnapshot> createEObjectSnapshots(Resource resource) {
Map<EObject, IEObjectSnapshot> result = Maps.newLinkedHashMap();
for (IEObjectDescription desc : descriptionProvider.getEObjectDescriptions(resource)) {
EObject obj = EcoreUtil.resolve(desc.getEObjectOrProxy(), resource);
EObjectSnapshot snapshot = getOrCreate(result, obj);
snapshot.descriptions.add(desc);
}
ResourceSet resourceSet = resource.getResourceSet();
IResourceDescriptions descriptions = resourceDescriptionsProvider.getResourceDescriptions(resourceSet);
URI uri = resource.getURI();
for (IResourceDescription desc : descriptions.getAllResourceDescriptions()) {
for (IReferenceDescription ref : desc.getReferenceDescriptions()) {
URI targetURI = ref.getTargetEObjectUri();
URI sourceEObjectUri = ref.getSourceEObjectUri();
EReference reference = ref.getEReference();
if (targetURI == null || sourceEObjectUri == null || reference == null) {
continue;
}
if (!uri.equals(targetURI.trimFragment())) {
continue;
}
EObject target = resource.getEObject(targetURI.fragment());
if (target == null || target.eIsProxy()) {
continue;
}
EObjectSnapshot snapshot = getOrCreate(result, target);
ReferenceSnapshot rd = new ReferenceSnapshot(sourceEObjectUri, snapshot, reference, ref.getIndexInList(), ref.getContainerEObjectURI());
snapshot.incomingReferences.add(rd);
}
}
return result;
}
Aggregations