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

nameclass, %method, %block, %line, %
DownInnerDeclarationAction.java0%   (0/2)0%   (0/5)0%   (0/91)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DownInnerDeclarationAction0%   (0/1)0%   (0/3)0%   (0/42)0%   (0/15)
DownInnerDeclarationAction (PalladioDataTypeDialog, TransactionalEditingDomai... 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 DownInnerDeclarationAction$10%   (0/1)0%   (0/2)0%   (0/49)0%   (0/10)
DownInnerDeclarationAction$1 (DownInnerDeclarationAction, TransactionalEditin... 0%   (0/1)0%   (0/13)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/36)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 downItem - Button in the
17 * CompositeDataType edit area.
18 * 
19 * @author Roman Andrej
20 */
21public class DownInnerDeclarationAction extends EditorContentsSelectionAction
22                implements SelectionListener {
23        
24        private PalladioDataTypeDialog dialog;
25        private TransactionalEditingDomain editingDomain;
26        
27        public DownInnerDeclarationAction(PalladioDataTypeDialog dialog, TransactionalEditingDomain editingDomain) {
28                this.dialog = dialog;
29                this.editingDomain = editingDomain;
30        }
31 
32        /* (non-Javadoc)
33         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
34         */
35        public void widgetSelected(SelectionEvent e) {
36 
37                final InnerDeclaration selectedDeclaration = (InnerDeclaration) getSelectedDeclaration();
38                CompositeDataType parentDataType = (CompositeDataType) selectedDeclaration
39                                .eContainer();
40                final EList<InnerDeclaration> declarations = parentDataType
41                                .getInnerDeclaration_CompositeDataType();
42 
43                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
44                        @Override
45                        protected void doExecute() {
46                                int index = declarations.indexOf(selectedDeclaration);
47                                if (index >= 0 && index < declarations.size() - 1) {
48                                        declarations.move(index, index + 1);
49                                        try {
50                                                UpDownButtonsValidator.getSingelton().validate(
51                                                                index + 1, declarations.size());
52                                        } catch (Exception e) {
53                                                e.printStackTrace();
54                                        }
55                                }
56                        }
57                };
58 
59                recCommand.setDescription("Down ...");
60                editingDomain.getCommandStack().execute(recCommand);
61 
62                dialog.validateInput();
63        }
64 
65        public void widgetDefaultSelected(SelectionEvent e) {
66                // TODO Auto-generated method stub
67                
68        }
69 
70}

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