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

nameclass, %method, %block, %line, %
CallDataTypeDialog.java0%   (0/6)0%   (0/16)0%   (0/228)0%   (0/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CallDataTypeDialog0%   (0/1)0%   (0/5)0%   (0/69)0%   (0/13)
CallDataTypeDialog (Shell, Collection, Collection, Object): void 0%   (0/1)0%   (0/17)0%   (0/5)
access$0 (CallDataTypeDialog, DataType): void 0%   (0/1)0%   (0/4)0%   (0/1)
access$1 (CallDataTypeDialog): TransactionalEditingDomain 0%   (0/1)0%   (0/3)0%   (0/1)
access$2 (CallDataTypeDialog): DataType 0%   (0/1)0%   (0/3)0%   (0/1)
createDialogArea (Composite): Control 0%   (0/1)0%   (0/42)0%   (0/8)
     
class CallDataTypeDialog$10%   (0/1)0%   (0/2)0%   (0/44)0%   (0/11)
CallDataTypeDialog$1 (CallDataTypeDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/38)0%   (0/9)
     
class CallDataTypeDialog$20%   (0/1)0%   (0/2)0%   (0/23)0%   (0/7)
CallDataTypeDialog$2 (CallDataTypeDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/17)0%   (0/5)
     
class CallDataTypeDialog$30%   (0/1)0%   (0/3)0%   (0/36)0%   (0/8)
CallDataTypeDialog$3 (CallDataTypeDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
access$0 (CallDataTypeDialog$3): CallDataTypeDialog 0%   (0/1)0%   (0/3)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/27)0%   (0/6)
     
class CallDataTypeDialog$3$10%   (0/1)0%   (0/2)0%   (0/29)0%   (0/9)
CallDataTypeDialog$3$1 (CallDataTypeDialog$3, TransactionalEditingDomain): void 0%   (0/1)0%   (0/7)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/22)0%   (0/7)
     
class CallDataTypeDialog$40%   (0/1)0%   (0/2)0%   (0/27)0%   (0/8)
CallDataTypeDialog$4 (CallDataTypeDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/21)0%   (0/6)

1package de.uka.ipd.sdq.pcm.dialogs.datatype;
2 
3import java.util.Collection;
4 
5import org.eclipse.core.runtime.Assert;
6import org.eclipse.emf.common.util.EList;
7import org.eclipse.emf.ecore.EObject;
8import org.eclipse.emf.ecore.EReference;
9import org.eclipse.emf.transaction.RecordingCommand;
10import org.eclipse.emf.transaction.TransactionalEditingDomain;
11import org.eclipse.emf.transaction.util.TransactionUtil;
12import org.eclipse.jface.viewers.ISelectionChangedListener;
13import org.eclipse.jface.viewers.IStructuredSelection;
14import org.eclipse.jface.viewers.SelectionChangedEvent;
15import org.eclipse.jface.viewers.TreeViewer;
16import org.eclipse.swt.events.SelectionAdapter;
17import org.eclipse.swt.events.SelectionEvent;
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.swt.widgets.Control;
20import org.eclipse.swt.widgets.Shell;
21 
22import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
23import de.uka.ipd.sdq.pcm.repository.CollectionDataType;
24import de.uka.ipd.sdq.pcm.repository.CompositeDataType;
25import de.uka.ipd.sdq.pcm.repository.DataType;
26import de.uka.ipd.sdq.pcm.repository.Repository;
27 
28/**
29 * The class sets the actions (add, edit, delete), which
30 * PalladioSelectEObjectDialog were defined in.
31 * 
32 * @author Roman Andrej
33 */
34public class CallDataTypeDialog extends PalladioSelectEObjectDialog {
35 
36        private DataType selectedDataType = null;
37 
38        /**
39         * The transactional editing domain which is used to get the commands and
40         * alter the model
41         */
42        private TransactionalEditingDomain editingDomain = null;
43 
44        public CallDataTypeDialog(Shell parent, Collection<Object> filterList,
45                        Collection<EReference> additionalChildReferences,Object input) {
46                super(parent, filterList, additionalChildReferences, input);
47                this.editingDomain = TransactionUtil.getEditingDomain(input);
48        }
49        
50        /* (non-Javadoc)
51         * @see de.uka.ipd.sdq.dialogs.selection.SelectEObjectDialog#createDialogArea(Composite parent)
52         */
53        @Override
54        protected Control createDialogArea(Composite parent) {
55                Composite area = (Composite) super.createDialogArea(parent);
56 
57                /**
58                 * Activire the ToolBar with items
59                 * 
60                 * @See de.uka.ipd.sdq.dialogs.selection.SelectEObjectDialog#enableToolBar(Boolean
61                 *      addItemEnabled, boolean deleteItemEnabled, boolean
62                 *      editItemEnabled)
63                 */
64                enableToolBar(true, false, false);
65 
66                TreeViewer treeViewer = getTreeViewer();
67                treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
68 
69                        public void selectionChanged(SelectionChangedEvent event) {
70                                IStructuredSelection sel = (IStructuredSelection) event
71                                                .getSelection();
72                                EObject selection = (EObject) sel.getFirstElement();
73 
74                                enableToolBar(true, false, false);
75                                if ((selection instanceof CollectionDataType)
76                                                || (selection instanceof CompositeDataType)) {
77                                        selectedDataType = (DataType) selection;
78                                        enableToolBar(true, true, true);
79                                }
80                        }
81                });
82 
83                setAddSelectionListener(new SelectionAdapter() {
84                        
85                        /* (non-Javadoc)
86                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
87                         */
88                        @Override
89                        public void widgetSelected(SelectionEvent e) {
90                                Shell shell = e.widget.getDisplay().getActiveShell();
91                                PalladioDataTypeDialog dialog = new PalladioDataTypeDialog(
92                                                shell,editingDomain);
93                                dialog.open();
94                        }
95 
96                });
97 
98                setDeleteSelectionListener(new SelectionAdapter() {
99                        
100                        /* (non-Javadoc)
101                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
102                         */
103                        @Override
104                        public void widgetSelected(SelectionEvent e) {
105 
106                                RecordingCommand recCommand = new RecordingCommand(
107                                                editingDomain) {
108                                        @Override
109                                        protected void doExecute() {
110                                                Assert.isNotNull(selectedDataType);
111 
112                                                Repository repository = selectedDataType
113                                                                .getRepository__DataType();
114 
115                                                EList<DataType> datatypesRepository = repository
116                                                                .getDataTypes__Repository();
117                                                datatypesRepository.remove(selectedDataType);
118 
119                                        }
120                                };
121 
122                                recCommand.setDescription("Delete the DataType");
123                                editingDomain.getCommandStack().execute(recCommand);
124                                enableToolBar(true, false, false);
125                        }
126                });
127 
128                setEditeSelectionListener(new SelectionAdapter() {
129                        
130                        /* (non-Javadoc)
131                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
132                         */
133                        @Override
134                        public void widgetSelected(SelectionEvent e) {
135 
136                                Assert.isNotNull(selectedDataType);
137                                Shell shell = e.widget.getDisplay().getActiveShell();
138                                PalladioDataTypeDialog dialog = new PalladioDataTypeDialog(
139                                                shell, selectedDataType);
140                                dialog.open();
141 
142                        }
143 
144                });
145                return area;
146        }
147}

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