1 | package de.uka.ipd.sdq.pcm.dialogs.variableusage; |
2 | |
3 | import java.util.ArrayList; |
4 | |
5 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
6 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
7 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
8 | import de.uka.ipd.sdq.pcm.repository.ParameterModifier; |
9 | import de.uka.ipd.sdq.pcm.repository.RepositoryFactory; |
10 | |
11 | public class VariableUsageOutputParameterContentProvider extends |
12 | VariableUsageContentProvider { |
13 | |
14 | @Override |
15 | public Object[] getChildren(Object parent) { |
16 | if (parent instanceof OperationSignature) { |
17 | /* |
18 | * Business Operation Signature |
19 | */ |
20 | OperationSignature signature = (OperationSignature) parent; |
21 | ArrayList<Parameter> outputParameter = new ArrayList<Parameter>(); |
22 | for (Parameter p : signature.getParameters__OperationSignature()) { |
23 | if (p.getModifier__Parameter() == ParameterModifier.OUT || |
24 | p.getModifier__Parameter() == ParameterModifier.INOUT){ |
25 | outputParameter.add(p); |
26 | } |
27 | } |
28 | if (signature.getReturnType__OperationSignature() != null){ |
29 | Parameter ret = RepositoryFactory.eINSTANCE.createParameter(); |
30 | ret.setDataType__Parameter(signature.getReturnType__OperationSignature()); |
31 | ret.setParameterName("RETURN"); |
32 | outputParameter.add(ret); |
33 | } |
34 | return outputParameter.toArray(); |
35 | } else if (parent instanceof InfrastructureSignature) { |
36 | // There are no output parameters for infrastructure signature. |
37 | return new ArrayList<Parameter>().toArray(); |
38 | } else { |
39 | return super.getChildren(parent); |
40 | } |
41 | } |
42 | |
43 | } |