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

COVERAGE SUMMARY FOR SOURCE FILE [UpInnerDeclarationAction.java]

nameclass, %method, %block, %line, %
UpInnerDeclarationAction.java0%   (0/2)0%   (0/5)0%   (0/84)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class UpInnerDeclarationAction0%   (0/1)0%   (0/3)0%   (0/42)0%   (0/15)
UpInnerDeclarationAction (PalladioDataTypeDialog, TransactionalEditingDomain)... 0%   (0/1)0%   (0/9)0%   (0/4)
widgetDefaultSelected (SelectionEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/32)0%   (0/10)
     
class UpInnerDeclarationAction$10%   (0/1)0%   (0/2)0%   (0/42)0%   (0/10)
UpInnerDeclarationAction$1 (UpInnerDeclarationAction, TransactionalEditingDom... 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.datatype;
2 
3import org.eclipse.emf.common.util.EList;
4import org.eclipse.emf.transaction.RecordingCommand;
5import org.eclipse.emf.transaction.TransactionalEditingDomain;
6import org.eclipse.swt.events.SelectionEvent;
7import org.eclipse.swt.events.SelectionListener;
8 
9import de.uka.ipd.sdq.pcm.dialogs.parameters.EditorContentsSelectionAction;
10import de.uka.ipd.sdq.pcm.dialogs.parameters.UpDownButtonsValidator;
11import de.uka.ipd.sdq.pcm.repository.CompositeDataType;
12import de.uka.ipd.sdq.pcm.repository.InnerDeclaration;
13 
14/**
15 * This adapter class provides default implementations for the methods described
16 * by the SelectionListener interface to upItem - Button in the ColpositeDataType edit area.
17 * 
18 * @author Roman Andrej
19 */
20public class UpInnerDeclarationAction extends EditorContentsSelectionAction implements
21                SelectionListener {
22 
23        private PalladioDataTypeDialog dialog;
24        private TransactionalEditingDomain editingDomain;
25 
26        public UpInnerDeclarationAction(PalladioDataTypeDialog dialog, TransactionalEditingDomain editingDomain) {
27                this.dialog = dialog;
28                this.editingDomain = editingDomain;
29        }
30 
31        /* (non-Javadoc)
32         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
33         */
34        public void widgetSelected(SelectionEvent e) {
35 
36                final InnerDeclaration selectedDeclaration = (InnerDeclaration) getSelectedDeclaration();
37                CompositeDataType parentDataType = (CompositeDataType) selectedDeclaration
38                                .eContainer();
39                final EList<InnerDeclaration> declarations = parentDataType
40                                .getInnerDeclaration_CompositeDataType();
41 
42                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
43                        @Override
44                        protected void doExecute() {
45                                int index = declarations.indexOf(selectedDeclaration);
46                                if (index > 0) {
47                                        declarations.move(index, index - 1);
48                                        try {
49                                                UpDownButtonsValidator.getSingelton().validate(
50                                                                index - 1, declarations.size());
51                                        } catch (Exception e) {
52                                                e.printStackTrace();
53                                        }
54                                }
55                        }
56                };
57 
58                recCommand.setDescription("Up ...");
59                editingDomain.getCommandStack().execute(recCommand);
60 
61                dialog.validateInput();
62        }
63 
64        public void widgetDefaultSelected(SelectionEvent e) {
65                // TODO Auto-generated method stub
66        }
67}

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