Search in sources :

Example 1 with InfrastructureInterface

use of org.palladiosimulator.pcm.repository.InfrastructureInterface 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 InfrastructureInterface

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

the class InfrastructureInterfaceTableLifecycleManager method setPropertySection.

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

Example 3 with InfrastructureInterface

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

the class AddInfrastructureProvidedRole method getInfrastructureInterface.

private InfrastructureInterface getInfrastructureInterface(InfrastructureProvidedRole role) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(InfrastructureInterface.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(InfrastructureInterface.class);
    dialog.open();
    return (InfrastructureInterface) 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) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface)

Example 4 with InfrastructureInterface

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

the class AddInfrastructureProvidedRole method execute.

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

Example 5 with InfrastructureInterface

use of org.palladiosimulator.pcm.repository.InfrastructureInterface 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)6 ArrayList (java.util.ArrayList)3 EObject (org.eclipse.emf.ecore.EObject)3 EReference (org.eclipse.emf.ecore.EReference)3 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)3 InfrastructureRequiredRole (org.palladiosimulator.pcm.repository.InfrastructureRequiredRole)2 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)1 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)1 InfrastructureSignaturesTabItemProviderAdapterFactory (org.palladiosimulator.editors.commons.tabs.operations.InfrastructureSignaturesTabItemProviderAdapterFactory)1 InfrastructureSignaturesEditorSection (org.palladiosimulator.editors.sirius.repository.custom.properties.editorsections.InfrastructureSignaturesEditorSection)1 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)1 InfrastructureProvidedRole (org.palladiosimulator.pcm.repository.InfrastructureProvidedRole)1 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)1 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)1 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)1 PalladioItemProviderAdapterFactory (org.palladiosimulator.pcm.ui.provider.PalladioItemProviderAdapterFactory)1