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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioAdapterFactoryContentProvider.java]

nameclass, %method, %block, %line, %
PalladioAdapterFactoryContentProvider.java0%   (0/4)0%   (0/15)0%   (0/149)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioAdapterFactoryContentProvider0%   (0/1)0%   (0/7)0%   (0/50)0%   (0/13)
PalladioAdapterFactoryContentProvider (AdapterFactory): void 0%   (0/1)0%   (0/4)0%   (0/2)
access$0 (PalladioAdapterFactoryContentProvider, Object, IItemPropertyDescrip... 0%   (0/1)0%   (0/5)0%   (0/1)
access$1 (PalladioAdapterFactoryContentProvider): AdapterFactory 0%   (0/1)0%   (0/3)0%   (0/1)
createPropertySource (Object, IItemPropertySource): IPropertySource 0%   (0/1)0%   (0/13)0%   (0/3)
getDescriptorWithStoExParser (Object, IItemPropertyDescriptor): IPropertyDesc... 0%   (0/1)0%   (0/7)0%   (0/1)
getExpectedType (RandomVariable): TypeEnum 0%   (0/1)0%   (0/11)0%   (0/4)
getRandomVariablePropertySheet (Object, IItemPropertySource): IPropertySource 0%   (0/1)0%   (0/7)0%   (0/1)
     
class PalladioAdapterFactoryContentProvider$10%   (0/1)0%   (0/2)0%   (0/26)0%   (0/5)
PalladioAdapterFactoryContentProvider$1 (PalladioAdapterFactoryContentProvide... 0%   (0/1)0%   (0/8)0%   (0/2)
createPropertyDescriptor (IItemPropertyDescriptor): IPropertyDescriptor 0%   (0/1)0%   (0/18)0%   (0/3)
     
class PalladioAdapterFactoryContentProvider$20%   (0/1)0%   (0/4)0%   (0/28)0%   (0/4)
PalladioAdapterFactoryContentProvider$2 (PalladioAdapterFactoryContentProvide... 0%   (0/1)0%   (0/8)0%   (0/2)
access$0 (PalladioAdapterFactoryContentProvider$2): Object 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (PalladioAdapterFactoryContentProvider$2): PalladioAdapterFactoryCon... 0%   (0/1)0%   (0/3)0%   (0/1)
createPropertyEditor (Composite): CellEditor 0%   (0/1)0%   (0/14)0%   (0/2)
     
class PalladioAdapterFactoryContentProvider$2$10%   (0/1)0%   (0/2)0%   (0/45)0%   (0/14)
PalladioAdapterFactoryContentProvider$2$1 (PalladioAdapterFactoryContentProvi... 0%   (0/1)0%   (0/8)0%   (0/2)
openDialogBox (Control): Object 0%   (0/1)0%   (0/37)0%   (0/12)

1package de.uka.ipd.sdq.pcmbench.propertytabs;
2 
3import org.eclipse.emf.common.notify.AdapterFactory;
4import org.eclipse.emf.common.ui.celleditor.ExtendedDialogCellEditor;
5import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
6import org.eclipse.emf.edit.provider.IItemPropertySource;
7import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
8import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
9import org.eclipse.emf.edit.ui.provider.PropertyDescriptor;
10import org.eclipse.emf.edit.ui.provider.PropertySource;
11import org.eclipse.jface.dialogs.Dialog;
12import org.eclipse.jface.viewers.CellEditor;
13import org.eclipse.swt.widgets.Composite;
14import org.eclipse.swt.widgets.Control;
15import org.eclipse.ui.views.properties.IPropertyDescriptor;
16import org.eclipse.ui.views.properties.IPropertySource;
17 
18import de.uka.ipd.sdq.pcm.dialogs.stoex.StochasticExpressionEditDialog;
19import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation;
20import de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor;
21import de.uka.ipd.sdq.stoex.RandomVariable;
22import de.uka.ipd.sdq.stoex.analyser.visitors.TypeEnum;
23 
24public class PalladioAdapterFactoryContentProvider extends
25                AdapterFactoryContentProvider {
26 
27        public PalladioAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
28                super(adapterFactory);
29        }
30 
31        @Override
32        protected IPropertySource createPropertySource(Object object, IItemPropertySource itemPropertySource) {
33            if (object instanceof RandomVariable)
34            {
35                    return getRandomVariablePropertySheet(object, itemPropertySource);
36            }
37            else
38                    return super.createPropertySource(object, itemPropertySource);
39        }
40 
41        protected IPropertySource getRandomVariablePropertySheet(Object object,IItemPropertySource itemPropertySource) {
42                return new PropertySource(object, itemPropertySource) {
43 
44                        @Override
45                        protected IPropertyDescriptor createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor) {
46                                if (itemPropertyDescriptor.getDisplayName(object).equals("Specification")) {
47                                        return getDescriptorWithStoExParser(object,itemPropertyDescriptor);
48                                } else {
49                                        return super.createPropertyDescriptor(itemPropertyDescriptor);
50                                }
51                        }
52                        
53                };
54        }
55 
56        private IPropertyDescriptor getDescriptorWithStoExParser(Object object, IItemPropertyDescriptor itemPropertyDescriptor) {
57                return new PropertyDescriptor(object,itemPropertyDescriptor) {
58 
59                        @Override
60                        public CellEditor createPropertyEditor(Composite composite) {
61                                
62                                CellEditor result = new ExtendedDialogCellEditor(composite, new AdapterFactoryLabelProvider(adapterFactory)) {
63 
64                                        @Override
65                                        protected Object openDialogBox(Control cellEditorWindow) {
66                                                RandomVariable randVar = (RandomVariable) object;
67                                                StochasticExpressionEditDialog dialog =
68                                                        new StochasticExpressionEditDialog(
69                                                                        cellEditorWindow.getShell(),
70                                                                        getExpectedType(randVar),
71                                                                        randVar);
72                                                dialog.setInitialExpression(randVar);
73                                                dialog.open();
74                                                if (dialog.getReturnCode() == Dialog.OK) {
75                                                        String result = new PCMStoExPrettyPrintVisitor().prettyPrint(dialog.getResult());
76                                                        return result;
77                                                }
78                                                return null;
79                                        }
80                                };
81                                return result;
82                        }
83                };
84        }
85 
86        protected TypeEnum getExpectedType(RandomVariable rv) {
87                TypeEnum expectedType = TypeEnum.ANY; 
88                if (rv instanceof VariableCharacterisation){
89                        expectedType = StochasticExpressionEditDialog.getTypeFromVariableCharacterisation((VariableCharacterisation) rv);
90                }
91                return expectedType;
92        }        
93}

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