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

nameclass, %method, %block, %line, %
DownParameterAction.java0%   (0/2)0%   (0/5)0%   (0/87)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DownParameterAction0%   (0/1)0%   (0/3)0%   (0/40)0%   (0/12)
DownParameterAction (Signature): void 0%   (0/1)0%   (0/13)0%   (0/5)
widgetDefaultSelected (SelectionEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/26)0%   (0/6)
     
class DownParameterAction$10%   (0/1)0%   (0/2)0%   (0/47)0%   (0/10)
DownParameterAction$1 (DownParameterAction, TransactionalEditingDomain, EList... 0%   (0/1)0%   (0/13)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/34)0%   (0/8)

1package de.uka.ipd.sdq.pcm.dialogs.parameters;
2 
3import org.eclipse.emf.common.util.EList;
4import org.eclipse.emf.transaction.RecordingCommand;
5import org.eclipse.emf.transaction.TransactionalEditingDomain;
6import org.eclipse.emf.transaction.util.TransactionUtil;
7import org.eclipse.swt.events.SelectionEvent;
8import org.eclipse.swt.events.SelectionListener;
9 
10import de.uka.ipd.sdq.pcm.repository.Parameter;
11import de.uka.ipd.sdq.pcm.repository.Signature;
12 
13 /**
14         * This adapter class provides default implementations for the methods
15         * described by the SelectionListener interface to downItem - Button in the
16         * ParameterDialog.
17         * 
18         * @author Roman Roman
19         * 
20         */
21public class DownParameterAction extends EditorContentsSelectionAction
22                implements SelectionListener {
23 
24        private Signature parentSignature;
25 
26        /**
27         * The transactional editing domain which is used to get the commands and
28         * alter the model
29         */
30        private TransactionalEditingDomain editingDomain = null;
31 
32        public DownParameterAction(Signature signature) {
33                this.parentSignature = signature;
34                this.editingDomain = TransactionUtil.getEditingDomain(signature);
35        }
36 
37        /* (non-Javadoc)
38         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
39         */
40        public void widgetSelected(SelectionEvent e) {
41                final Parameter selectedParameter = (Parameter) getSelectedDeclaration();
42                final EList<Parameter> parameters = ParametersUtil.getParametersOfSignature(parentSignature);
43 
44                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
45                        @Override
46                        protected void doExecute() {
47                                int index = parameters.indexOf(selectedParameter);
48                                if (index < parameters.size() - 1) {
49                                        parameters.move(index, index + 1);
50                                        try {
51                                                UpDownButtonsValidator.getSingelton().validate(
52                                                                index + 1, parameters.size());
53                                        } catch (Exception e) {
54                                                e.printStackTrace();
55                                        }
56                                }
57                        }
58                };
59 
60                recCommand.setDescription("Down ...");
61                editingDomain.getCommandStack().execute(recCommand);
62        }
63 
64        public void widgetDefaultSelected(SelectionEvent e) {
65                // TODO Auto-generated method stub
66                
67        }
68}

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