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

nameclass, %method, %block, %line, %
AddInnerDeclarationAction.java0%   (0/2)0%   (0/6)0%   (0/97)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddInnerDeclarationAction0%   (0/1)0%   (0/4)0%   (0/53)0%   (0/14)
AddInnerDeclarationAction (PalladioDataTypeDialog, TransactionalEditingDomain... 0%   (0/1)0%   (0/16)0%   (0/6)
access$0 (AddInnerDeclarationAction): CompositeDataType 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (AddInnerDeclarationAction, CompositeDataType): void 0%   (0/1)0%   (0/4)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/30)0%   (0/7)
     
class AddInnerDeclarationAction$10%   (0/1)0%   (0/2)0%   (0/44)0%   (0/14)
AddInnerDeclarationAction$1 (AddInnerDeclarationAction, TransactionalEditingD... 0%   (0/1)0%   (0/7)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/37)0%   (0/12)

1package de.uka.ipd.sdq.pcm.dialogs.datatype;
2 
3import org.eclipse.emf.transaction.RecordingCommand;
4import org.eclipse.emf.transaction.TransactionalEditingDomain;
5import org.eclipse.swt.events.SelectionAdapter;
6import org.eclipse.swt.events.SelectionEvent;
7 
8import de.uka.ipd.sdq.pcm.repository.CompositeDataType;
9import de.uka.ipd.sdq.pcm.repository.InnerDeclaration;
10import de.uka.ipd.sdq.pcm.repository.RepositoryFactory;
11 
12/**
13 * The class define an action, which a new InnerDeclaration to the CompositeDateType adds.
14 * 
15 * @author Roman Andrej
16 */
17public class AddInnerDeclarationAction extends SelectionAdapter {
18 
19        private CompositeDataType compositeDataType;
20        private PalladioDataTypeDialog dialog;
21        
22        /**
23         * The transactional editing domain which is used to get the commands and
24         * alter the model
25         */
26        private TransactionalEditingDomain editingDomain = null;
27 
28        /**
29         * @param compositeDataType
30         */
31        public AddInnerDeclarationAction(PalladioDataTypeDialog dialog, TransactionalEditingDomain editingDomain) {
32                this.dialog = dialog;
33                this.editingDomain = editingDomain;
34                this.compositeDataType = dialog.getCompositeDataType();
35        }
36 
37        /*
38         * (non-Javadoc)
39         * 
40         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
41         */
42        @Override
43        public void widgetSelected(SelectionEvent e) {
44 
45                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
46                        @Override
47                        protected void doExecute() {
48 
49                                if (compositeDataType == null) {
50                                        // nur for own instance of the compositeDataType
51                                        compositeDataType = RepositoryFactory.eINSTANCE
52                                                        .createCompositeDataType();
53                                }
54                                InnerDeclaration declaration = RepositoryFactory.eINSTANCE
55                                                .createInnerDeclaration();
56                                // Build the name with count
57                                String declaratonName = "DeclarationName"
58                                                + (compositeDataType
59                                                                .getInnerDeclaration_CompositeDataType().size() + 1);
60 
61                                declaration.setEntityName(declaratonName);
62 
63                                compositeDataType.getInnerDeclaration_CompositeDataType().add(
64                                                declaration);
65                        }
66                };
67 
68                recCommand.setDescription("Add new CompositeDataTYpe");
69                editingDomain.getCommandStack().execute(recCommand);
70 
71                /**
72                 * set and validate a new CompositeDataType 
73                 */
74                dialog.setCompositeDataType(compositeDataType);
75                dialog.getEditorContents().setViewerInput(compositeDataType);
76                dialog.validateInput();
77        }
78}

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