Search in sources :

Example 1 with PalladioSelectEObjectDialog

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

the class AddSourceRole method getEventGroup.

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

Example 2 with PalladioSelectEObjectDialog

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

the class DataTypeSelectionWizard method selectDataType.

public static DataType selectDataType(EObject eObject) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(DataType.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, eObject.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(DataType.class);
    dialog.open();
    return (DataType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) DataType(org.palladiosimulator.pcm.repository.DataType) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 3 with PalladioSelectEObjectDialog

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

the class AddProcessingResourceSpecification 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)

Example 4 with PalladioSelectEObjectDialog

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

the class AddAcquireAction method getPassiveResource.

private PassiveResource getPassiveResource(AcquireAction acquireAction) {
    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>();
    // additionalChildReferences.add(RepositoryPackage.Literals.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE);
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, acquireAction.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 5 with PalladioSelectEObjectDialog

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

the class AddEmitEventAction method getEventType.

private EventType getEventType(EmitEventAction emitEventAction) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(EventGroup.class);
    filter.add(EventType.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, emitEventAction.eResource().getResourceSet());
    dialog.setProvidedService(EventType.class);
    // Only show EventTypes from EventGroups from SourceRoles of the parent BasicComponent
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof EventGroup))
            continue;
        ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(emitEventAction.getResourceDemandingBehaviour_AbstractAction());
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        boolean found = false;
        for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
            if (!(r instanceof SourceRole))
                continue;
            SourceRole sourceRole = (SourceRole) r;
            if (sourceRole.getEventGroup__SourceRole().equals(o)) {
                found = true;
                emitEventAction.setSourceRole__EmitEventAction(sourceRole);
            }
        }
        if (!found)
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (EventType) dialog.getResult();
}
Also used : SourceRole(org.palladiosimulator.pcm.repository.SourceRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) EventType(org.palladiosimulator.pcm.repository.EventType) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) EventGroup(org.palladiosimulator.pcm.repository.EventGroup) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) 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