Search in sources :

Example 1 with OperationInterface

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

the class AddExternalCallAction method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    ExternalCallAction extCall = (ExternalCallAction) parameters.get("instance");
    HashMap<OperationInterface, OperationRequiredRole> requiredRolesMap = new HashMap<OperationInterface, OperationRequiredRole>();
    OperationSignature os = getOperationSignature(extCall, requiredRolesMap);
    if (os != null) {
        extCall.setCalledService_ExternalService(os);
        extCall.setRole_ExternalService(requiredRolesMap.get(os.getInterface__OperationSignature()));
    }
}
Also used : HashMap(java.util.HashMap) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ExternalCallAction(org.palladiosimulator.pcm.seff.ExternalCallAction) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole)

Example 2 with OperationInterface

use of org.palladiosimulator.pcm.repository.OperationInterface 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 3 with OperationInterface

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

the class AddOperationRequiredRole method execute.

@Override
public void execute(Collection<? extends EObject> selection, Map<String, Object> parameters) {
    OperationRequiredRole role = (OperationRequiredRole) parameters.get("instance");
    OperationInterface oInterface = getOperationInterface(role);
    role.setRequiredInterface__OperationRequiredRole(oInterface);
}
Also used : OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 4 with OperationInterface

use of org.palladiosimulator.pcm.repository.OperationInterface 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 5 with OperationInterface

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

the class OperationInterfaceTableLifecycleManager method setPropertySection.

@Override
protected void setPropertySection(Composite parent) {
    editorSection = new OperationsEditorSection(parent);
    editorSection.setViewerContentProvider(new AdapterFactoryContentProvider(adapterFactory));
    editorSection.setViewerLabelProvider(new AdapterFactoryLabelProvider(new OperationsTabItemProviderAdapterFactory(new PalladioItemProviderAdapterFactory(adapterFactory))));
    OperationInterface input = (OperationInterface) controller.getValue();
    editorSection.setViewerInput(input);
    ((OperationsEditorSection) editorSection).getAddButtonListener().setSelectedInterface(input);
}
Also used : OperationsEditorSection(org.palladiosimulator.editors.sirius.repository.custom.properties.editorsections.OperationsEditorSection) OperationsTabItemProviderAdapterFactory(org.palladiosimulator.editors.commons.tabs.operations.OperationsTabItemProviderAdapterFactory) AdapterFactoryContentProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) PalladioItemProviderAdapterFactory(org.palladiosimulator.pcm.ui.provider.PalladioItemProviderAdapterFactory) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Aggregations

OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)8 ArrayList (java.util.ArrayList)4 EObject (org.eclipse.emf.ecore.EObject)4 EReference (org.eclipse.emf.ecore.EReference)4 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)4 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)3 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)3 HashMap (java.util.HashMap)1 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)1 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)1 OperationsTabItemProviderAdapterFactory (org.palladiosimulator.editors.commons.tabs.operations.OperationsTabItemProviderAdapterFactory)1 OperationsEditorSection (org.palladiosimulator.editors.sirius.repository.custom.properties.editorsections.OperationsEditorSection)1 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)1 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)1 ExternalCallAction (org.palladiosimulator.pcm.seff.ExternalCallAction)1 ResourceDemandingBehaviour (org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour)1 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)1 PalladioItemProviderAdapterFactory (org.palladiosimulator.pcm.ui.provider.PalladioItemProviderAdapterFactory)1