use of org.palladiosimulator.pcm.repository.ProvidedRole 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();
}
Aggregations