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