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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations