Search in sources :

Example 1 with ResourceInterface

use of org.palladiosimulator.pcm.resourcetype.ResourceInterface in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetResourceInterface method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    ResourceRequiredRole resourceRequiredRole = (ResourceRequiredRole) parameters.get("instance");
    ResourceInterface resourceInterface = getResourceInterface(resourceRequiredRole);
    if (resourceInterface != null)
        resourceRequiredRole.setRequiredResourceInterface__ResourceRequiredRole(resourceInterface);
}
Also used : ResourceRequiredRole(org.palladiosimulator.pcm.core.entity.ResourceRequiredRole) ResourceInterface(org.palladiosimulator.pcm.resourcetype.ResourceInterface)

Example 2 with ResourceInterface

use of org.palladiosimulator.pcm.resourcetype.ResourceInterface in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetResourceCallSignature method getSignature.

private ResourceSignature getSignature(final ResourceCall call) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(ResourceRepository.class);
    filter.add(ResourceSignature.class);
    filter.add(ResourceInterface.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, call.eResource().getResourceSet());
    dialog.setProvidedService(ResourceSignature.class);
    // only take required InfrastructureInterfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof ResourceInterface)) {
            continue;
        }
        ResourceRequiredRole resourceRequiredRole = call.getResourceRequiredRole__ResourceCall();
        if (!resourceRequiredRole.getRequiredResourceInterface__ResourceRequiredRole().equals(o)) {
            dialog.getTreeViewer().remove(o);
        }
    }
    dialog.open();
    return (ResourceSignature) dialog.getResult();
}
Also used : ResourceSignature(org.palladiosimulator.pcm.resourcetype.ResourceSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) ResourceRequiredRole(org.palladiosimulator.pcm.core.entity.ResourceRequiredRole) EObject(org.eclipse.emf.ecore.EObject) ResourceInterface(org.palladiosimulator.pcm.resourcetype.ResourceInterface) EReference(org.eclipse.emf.ecore.EReference)

Example 3 with ResourceInterface

use of org.palladiosimulator.pcm.resourcetype.ResourceInterface in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetResourceInterface method getResourceInterface.

private ResourceInterface getResourceInterface(ResourceRequiredRole resourceRequiredRole) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(ResourceRepository.class);
    filter.add(ResourceInterface.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, resourceRequiredRole.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(ResourceInterface.class);
    dialog.open();
    return (ResourceInterface) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ResourceInterface(org.palladiosimulator.pcm.resourcetype.ResourceInterface) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

ResourceInterface (org.palladiosimulator.pcm.resourcetype.ResourceInterface)3 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 EReference (org.eclipse.emf.ecore.EReference)2 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)2 ResourceRequiredRole (org.palladiosimulator.pcm.core.entity.ResourceRequiredRole)2 ResourceSignature (org.palladiosimulator.pcm.resourcetype.ResourceSignature)1