Search in sources :

Example 1 with InfrastructureRequiredRole

use of org.palladiosimulator.pcm.repository.InfrastructureRequiredRole in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInfrastructureSignature method getSignature.

private InfrastructureSignature getSignature(InfrastructureCall call) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(InfrastructureInterface.class);
    filter.add(InfrastructureSignature.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, call.eResource().getResourceSet());
    dialog.setProvidedService(InfrastructureSignature.class);
    // only take required InfrastructureInterfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof InfrastructureInterface))
            continue;
        ServiceEffectSpecification seff = (ServiceEffectSpecification) call.getAction__InfrastructureCall().getResourceDemandingBehaviour_AbstractAction();
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        boolean found = false;
        for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
            if (!(r instanceof InfrastructureRequiredRole))
                continue;
            InfrastructureRequiredRole ir = (InfrastructureRequiredRole) r;
            if (ir.getRequiredInterface__InfrastructureRequiredRole().equals(o)) {
                found = true;
                call.setRequiredRole__InfrastructureCall(ir);
            }
        }
        if (!found)
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (InfrastructureSignature) dialog.getResult();
}
Also used : InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with InfrastructureRequiredRole

use of org.palladiosimulator.pcm.repository.InfrastructureRequiredRole in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddInfrastructureRequiredRole method execute.

@Override
public void execute(Collection<? extends EObject> selection, Map<String, Object> parameters) {
    InfrastructureRequiredRole role = (InfrastructureRequiredRole) parameters.get("instance");
    InfrastructureInterface iInterface = getInfrastructureInterface(role);
    role.setRequiredInterface__InfrastructureRequiredRole(iInterface);
}
Also used : InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface)

Aggregations

InfrastructureInterface (org.palladiosimulator.pcm.repository.InfrastructureInterface)2 InfrastructureRequiredRole (org.palladiosimulator.pcm.repository.InfrastructureRequiredRole)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 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)1 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)1 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)1 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)1