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

COVERAGE SUMMARY FOR SOURCE FILE [ExceptionsCellModifier.java]

nameclass, %method, %block, %line, %
ExceptionsCellModifier.java0%   (0/2)0%   (0/8)0%   (0/102)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExceptionsCellModifier0%   (0/1)0%   (0/6)0%   (0/85)0%   (0/26)
ExceptionsCellModifier (TableViewer, TransactionalEditingDomain): void 0%   (0/1)0%   (0/16)0%   (0/6)
access$0 (ExceptionsCellModifier): ExceptionType 0%   (0/1)0%   (0/3)0%   (0/1)
canModify (Object, String): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
getValue (Object, String): Object 0%   (0/1)0%   (0/11)0%   (0/2)
modify (Object, String, Object): void 0%   (0/1)0%   (0/27)0%   (0/10)
setExceptionName (String): void 0%   (0/1)0%   (0/26)0%   (0/6)
     
class ExceptionsCellModifier$10%   (0/1)0%   (0/2)0%   (0/17)0%   (0/4)
ExceptionsCellModifier$1 (ExceptionsCellModifier, TransactionalEditingDomain,... 0%   (0/1)0%   (0/10)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/7)0%   (0/2)

1package de.uka.ipd.sdq.pcm.dialogs.exception;
2 
3import java.util.Arrays;
4import java.util.List;
5 
6import org.eclipse.core.runtime.Assert;
7import org.eclipse.emf.transaction.RecordingCommand;
8import org.eclipse.emf.transaction.TransactionalEditingDomain;
9import org.eclipse.jface.viewers.ICellModifier;
10import org.eclipse.jface.viewers.TableViewer;
11import org.eclipse.swt.widgets.TableItem;
12 
13import de.uka.ipd.sdq.pcm.repository.ExceptionType;
14 
15/** author roman */
16public class ExceptionsCellModifier implements ICellModifier {
17 
18        private List<String> columnNames;
19        private ExceptionType exceptionType;
20        private TableViewer viewer;
21 
22        /**
23         * The transactional editing domain which is used to get the commands and
24         * alter the model
25         */
26        protected TransactionalEditingDomain editingDomain = null;
27 
28        public ExceptionsCellModifier(TableViewer viewer, TransactionalEditingDomain editingDomain) {
29                this.columnNames = Arrays.asList(ExceptionsDialog.getColumnNames());
30                this.editingDomain = editingDomain;
31                this.viewer = viewer;
32        }
33 
34        /* (non-Javadoc)
35         * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object,
36         *      java.lang.String)
37         */
38        public boolean canModify(Object element, String property) {
39                return true;
40        }
41 
42        /* (non-Javadoc)
43         * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object,
44         *      java.lang.String)
45         */
46        public Object getValue(Object element, String property) {
47                return (new ExceptionsItemProvider(null)).getColumnText(element,
48                                columnNames.indexOf(property));
49        }
50 
51        /* (non-Javadoc)
52         * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object,
53         *      java.lang.String, java.lang.Object)
54         */
55        public void modify(Object element, String property, Object value) {
56 
57                // Find the index of the column
58                int columnIndex = columnNames.indexOf(property);
59 
60                Assert.isNotNull(element);
61                TableItem item = (TableItem) element;
62                exceptionType = (ExceptionType) item.getData();
63 
64                switch (columnIndex) {
65                case ExceptionsDialog.ICON_COLUMN_INDEX: // COMPLETED_COLUMN
66                        break;
67                case ExceptionsDialog.CONTEXT_COLUMN_INDEX: // RETURNTYPE_COLUMN
68                        break;
69                case ExceptionsDialog.NAME_COLUMN_INDEX: // SERVICENAME_COLUMN
70                        String valueString = ((String) value).trim();
71                        setExceptionName(valueString);
72                        break;
73                default:
74                }
75        }
76 
77 
78        /**
79         * Set ExceptionName of the selected Signature
80         */
81        private void setExceptionName(final String value) {
82 
83                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
84                        @Override
85                        protected void doExecute() {
86                                exceptionType.setExceptionName(value);
87                        }
88                };
89 
90                if (!value.equals(exceptionType.getExceptionName())) {
91                        recCommand.setLabel("Set ParameterName");
92                        editingDomain.getCommandStack().execute(recCommand);
93                        
94                        /** Refresh TableViewer*/
95                        viewer.refresh();
96                }
97        }
98}

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