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

nameclass, %method, %block, %line, %
InfrastructureSignaturesCellModifier.java0%   (0/2)0%   (0/8)0%   (0/104)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InfrastructureSignaturesCellModifier0%   (0/1)0%   (0/6)0%   (0/87)0%   (0/27)
InfrastructureSignaturesCellModifier (): void 0%   (0/1)0%   (0/10)0%   (0/4)
access$0 (InfrastructureSignaturesCellModifier): InfrastructureSignature 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/33)0%   (0/12)
setSignatureName (String): void 0%   (0/1)0%   (0/28)0%   (0/7)
     
class InfrastructureSignaturesCellModifier$10%   (0/1)0%   (0/2)0%   (0/17)0%   (0/4)
InfrastructureSignaturesCellModifier$1 (InfrastructureSignaturesCellModifier,... 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.pcmbench.tabs.operations;
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.emf.transaction.util.TransactionUtil;
10import org.eclipse.swt.widgets.TableItem;
11 
12import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature;
13import de.uka.ipd.sdq.pcmbench.tabs.generic.ObservableCellModifier;
14 
15/**Modifier for cells containing infrastructure signature descriptions.
16 * @author Roman Andrej
17 * @author groenda
18 */
19 
20public class InfrastructureSignaturesCellModifier extends ObservableCellModifier {
21 
22        /** Name of the columns. */
23        private List<String> columnNames;
24        /** Signature. */
25        private InfrastructureSignature signature;
26 
27        /** Editing domain for model modifications. */
28        protected TransactionalEditingDomain editingDomain = null;
29 
30        /**Initializes a new instance.
31         */
32        public InfrastructureSignaturesCellModifier() {
33                this.columnNames = Arrays.asList(InfrastructureSignaturesEditorSection.columnNames);
34        }
35 
36        /* (non-Javadoc)
37         * @see org.eclipse.jface.viewers.ICellModifier#canModify(Object element,
38         *      String property)
39         */
40        public boolean canModify(Object element, String property) {
41                return true;
42        }
43 
44        /* (non-Javadoc)
45         * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
46         */
47        public Object getValue(Object element, String property) {
48                return (new InfrastructureSignaturesTabItemProvider(null)).getColumnText(element,
49                                columnNames.indexOf(property));
50        }
51 
52        public void modify(Object element, String property, Object value) {
53 
54                // Find the index of the column
55                int columnIndex = columnNames.indexOf(property);
56 
57                Assert.isNotNull(element);
58                TableItem item = (TableItem) element;
59                signature = (InfrastructureSignature) item.getData();
60                editingDomain = TransactionUtil.getEditingDomain(signature);
61 
62                switch (columnIndex) {
63                case InfrastructureSignaturesEditorSection.ICON_COLUMN_INDEX: // COMPLETED_COLUMN
64                        break;
65                case InfrastructureSignaturesEditorSection.SIGNATURENAME_COLUMN_INDEX: // SERVICENAME_COLUMN
66                        String valueString = ((String) value).trim();
67                        setSignatureName(valueString);
68                        break;
69                case InfrastructureSignaturesEditorSection.PARAMETER_COLUMN_INDEX: // OWNEDPARAMETER_COLUMN
70                        break;
71                case InfrastructureSignaturesEditorSection.EXCEPTIONS_COLUMN_INDEX: // EXEPTIONTYPE_COLUM
72                        break;
73                default:
74                }
75        }
76 
77        /**Sets the name of the infrastructure signature.
78         * @param valueString New name.
79         */
80        private void setSignatureName(String valueString) {
81                final String value = valueString;
82 
83                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
84                        @Override
85                        protected void doExecute() {
86                                signature.setEntityName(value);
87                        }
88                };
89 
90                if (!value.equals(signature.getEntityName())) {
91                        recCommand.setDescription("Edit Infrastructure Signature Property");
92                        recCommand.setLabel("Set signature name");
93                        editingDomain.getCommandStack().execute(recCommand);
94                }
95        }
96}

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