Search in sources :

Example 61 with EReference

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) EReference(org.eclipse.emf.ecore.EReference)

Example 62 with EReference

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();
}
Also used : EventChannel(org.palladiosimulator.pcm.core.composition.EventChannel) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 63 with EReference

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface)

Example 64 with EReference

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 65 with EReference

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;
}
Also used : IEObjectSnapshot(org.eclipse.xtext.ide.serializer.hooks.IEObjectSnapshot) IResourceDescription(org.eclipse.xtext.resource.IResourceDescription) EObject(org.eclipse.emf.ecore.EObject) IResourceDescriptions(org.eclipse.xtext.resource.IResourceDescriptions) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IEObjectSnapshot(org.eclipse.xtext.ide.serializer.hooks.IEObjectSnapshot) URI(org.eclipse.emf.common.util.URI) IReferenceSnapshot(org.eclipse.xtext.ide.serializer.hooks.IReferenceSnapshot) EReference(org.eclipse.emf.ecore.EReference) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) IReferenceDescription(org.eclipse.xtext.resource.IReferenceDescription)

Aggregations

EReference (org.eclipse.emf.ecore.EReference)229 EObject (org.eclipse.emf.ecore.EObject)118 EClass (org.eclipse.emf.ecore.EClass)58 List (java.util.List)52 ArrayList (java.util.ArrayList)48 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)37 Test (org.junit.Test)31 EAttribute (org.eclipse.emf.ecore.EAttribute)29 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)28 EClassifier (org.eclipse.emf.ecore.EClassifier)21 Resource (org.eclipse.emf.ecore.resource.Resource)21 IdEObject (org.bimserver.emf.IdEObject)18 EList (org.eclipse.emf.common.util.EList)17 IScope (org.eclipse.xtext.scoping.IScope)15 HashMapVirtualObject (org.bimserver.shared.HashMapVirtualObject)14 InternalEObject (org.eclipse.emf.ecore.InternalEObject)14 URI (org.eclipse.emf.common.util.URI)13 EPackage (org.eclipse.emf.ecore.EPackage)12 AbstractEList (org.eclipse.emf.common.util.AbstractEList)10 CrossReference (org.eclipse.xtext.CrossReference)10