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

COVERAGE SUMMARY FOR SOURCE FILE [AddParameterAction.java]

nameclass, %method, %block, %line, %
AddParameterAction.java0%   (0/2)0%   (0/5)0%   (0/79)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddParameterAction0%   (0/1)0%   (0/3)0%   (0/46)0%   (0/13)
AddParameterAction (Signature): void 0%   (0/1)0%   (0/19)0%   (0/7)
access$0 (AddParameterAction): String 0%   (0/1)0%   (0/3)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/24)0%   (0/6)
     
class AddParameterAction$10%   (0/1)0%   (0/2)0%   (0/33)0%   (0/7)
AddParameterAction$1 (AddParameterAction, TransactionalEditingDomain, EList):... 0%   (0/1)0%   (0/10)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/23)0%   (0/5)

1package de.uka.ipd.sdq.pcm.dialogs.parameters;
2 
3import org.eclipse.core.runtime.Assert;
4import org.eclipse.emf.common.util.EList;
5import org.eclipse.emf.transaction.RecordingCommand;
6import org.eclipse.emf.transaction.TransactionalEditingDomain;
7import org.eclipse.emf.transaction.util.TransactionUtil;
8import org.eclipse.swt.events.SelectionAdapter;
9import org.eclipse.swt.events.SelectionEvent;
10 
11import de.uka.ipd.sdq.pcm.repository.Parameter;
12import de.uka.ipd.sdq.pcm.repository.RepositoryFactory;
13import de.uka.ipd.sdq.pcm.repository.Signature;
14 
15/**
16 * The class define an action, which a new parameter for the signature adds.
17 * 
18 * @author Roman Andrej
19 */
20public class AddParameterAction extends SelectionAdapter{
21 
22        /** Default name of a newly created parameter. Not guaranteed to be unique. */
23        private static final String DEFAULT_PARAMETER_NAME = "parameter";
24        
25        private Signature parentSignature = null;
26        private String parameterName = DEFAULT_PARAMETER_NAME;
27 
28        /**
29         * The transactional editing domain which is used to get the commands and
30         * alter the model
31         */
32        private TransactionalEditingDomain editingDomain = null;
33 
34        public AddParameterAction(Signature parentSignature) {
35                this.parentSignature = parentSignature;
36                this.editingDomain = TransactionUtil.getEditingDomain(parentSignature);
37        }
38 
39        /* (non-Javadoc)
40         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
41         */
42        @Override
43        public void widgetSelected(SelectionEvent e) {
44                Assert.isNotNull(parentSignature);
45 
46                final EList<Parameter> parameters = ParametersUtil.getParametersOfSignature(parentSignature);
47                
48                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
49                        @Override
50                        protected void doExecute() {
51                                Parameter parameter = RepositoryFactory.eINSTANCE
52                                                .createParameter();
53                                parameter.setParameterName(parameterName + parameters.size());
54                                parameters.add(parameter);
55                        }
56                };
57 
58                recCommand.setDescription("Add new parameter to the signature");
59                editingDomain.getCommandStack().execute(recCommand);
60        }
61}

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