1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.usage.helper; |
5 | |
6 | import java.util.ArrayList; |
7 | |
8 | import org.eclipse.emf.ecore.EReference; |
9 | import org.eclipse.gmf.runtime.common.core.command.ICommand; |
10 | import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; |
11 | import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice; |
12 | import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; |
13 | import org.eclipse.ui.PlatformUI; |
14 | |
15 | import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog; |
16 | import de.uka.ipd.sdq.pcm.repository.OperationInterface; |
17 | import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole; |
18 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
19 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
20 | import de.uka.ipd.sdq.pcm.system.System; |
21 | |
22 | /** |
23 | * @author roman, Christian Busch |
24 | * @generated NOT |
25 | */ |
26 | public class EntryLevelSystemCallEditHelperAdvice extends |
27 | AbstractEditHelperAdvice implements IEditHelperAdvice { |
28 | |
29 | /** |
30 | * This command opens two selection dialogs for choosing the system operation provided role and interface. |
31 | * |
32 | */ |
33 | @Override |
34 | protected ICommand getAfterConfigureCommand(ConfigureRequest request) { |
35 | |
36 | OperationSignature signature = null; |
37 | OperationProvidedRole providedRole = null; |
38 | ArrayList<Object> filterList = new ArrayList<Object>(); |
39 | filterList.add(System.class); |
40 | filterList.add(OperationProvidedRole.class); |
41 | |
42 | /* first dialog for selection of the operation provided role */ |
43 | ArrayList<EReference> additionalReferences = new ArrayList<EReference>(); |
44 | additionalReferences.add(RepositoryPackage.eINSTANCE |
45 | .getOperationProvidedRole_ProvidedInterface__OperationProvidedRole()); |
46 | |
47 | PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog( |
48 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), |
49 | filterList, additionalReferences, request.getEditingDomain() |
50 | .getResourceSet()); |
51 | dialog.setProvidedService(OperationProvidedRole.class); |
52 | dialog.open(); |
53 | if (dialog.getResult() == null) |
54 | return new CanceledCommand(); |
55 | if (!(dialog.getResult() instanceof OperationProvidedRole)) |
56 | return new CanceledCommand(); |
57 | |
58 | providedRole = (OperationProvidedRole)dialog.getResult(); |
59 | |
60 | /* second dialog for selection of the signature of the interface */ |
61 | filterList.clear(); |
62 | filterList.add(OperationProvidedRole.class); |
63 | filterList.add(OperationInterface.class); |
64 | filterList.add(OperationSignature.class); |
65 | |
66 | dialog = new PalladioSelectEObjectDialog( |
67 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), |
68 | filterList, additionalReferences, providedRole); |
69 | dialog.setProvidedService(OperationSignature.class); |
70 | dialog.open(); |
71 | if (dialog.getResult() == null) |
72 | return new CanceledCommand(); |
73 | if (!(dialog.getResult() instanceof OperationSignature)) |
74 | return new CanceledCommand(); |
75 | signature = (OperationSignature) dialog.getResult(); |
76 | |
77 | |
78 | return new EntryLevelSystemCallConfigureCommand(request,signature,providedRole); |
79 | } |
80 | } |