Search in sources :

Example 16 with PalladioSelectEObjectDialog

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

the class AddSystemSpecifiedExecutionTime method getSignature.

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

Example 17 with PalladioSelectEObjectDialog

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

the class AddSEFF method getSignature.

private Signature getSignature(ResourceDemandingSEFF seff) {
    // Filter list (Repository > Interface > Signature)
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(Interface.class);
    filter.add(Signature.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, seff.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(Signature.class);
    // Filter: Show only provided interfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        EList<ProvidedRole> providedRoles = parent.getProvidedRoles_InterfaceProvidingEntity();
        if (o instanceof Interface) {
            boolean found = false;
            for (ProvidedRole p : providedRoles) {
                if (p instanceof OperationProvidedRole) {
                    OperationProvidedRole role = (OperationProvidedRole) p;
                    if (role.getProvidedInterface__OperationProvidedRole().equals(o))
                        found = true;
                } else if (p instanceof InfrastructureProvidedRole) {
                    InfrastructureProvidedRole role = (InfrastructureProvidedRole) p;
                    if (role.getProvidedInterface__InfrastructureProvidedRole().equals(o))
                        found = true;
                } else if (p instanceof SinkRole) {
                    SinkRole role = (SinkRole) p;
                    if (role.getEventGroup__SinkRole().equals(o))
                        found = true;
                }
            }
            if (!found)
                dialog.getTreeViewer().remove(o);
        }
    }
    dialog.open();
    return (Signature) dialog.getResult();
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) SinkRole(org.palladiosimulator.pcm.repository.SinkRole) ArrayList(java.util.ArrayList) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) InfrastructureProvidedRole(org.palladiosimulator.pcm.repository.InfrastructureProvidedRole) ProvidedRole(org.palladiosimulator.pcm.repository.ProvidedRole) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) Signature(org.palladiosimulator.pcm.repository.Signature) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference) Interface(org.palladiosimulator.pcm.repository.Interface) InfrastructureProvidedRole(org.palladiosimulator.pcm.repository.InfrastructureProvidedRole)

Example 18 with PalladioSelectEObjectDialog

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

the class SetResourceInterface method getResourceInterface.

private ResourceInterface getResourceInterface(ResourceRequiredRole resourceRequiredRole) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(ResourceRepository.class);
    filter.add(ResourceInterface.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, resourceRequiredRole.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(ResourceInterface.class);
    dialog.open();
    return (ResourceInterface) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ResourceInterface(org.palladiosimulator.pcm.resourcetype.ResourceInterface) EReference(org.eclipse.emf.ecore.EReference)

Example 19 with PalladioSelectEObjectDialog

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

the class AddHDDProcessingResourceSpecification method getResourceType.

private ProcessingResourceType getResourceType(final ProcessingResourceSpecification processingResourceSpecification) {
    // positive filter
    final ArrayList<Object> filterList = new ArrayList<Object>();
    // Set types to show and their super types
    filterList.add(ProcessingResourceType.class);
    filterList.add(ResourceRepository.class);
    final ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
    // set EReference that should be set (in this case: active resource type)
    additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_ActiveResourceType_ActiveResourceSpecification());
    final PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), filterList, additionalReferences, processingResourceSpecification.getResourceContainer_ProcessingResourceSpecification().eResource().getResourceSet());
    dialog.setProvidedService(ProcessingResourceType.class);
    dialog.open();
    if (dialog.getResult() == null || !(dialog.getResult() instanceof ProcessingResourceType)) {
        return null;
    }
    return (ProcessingResourceType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) EReference(org.eclipse.emf.ecore.EReference)

Example 20 with PalladioSelectEObjectDialog

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

the class AddHDDProcessingResourceSpecification method getSchedulingPolicy.

private SchedulingPolicy getSchedulingPolicy(final ProcessingResourceSpecification processingResourceSpecification) {
    final ResourceSet set = (processingResourceSpecification.getResourceContainer_ProcessingResourceSpecification()).eResource().getResourceSet();
    // positive filter
    final ArrayList<Object> filterList = new ArrayList<Object>();
    // Set types to show and their super types
    filterList.add(SchedulingPolicy.class);
    filterList.add(ResourceRepository.class);
    final ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
    // set EReference that should be set (in this case: SchedulingPolicy)
    additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_SchedulingPolicy());
    final PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), filterList, additionalReferences, set);
    dialog.setProvidedService(SchedulingPolicy.class);
    dialog.open();
    if (dialog.getResult() == null || !(dialog.getResult() instanceof SchedulingPolicy)) {
        return null;
    }
    return (SchedulingPolicy) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) SchedulingPolicy(org.palladiosimulator.pcm.resourcetype.SchedulingPolicy) 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