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

COVERAGE SUMMARY FOR SOURCE FILE [ParametersTabItemProvider.java]

nameclass, %method, %block, %line, %
ParametersTabItemProvider.java0%   (0/1)0%   (0/4)0%   (0/59)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParametersTabItemProvider0%   (0/1)0%   (0/4)0%   (0/59)0%   (0/23)
ParametersTabItemProvider (AdapterFactory): void 0%   (0/1)0%   (0/9)0%   (0/3)
getColumnImage (Object, int): Object 0%   (0/1)0%   (0/8)0%   (0/3)
getColumnText (Object, int): String 0%   (0/1)0%   (0/23)0%   (0/9)
getSpecification (VariableUsage): String 0%   (0/1)0%   (0/19)0%   (0/8)

1package de.uka.ipd.sdq.pcmbench.tabs.parameters;
2 
3import org.eclipse.emf.common.notify.AdapterFactory;
4import org.eclipse.emf.common.util.EList;
5import org.eclipse.emf.edit.provider.IItemLabelProvider;
6import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
7import org.eclipse.emf.edit.provider.ItemProviderDecorator;
8 
9import de.uka.ipd.sdq.pcm.core.PCMRandomVariable;
10import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation;
11import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
12import de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor;
13 
14/**
15 * @author Snowball This class is a decorator for the generated EMF.Edit item
16 *         providers. It provides item providers which are used in the
17 *         operations tab of the tabbed properties sheet when editing
18 *         interfaces. It implements ITableItemLabelProvider to display the
19 *         given EObject in a tabular form. Additionally it provided the labels
20 *         by partcial delegation to the original IItemLabelProvider.
21 */
22public class ParametersTabItemProvider extends ItemProviderDecorator implements
23                ITableItemLabelProvider, IItemLabelProvider {
24        
25        private PCMStoExPrettyPrintVisitor print;
26 
27        /**
28         * Inherited default constructor
29         * 
30         * @param factory
31         *            The factory which created this object
32         */
33        public ParametersTabItemProvider(AdapterFactory factory) {
34                super(factory);
35                print = new PCMStoExPrettyPrintVisitor();
36        }
37 
38        /*
39         * (non-Javadoc)
40         * 
41         * @see org.eclipse.emf.edit.provider.ItemProviderDecorator#getColumnImage(java.lang.Object,
42         *      int)
43         */
44        @Override
45        public Object getColumnImage(Object object, int columnIndex) {
46                if (columnIndex == ComponentParametersEditorSection.ICON_COLUMN_INDEX)
47                        return this.getImage(object);
48                return null;
49        }
50 
51        /**
52         * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
53         *      int) Format the columns with the given index constant as string text
54         *      for displaying
55         */
56        @Override
57        public String getColumnText(Object element, int columnIndex) {
58                String result = "";
59                VariableUsageWrapper variable = (VariableUsageWrapper) element;
60 
61                switch (columnIndex) {
62                case ComponentParametersEditorSection.ICON_COLUMN_INDEX:
63                        break;
64                case ComponentParametersEditorSection.VARIABLE_COLUMN_INDEX:
65                        result = print.prettyPrint(variable.getVariableUsage());
66                        break;
67                case ComponentParametersEditorSection.STOEX_COLUMN_INDEX:
68                        result = getSpecification(variable.getVariableUsage());
69                        break;
70                default:
71                        break;
72                }
73                return result;
74        }
75        
76        
77        private String getSpecification(VariableUsage variable) {
78                String specification = "";
79                EList<VariableCharacterisation> characterisation = variable
80                                .getVariableCharacterisation_VariableUsage();
81                if (characterisation.size() > 0) {
82                        PCMRandomVariable randomVariable = characterisation.get(0)
83                                        .getSpecification_VariableCharacterisation();
84                        specification = randomVariable.getSpecification();
85                }
86                return specification;
87        }
88 
89}

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