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

COVERAGE SUMMARY FOR SOURCE FILE [GenericPropertySection.java]

nameclass, %method, %block, %line, %
GenericPropertySection.java0%   (0/1)0%   (0/5)0%   (0/131)0%   (0/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GenericPropertySection0%   (0/1)0%   (0/5)0%   (0/131)0%   (0/42)
GenericPropertySection (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createControls (Composite, TabbedPropertySheetPage): void 0%   (0/1)0%   (0/67)0%   (0/21)
refresh (): void 0%   (0/1)0%   (0/4)0%   (0/2)
setInput (IWorkbenchPart, ISelection): void 0%   (0/1)0%   (0/55)0%   (0/17)
shouldUseExtraSpace (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcmbench.tabs.generic;
5 
6import org.eclipse.core.runtime.Assert;
7import org.eclipse.emf.ecore.EObject;
8import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
9import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
10import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
11import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
12import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
13import org.eclipse.gef.GraphicalEditPart;
14import org.eclipse.gmf.runtime.notation.View;
15import org.eclipse.jface.viewers.ISelection;
16import org.eclipse.jface.viewers.IStructuredSelection;
17import org.eclipse.swt.widgets.Composite;
18import org.eclipse.ui.IWorkbenchPart;
19import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
20import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
21 
22import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature;
23import de.uka.ipd.sdq.pcm.repository.OperationSignature;
24import de.uka.ipd.sdq.pcm.repository.provider.RepositoryItemProviderAdapterFactory;
25import de.uka.ipd.sdq.pcm.seff.provider.SeffItemProviderAdapterFactory;
26import de.uka.ipd.sdq.pcmbench.tabs.operations.OperationsEditorSection;
27import de.uka.ipd.sdq.pcmbench.tabs.operations.OperationsTabItemProviderAdapterFactory;
28import de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;
29 
30/**
31 * @author Roman Andrej
32 *
33 */
34public class GenericPropertySection extends AbstractPropertySection {
35        
36        /**
37         * The Property Sheet Page used to display the standard properties
38         */
39        private ComposedAdapterFactory adapterFactory;
40        private EditorSection editorSection;
41 
42        /**
43         * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
44         *      org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
45         */
46        @Override
47        public void createControls(Composite parent,
48                        TabbedPropertySheetPage tabbedPropertySheetPage) {
49 
50                super.createControls(parent, tabbedPropertySheetPage);
51                Composite composite = getWidgetFactory()
52                                .createFlatFormComposite(parent);
53 
54                adapterFactory = new ComposedAdapterFactory();
55                adapterFactory
56                                .addAdapterFactory(new RepositoryItemProviderAdapterFactory());
57                adapterFactory.addAdapterFactory(new SeffItemProviderAdapterFactory());
58                adapterFactory
59                                .addAdapterFactory(new ResourceItemProviderAdapterFactory());
60                adapterFactory
61                                .addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
62 
63                editorSection = new OperationsEditorSection(composite);
64                editorSection
65                                .setViewerContentProvider(new AdapterFactoryContentProvider(
66                                                adapterFactory));
67                editorSection
68                                .setViewerLabelProvider(new AdapterFactoryLabelProvider(
69                                                new OperationsTabItemProviderAdapterFactory(
70                                                                new PalladioItemProviderAdapterFactory(
71                                                                                adapterFactory))));
72        }
73 
74        /**
75         * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
76         *      org.eclipse.jface.viewers.ISelection)
77         */
78        @Override
79        public void setInput(IWorkbenchPart part, ISelection selection) {
80                super.setInput(part, selection);
81                Assert.isTrue(selection instanceof IStructuredSelection);
82                Object input = ((IStructuredSelection) selection).getFirstElement();
83                if (input instanceof GraphicalEditPart){
84                        GraphicalEditPart ep = (GraphicalEditPart)input;
85                        input = ep.getModel();
86                }
87                if (input instanceof View){
88                        input = ((View)input).getElement();
89                }
90                if (input instanceof OperationSignature) {
91                        OperationSignature signature = (OperationSignature) input;
92                        input = signature.getInterface__OperationSignature();
93                }
94                if (input instanceof InfrastructureSignature) {
95                        InfrastructureSignature signature = (InfrastructureSignature) input;
96                        input = signature.getInfrastructureInterface__InfrastructureSignature();
97                }
98                
99                Assert.isTrue(input instanceof EObject);
100                editorSection.setViewerInput(input);
101        }
102 
103        /**
104         * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
105         */
106        @Override
107        public void refresh() {
108                editorSection.refresh();
109        }
110 
111        /**
112         * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
113         */
114        @Override
115        public boolean shouldUseExtraSpace() {
116                return true;
117        }
118 
119}

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