Search in sources :

Example 1 with CollectionDataType

use of org.palladiosimulator.pcm.repository.CollectionDataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInnerType method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    CollectionDataType cdt = (CollectionDataType) parameters.get("collection");
    DataType dt = DataTypeSelectionWizard.selectDataType(cdt);
    if (dt != null)
        cdt.setInnerType_CollectionDataType(dt);
}
Also used : CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) DataType(org.palladiosimulator.pcm.repository.DataType)

Example 2 with CollectionDataType

use of org.palladiosimulator.pcm.repository.CollectionDataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddCollectionIteratorAction method getParameter.

private Parameter getParameter(CollectionIteratorAction action, ServiceEffectSpecification seff) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(Interface.class);
    filter.add(Signature.class);
    filter.add(Parameter.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, action.eResource().getResourceSet());
    dialog.setProvidedService(Parameter.class);
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (o instanceof Signature) {
            if (!o.equals(seff.getDescribedService__SEFF())) {
                dialog.getTreeViewer().remove(o);
                continue;
            }
            EList<Parameter> parameters = null;
            if (o instanceof OperationSignature)
                parameters = ((OperationSignature) o).getParameters__OperationSignature();
            else if (o instanceof InfrastructureSignature) {
                parameters = ((InfrastructureSignature) o).getParameters__InfrastructureSignature();
            }
            for (Parameter p : parameters) {
                if (!(p.getDataType__Parameter() instanceof CollectionDataType))
                    dialog.getTreeViewer().remove(p);
            }
        }
    }
    dialog.open();
    return (Parameter) dialog.getResult();
}
Also used : OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) Signature(org.palladiosimulator.pcm.repository.Signature) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) ArrayList(java.util.ArrayList) Parameter(org.palladiosimulator.pcm.repository.Parameter) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)2 ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 EReference (org.eclipse.emf.ecore.EReference)1 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)1 DataType (org.palladiosimulator.pcm.repository.DataType)1 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)1 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)1 Parameter (org.palladiosimulator.pcm.repository.Parameter)1 Signature (org.palladiosimulator.pcm.repository.Signature)1