EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcmbench.tabs.parameters]

COVERAGE SUMMARY FOR SOURCE FILE [AddComponentParameterAction.java]

nameclass, %method, %block, %line, %
AddComponentParameterAction.java0%   (0/2)0%   (0/6)0%   (0/87)0%   (0/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddComponentParameterAction0%   (0/1)0%   (0/4)0%   (0/34)0%   (0/10)
AddComponentParameterAction (): void 0%   (0/1)0%   (0/6)0%   (0/2)
access$0 (AddComponentParameterAction): AssemblyContext 0%   (0/1)0%   (0/3)0%   (0/1)
setContext (AssemblyContext): void 0%   (0/1)0%   (0/4)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/21)0%   (0/5)
     
class AddComponentParameterAction$10%   (0/1)0%   (0/2)0%   (0/53)0%   (0/26)
AddComponentParameterAction$1 (AddComponentParameterAction, TransactionalEdit... 0%   (0/1)0%   (0/7)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/46)0%   (0/24)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcmbench.tabs.parameters;
5 
6import org.eclipse.emf.transaction.RecordingCommand;
7import org.eclipse.emf.transaction.TransactionalEditingDomain;
8import org.eclipse.emf.transaction.util.TransactionUtil;
9import org.eclipse.swt.events.SelectionAdapter;
10import org.eclipse.swt.events.SelectionEvent;
11 
12import de.uka.ipd.sdq.pcm.core.CoreFactory;
13import de.uka.ipd.sdq.pcm.core.PCMRandomVariable;
14import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
15import de.uka.ipd.sdq.pcm.parameter.ParameterFactory;
16import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation;
17import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
18import de.uka.ipd.sdq.stoex.NamespaceReference;
19import de.uka.ipd.sdq.stoex.StoexFactory;
20import de.uka.ipd.sdq.stoex.VariableReference;
21 
22/**
23 * @author Roman Andrej
24 *
25 */
26public class AddComponentParameterAction extends SelectionAdapter {
27 
28        private AssemblyContext context;
29        
30        /**
31         * The transactional editing domain which is used to get the commands and
32         * alter the model
33         */
34        private TransactionalEditingDomain editingDomain = null;
35        
36 
37        /* (non-Javadoc)
38         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
39         */
40        @Override
41        public void widgetSelected(SelectionEvent e) {
42                editingDomain = TransactionUtil.getEditingDomain(context);
43 
44                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
45                        @Override
46                        protected void doExecute() {
47                                NamespaceReference namespaceReference = StoexFactory.eINSTANCE
48                                                .createNamespaceReference();
49                                namespaceReference.setReferenceName("ReferenceName");
50 
51                                VariableReference variableReference = StoexFactory.eINSTANCE
52                                                .createVariableReference();
53                                variableReference.setReferenceName("INNER");
54 
55                                namespaceReference
56                                                .setInnerReference_NamespaceReference(variableReference);
57                                VariableUsage variableUsage = ParameterFactory.eINSTANCE
58                                                .createVariableUsage();
59                                variableUsage
60                                                .setNamedReference__VariableUsage(namespaceReference);
61 
62                                PCMRandomVariable randomVariable = CoreFactory.eINSTANCE
63                                                .createPCMRandomVariable();
64                                randomVariable.setSpecification("0");
65 
66                                VariableCharacterisation characterisation = ParameterFactory.eINSTANCE
67                                                .createVariableCharacterisation();
68 
69                                characterisation
70                                                .setSpecification_VariableCharacterisation(randomVariable);
71                                variableUsage.getVariableCharacterisation_VariableUsage().add(
72                                                characterisation);
73 
74                                context.getConfigParameterUsages__AssemblyContext().add(
75                                                variableUsage);
76                        }
77                };
78 
79                recCommand.setDescription("Add new VariableUsage");
80                editingDomain.getCommandStack().execute(recCommand);
81        }
82 
83 
84        /**
85         * @param context the context to set
86         */
87        public void setContext(AssemblyContext context) {
88                this.context = context;
89        }
90}

[all classes][de.uka.ipd.sdq.pcmbench.tabs.parameters]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov