Search in sources :

Example 6 with PalladioSelectEObjectDialog

use of org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddExternalCallAction method getOperationSignature.

private OperationSignature getOperationSignature(ExternalCallAction extCall, HashMap<OperationInterface, OperationRequiredRole> requiredRolesMap) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(OperationInterface.class);
    filter.add(OperationSignature.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, extCall.eResource().getResourceSet());
    dialog.setProvidedService(OperationSignature.class);
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (// if the current object is not an OperationInterface, skip.
        !(o instanceof OperationInterface))
            continue;
        ResourceDemandingBehaviour rd = extCall.getResourceDemandingBehaviour_AbstractAction();
        ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(rd);
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        // if o is not referenced by any OperationRequiredRole, remove it from the tree viewer
        OperationRequiredRole requiredRole = getOperationRequiredRole(parent.getRequiredRoles_InterfaceRequiringEntity(), (OperationInterface) o);
        if (requiredRole != null)
            requiredRolesMap.put((OperationInterface) o, requiredRole);
        else
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (OperationSignature) dialog.getResult();
}
Also used : ResourceDemandingBehaviour(org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) EReference(org.eclipse.emf.ecore.EReference) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole)

Example 7 with PalladioSelectEObjectDialog

use of org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddReleaseAction method getPassiveResource.

private PassiveResource getPassiveResource(ReleaseAction releaseAction) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(BasicComponent.class);
    filter.add(PassiveResource.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, releaseAction.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(PassiveResource.class);
    dialog.open();
    return (PassiveResource) dialog.getResult();
}
Also used : PassiveResource(org.palladiosimulator.pcm.repository.PassiveResource) 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 8 with PalladioSelectEObjectDialog

use of org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog 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 9 with PalladioSelectEObjectDialog

use of org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog 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 10 with PalladioSelectEObjectDialog

use of org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class EntryLevelSystemCallDialog method getOperationProvidedRole.

private OperationProvidedRole getOperationProvidedRole(EntryLevelSystemCall element) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(System.class);
    filter.add(OperationProvidedRole.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, element.eResource().getResourceSet());
    dialog.setProvidedService(OperationProvidedRole.class);
    dialog.open();
    return (OperationProvidedRole) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)29 ArrayList (java.util.ArrayList)28 EObject (org.eclipse.emf.ecore.EObject)28 EReference (org.eclipse.emf.ecore.EReference)28 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)4 EventGroup (org.palladiosimulator.pcm.repository.EventGroup)4 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)4 InfrastructureInterface (org.palladiosimulator.pcm.repository.InfrastructureInterface)3 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)3 Signature (org.palladiosimulator.pcm.repository.Signature)3 ProcessingResourceType (org.palladiosimulator.pcm.resourcetype.ProcessingResourceType)3 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)3 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 ResourceRequiredRole (org.palladiosimulator.pcm.core.entity.ResourceRequiredRole)2 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)2 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)2 PassiveResource (org.palladiosimulator.pcm.repository.PassiveResource)2 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)2 ResourceInterface (org.palladiosimulator.pcm.resourcetype.ResourceInterface)2 SchedulingPolicy (org.palladiosimulator.pcm.resourcetype.SchedulingPolicy)2