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

nameclass, %method, %block, %line, %
UpParameterAction.java0%   (0/2)0%   (0/5)0%   (0/82)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class UpParameterAction0%   (0/1)0%   (0/3)0%   (0/40)0%   (0/12)
UpParameterAction (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 UpParameterAction$10%   (0/1)0%   (0/2)0%   (0/42)0%   (0/10)
UpParameterAction$1 (UpParameterAction, TransactionalEditingDomain, EList, Pa... 0%   (0/1)0%   (0/13)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/29)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 described
15 * by the SelectionListener interface to upItem - Button in the ParameterDialog.
16 * 
17 * @author Roman Andrej
18 */
19public class UpParameterAction extends EditorContentsSelectionAction
20                implements SelectionListener {
21 
22        private Signature parentSignature;
23 
24        /**
25         * The transactional editing domain which is used to get the commands and
26         * alter the model
27         */
28        protected TransactionalEditingDomain editingDomain = null;
29 
30        public UpParameterAction(Signature signature) {
31                this.parentSignature = signature;
32                this.editingDomain = TransactionUtil.getEditingDomain(signature);
33        }
34 
35        /* (non-Javadoc)
36         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
37         */
38        public void widgetSelected(SelectionEvent e) {
39                final Parameter selectedParameter = (Parameter) getSelectedDeclaration();
40                final EList<Parameter> parameters = ParametersUtil.getParametersOfSignature(parentSignature);
41 
42                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
43                        @Override
44                        protected void doExecute() {
45                                int index = parameters.indexOf(selectedParameter);
46                                if (index != 0) {
47                                        parameters.move(index, index - 1);
48                                        try {
49                                                UpDownButtonsValidator.getSingelton().validate(
50                                                                index - 1, parameters.size());
51                                        } catch (Exception e) {
52                                                e.printStackTrace();
53                                        }
54                                }
55                        }
56                };
57 
58                recCommand.setDescription("Up ...");
59                editingDomain.getCommandStack().execute(recCommand);
60        }
61 
62        public void widgetDefaultSelected(SelectionEvent e) {
63                // TODO Auto-generated method stub
64                
65        }
66}

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