EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.seff.helper]

COVERAGE SUMMARY FOR SOURCE FILE [ExternalCallActionEditHelperAdvice.java]

nameclass, %method, %block, %line, %
ExternalCallActionEditHelperAdvice.java0%   (0/1)0%   (0/3)0%   (0/96)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExternalCallActionEditHelperAdvice0%   (0/1)0%   (0/3)0%   (0/96)0%   (0/28)
ExternalCallActionEditHelperAdvice (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAfterConfigureCommand (ConfigureRequest): ICommand 0%   (0/1)0%   (0/82)0%   (0/23)
searchBasicComponent (EObject): EObject 0%   (0/1)0%   (0/11)0%   (0/4)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.helper;
5 
6import java.util.ArrayList;
7 
8import org.eclipse.emf.ecore.EObject;
9import org.eclipse.emf.ecore.EReference;
10import org.eclipse.gmf.runtime.common.core.command.ICommand;
11import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
12import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
13import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
14import org.eclipse.ui.PlatformUI;
15 
16import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
17import de.uka.ipd.sdq.pcm.repository.BasicComponent;
18import de.uka.ipd.sdq.pcm.repository.OperationInterface;
19import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
20import de.uka.ipd.sdq.pcm.repository.OperationSignature;
21import de.uka.ipd.sdq.pcm.repository.RepositoryPackage;
22 
23/**
24 * @author Roman Andrej
25 * 
26 */
27public class ExternalCallActionEditHelperAdvice extends
28                AbstractEditHelperAdvice implements IEditHelperAdvice {
29 
30        /* (non-Javadoc)
31         * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest)
32         */
33        @Override
34        protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
35                EObject eObject = searchBasicComponent(request.getElementToConfigure());
36                OperationRequiredRole requiredRole = null;
37                
38                // define the filter list
39                ArrayList<Object> filterList = new ArrayList<Object>();
40                filterList.add(OperationRequiredRole.class);
41                filterList.add(OperationInterface.class);
42                filterList.add(OperationSignature.class);
43                
44                // define the additional references
45                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
46                additionalReferences.add(RepositoryPackage.eINSTANCE
47                                .getOperationRequiredRole_RequiredInterface__OperationRequiredRole());
48                
49                // create the dialog
50                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(
51                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
52                                filterList, additionalReferences, eObject);
53                dialog.setProvidedService(OperationSignature.class);
54                dialog.open();
55                if (dialog.getResult() == null)
56                        return new CanceledCommand();
57                if (!(dialog.getResult() instanceof OperationSignature))
58                        return new CanceledCommand();
59                
60                // set the signature for ExternalCallAction 
61                OperationSignature signature = (OperationSignature) dialog.getResult();
62                
63                // set the required role for ExternalCallAction 
64                if (dialog.getViewerRootElement() instanceof OperationRequiredRole) {
65                        requiredRole = (OperationRequiredRole) dialog.getRootOfResult();
66                }
67 
68                // create and execute the ExternalCallActionConfigureCommand command
69                return new ExternalCallActionConfigureCommand(request, signature,
70                                requiredRole);
71        }
72 
73        private EObject searchBasicComponent(EObject elementToConfigure) {
74                EObject o = elementToConfigure;
75                while (!(o instanceof BasicComponent))
76                        o = o.eContainer();
77                return o;
78        }
79}

[all classes][de.uka.ipd.sdq.pcm.gmf.seff.helper]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov