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

COVERAGE SUMMARY FOR SOURCE FILE [OperationsPropertySection.java]

nameclass, %method, %block, %line, %
OperationsPropertySection.java0%   (0/1)0%   (0/5)0%   (0/128)0%   (0/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationsPropertySection0%   (0/1)0%   (0/5)0%   (0/128)0%   (0/40)
OperationsPropertySection (): 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/52)0%   (0/15)
shouldUseExtraSpace (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

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

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