Search in sources :

Example 1 with ResourceSignature

use of org.palladiosimulator.pcm.resourcetype.ResourceSignature 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 2 with ResourceSignature

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

the class SetResourceCallSignature method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    ResourceCall call = (ResourceCall) parameters.get("instance");
    ResourceSignature sig = getSignature(call);
    call.setSignature__ResourceCall(sig);
}
Also used : ResourceSignature(org.palladiosimulator.pcm.resourcetype.ResourceSignature) ResourceCall(org.palladiosimulator.pcm.seff.seff_performance.ResourceCall)

Aggregations

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