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 [InfrastructureCallEditHelperAdvice.java]

nameclass, %method, %block, %line, %
InfrastructureCallEditHelperAdvice.java0%   (0/1)0%   (0/3)0%   (0/121)0%   (0/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureCallEditHelperAdvice0%   (0/1)0%   (0/3)0%   (0/121)0%   (0/36)
InfrastructureCallEditHelperAdvice (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAfterConfigureCommand (ConfigureRequest): ICommand 0%   (0/1)0%   (0/107)0%   (0/31)
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.jface.dialogs.Dialog;
15import org.eclipse.ui.PlatformUI;
16 
17import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
18import de.uka.ipd.sdq.pcm.dialogs.stoex.StochasticExpressionEditDialog;
19import de.uka.ipd.sdq.pcm.repository.BasicComponent;
20import de.uka.ipd.sdq.pcm.repository.InfrastructureInterface;
21import de.uka.ipd.sdq.pcm.repository.InfrastructureRequiredRole;
22import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature;
23import de.uka.ipd.sdq.pcm.repository.RepositoryPackage;
24import de.uka.ipd.sdq.stoex.analyser.visitors.TypeEnum;
25 
26/**Advice for the EditHelper of InfrastructureCall. Displays the dialogs for selection of infrastructure required role and signature.
27 * @author groenda
28 */
29public class InfrastructureCallEditHelperAdvice extends
30                AbstractEditHelperAdvice implements IEditHelperAdvice {
31 
32        /* (non-Javadoc)
33         * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest)
34         */
35        @Override
36        protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
37                EObject eObject = searchBasicComponent(request.getElementToConfigure());
38                InfrastructureRequiredRole requiredRole = null;
39                
40                // define the filter list
41                ArrayList<Object> filterList = new ArrayList<Object>();
42                filterList.add(InfrastructureRequiredRole.class);
43                filterList.add(InfrastructureInterface.class);
44                filterList.add(InfrastructureSignature.class);
45                
46                // define the additional references
47                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
48                additionalReferences
49                                .add(RepositoryPackage.eINSTANCE
50                                                .getInfrastructureRequiredRole_RequiredInterface__InfrastructureRequiredRole());
51                
52                // create the call target dialog
53                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(
54                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
55                                filterList, additionalReferences, eObject);
56                dialog.setProvidedService(InfrastructureSignature.class);
57                dialog.open();
58                if (dialog.getResult() == null)
59                        return new CanceledCommand();
60                if (!(dialog.getResult() instanceof InfrastructureSignature))
61                        return new CanceledCommand();
62                // set the signature for InfrastructureCall 
63                InfrastructureSignature signature = (InfrastructureSignature) dialog.getResult();
64                // set the required role for InfrastructureCall 
65                if (dialog.getViewerRootElement() instanceof InfrastructureRequiredRole) {
66                        requiredRole = (InfrastructureRequiredRole) dialog.getRootOfResult();
67                }
68                
69                //create the number of calls dialog
70                StochasticExpressionEditDialog dialogNoC = new StochasticExpressionEditDialog(
71                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
72                                TypeEnum.INT, request.getElementToConfigure());
73                dialogNoC.open();
74                if (dialogNoC.getReturnCode() == Dialog.CANCEL)
75                        return new CanceledCommand();
76                String numberOfCalls = dialogNoC.getResultText();
77 
78                // create and execute the ExternalCallActionConfigureCommand command
79                return new InfrastructureCallConfigureCommand(request, signature,
80                                requiredRole, numberOfCalls);
81        }
82 
83        private EObject searchBasicComponent(EObject elementToConfigure) {
84                EObject o = elementToConfigure;
85                while (!(o instanceof BasicComponent))
86                        o = o.eContainer();
87                return o;
88        }
89}

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