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

COVERAGE SUMMARY FOR SOURCE FILE [OperationsEditorSection.java]

nameclass, %method, %block, %line, %
OperationsEditorSection.java0%   (0/3)0%   (0/18)0%   (0/218)0%   (0/51)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationsEditorSection0%   (0/1)0%   (0/14)0%   (0/139)0%   (0/31)
<static initializer> 0%   (0/1)0%   (0/24)0%   (0/3)
OperationsEditorSection (Composite): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (OperationsEditorSection): TableViewer 0%   (0/1)0%   (0/3)0%   (0/1)
canAddButonCreated (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
canDeleteButonCreated (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
createAddButtonActionListener (): SelectionListener 0%   (0/1)0%   (0/8)0%   (0/2)
createDeleteButtonListener (): SelectionListener 0%   (0/1)0%   (0/4)0%   (0/1)
createTableColumns (Table): void 0%   (0/1)0%   (0/37)0%   (0/8)
createViewerCellEditors (Table): CellEditor [] 0%   (0/1)0%   (0/40)0%   (0/8)
createViewerCellModifier (): ObservableCellModifier 0%   (0/1)0%   (0/4)0%   (0/1)
getAddButtonListener (): OperationAddActionListener 0%   (0/1)0%   (0/3)0%   (0/1)
getSelectedSignature (): Signature 0%   (0/1)0%   (0/4)0%   (0/1)
getTableColumnNames (): String [] 0%   (0/1)0%   (0/2)0%   (0/1)
inputValidation (EObject): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
     
class OperationsEditorSection$10%   (0/1)0%   (0/2)0%   (0/54)0%   (0/16)
OperationsEditorSection$1 (OperationsEditorSection, Composite, SelectionListe... 0%   (0/1)0%   (0/8)0%   (0/2)
openDialogBox (Control): Object 0%   (0/1)0%   (0/46)0%   (0/14)
     
class OperationsEditorSection$20%   (0/1)0%   (0/2)0%   (0/25)0%   (0/7)
OperationsEditorSection$2 (OperationsEditorSection, Composite): void 0%   (0/1)0%   (0/7)0%   (0/2)
openDialogBox (Control): Object 0%   (0/1)0%   (0/18)0%   (0/5)

1package de.uka.ipd.sdq.pcmbench.tabs.operations;
2 
3 
4import java.util.ArrayList;
5 
6import org.eclipse.emf.ecore.EObject;
7import org.eclipse.emf.ecore.EReference;
8import org.eclipse.emf.transaction.TransactionalEditingDomain;
9import org.eclipse.emf.transaction.util.TransactionUtil;
10import org.eclipse.jface.dialogs.Dialog;
11import org.eclipse.jface.viewers.CellEditor;
12import org.eclipse.jface.viewers.DialogCellEditor;
13import org.eclipse.jface.viewers.TextCellEditor;
14import org.eclipse.swt.SWT;
15import org.eclipse.swt.events.SelectionListener;
16import org.eclipse.swt.widgets.Composite;
17import org.eclipse.swt.widgets.Control;
18import org.eclipse.swt.widgets.Table;
19import org.eclipse.swt.widgets.TableColumn;
20 
21import de.uka.ipd.sdq.pcm.dialogs.datatype.CallDataTypeDialog;
22import de.uka.ipd.sdq.pcm.dialogs.parameters.ParametersDialog;
23import de.uka.ipd.sdq.pcm.repository.DataType;
24import de.uka.ipd.sdq.pcm.repository.Repository;
25import de.uka.ipd.sdq.pcm.repository.Signature;
26import de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection;
27import de.uka.ipd.sdq.pcmbench.tabs.generic.ObservableCellModifier;
28 
29public class OperationsEditorSection extends EditorSection{
30 
31        public static final int ICON_COLUMN_INDEX = 0;
32        public static final int RETURNTYPE_COLUMN_INDEX = 1;
33        public static final int SIGNATURENAME_COLUMN_INDEX = 2;
34        public static final int PARAMETER_COLUMN_INDEX = 3;
35        public static final int EXCEPTIONS_COLUMN_INDEX = 4;
36        
37        /**
38         * Columns of a table, which is used into operations table
39         */
40        public final static String OPERATIONS_ICON_COLUMN        = "";
41        public final static String OWNEDPARAMETER_COLUMN         = "OwnedParameters";
42        public final static String RETURNTYPE_COLUMN                 = "ReturnType";
43        public final static String SERVICENAME_COLUMN                 = "ServiceName";
44        public final static String EXEPTIONTYPE_COLUM                = "ExeptionType";
45        
46        //         Set column names of Tabele
47        public static String[] columnNames = new String[] { OPERATIONS_ICON_COLUMN,RETURNTYPE_COLUMN,
48                        SERVICENAME_COLUMN, OWNEDPARAMETER_COLUMN, EXEPTIONTYPE_COLUM };
49        
50        /** Define the Add-Button listener. Listener must by later initialized. */
51        private OperationAddActionListener addButtonListener;
52 
53        /** Constructor */
54        public OperationsEditorSection(Composite composite) {
55                super(composite);
56        }
57 
58        /* (non-Javadoc)
59         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#createViewerCellEditors(org.eclipse.swt.widgets.Table)
60         */
61        @Override
62        protected CellEditor[] createViewerCellEditors(Table table) {
63                CellEditor[] editors = new CellEditor[columnNames.length];
64 
65                editors[SIGNATURENAME_COLUMN_INDEX] = new TextCellEditor(table);
66 
67                // create 'DeleteCellValueListener' and as SelectionListener to the 'TableVewer'
68                OperationDeleteCellValueListener cellValueListener = new OperationDeleteCellValueListener(viewer);
69                viewer.addSelectionChangedListener(cellValueListener);
70 
71                editors[RETURNTYPE_COLUMN_INDEX] = new TypeDialogCellEditor(table,
72                                cellValueListener) {
73                        
74                        /* (non-Javadoc)
75                         * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control)
76                         */
77                        @Override
78                        protected Object openDialogBox(Control cellEditorWindow) {
79                                TransactionalEditingDomain editingDomain = TransactionUtil
80                                                .getEditingDomain(getSelectedSignature());
81 
82                                ArrayList<Object> filterList = new ArrayList<Object>();
83                                filterList.add(DataType.class);
84                                filterList.add(Repository.class);
85                                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
86 
87                                CallDataTypeDialog dialog = new CallDataTypeDialog(
88                                                cellEditorWindow.getShell(), filterList,
89                                                additionalReferences, editingDomain.getResourceSet());
90                                dialog.setProvidedService(DataType.class);
91                                dialog.open();
92 
93                                if (!(dialog.getResult() instanceof DataType))
94                                        return null;
95 
96                                return dialog.getResult();
97                        }
98                };
99 
100                editors[PARAMETER_COLUMN_INDEX] = new DialogCellEditor(table) {
101                        @Override
102                        protected Object openDialogBox(Control cellEditorWindow) {
103                                ParametersDialog dialog = new ParametersDialog(cellEditorWindow
104                                                .getShell(), getSelectedSignature());
105                                if (dialog.open() == Dialog.OK)
106                                        viewer.refresh();
107                                return null;
108                        }
109                };
110 
111                return editors;
112        }
113        
114        /* (non-Javadoc)
115         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#createViewerCellModifier()
116         */
117        @Override
118        protected ObservableCellModifier createViewerCellModifier() {
119                return new OperationsCellModifier();
120        }
121 
122        /* (non-Javadoc)
123         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#createTableColumns(org.eclipse.swt.widgets.Table)
124         */
125        @Override
126        protected void createTableColumns(Table table) {
127                // 1st column
128                TableColumn column = new TableColumn(table, SWT.CENTER, 0);
129                column.setText("");
130                column.setWidth(25);
131 
132                for (int i = 1; i < columnNames.length; i++) {
133                        // n-te column with task Description
134                        column = new TableColumn(table, SWT.LEFT, i);
135                        column.setText((String) columnNames[i]);
136                        column.setWidth(140);
137                }
138        }
139        
140        /* (non-Javadoc)
141         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#createAddButtonActionListener()
142         */
143        @Override
144        protected SelectionListener createAddButtonActionListener() {
145                // the value must by initialized! (don't return new AddActionListener()) 
146                this.addButtonListener = new OperationAddActionListener();
147                
148                return addButtonListener;
149        }
150 
151        /* (non-Javadoc)
152         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#createDeleteButtonListener()
153         */
154        @Override
155        protected SelectionListener createDeleteButtonListener() {
156                return new OperationDeleteActionListener();
157        }
158 
159        /* (non-Javadoc)
160         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#getViewerColumnProperties()
161         */
162        @Override
163        protected String[] getTableColumnNames() {
164                return columnNames;
165        }
166        
167        /* (non-Javadoc)
168         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#canAddButonCreated()
169         */
170        @Override
171        protected boolean canAddButonCreated() {
172                return true;
173        }
174 
175        /* (non-Javadoc)
176         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#canDeleteButonCreated()
177         */
178        @Override
179        protected boolean canDeleteButonCreated() {
180                return true;
181        }
182        
183        /* (non-Javadoc)
184         * @see de.uka.ipd.sdq.pcmbench.tabs.generic.EditorSection#inputValidation(org.eclipse.emf.ecore.EObject)
185         */
186        @Override
187        protected boolean inputValidation(EObject object) {
188                return true;
189        }
190 
191        public Signature getSelectedSignature() {
192                return (Signature) getSelectedObject();
193        }
194 
195        /**
196         * @return the addButtonListener
197         */
198        public OperationAddActionListener getAddButtonListener() {
199                return addButtonListener;
200        }
201}

[all classes][de.uka.ipd.sdq.pcmbench.tabs.operations]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov