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

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EventTypesPropertySection0%   (0/1)0%   (0/5)0%   (0/128)0%   (0/40)
EventTypesPropertySection (): 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.EventGroup;
20import de.uka.ipd.sdq.pcm.repository.EventType;
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.EventTypesEditorSection;
24import de.uka.ipd.sdq.pcmbench.tabs.operations.EventTypesTabItemProviderAdapterFactory;
25import de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;
26 
27/**
28 * "EventTypes" Property Section - event type editor
29 * 
30 * @author Benjamin Klatt
31 */
32public class EventTypesPropertySection extends AbstractPropertySection {
33 
34        /**
35         * The Property Sheet Page used to display the standard properties
36         */
37        private ComposedAdapterFactory adapterFactory;
38        private EventTypesEditorSection propertySection;
39 
40        /**
41         * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
42         *      org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
43         */
44        @Override
45        public void createControls(Composite parent,
46                        TabbedPropertySheetPage tabbedPropertySheetPage) {
47 
48                super.createControls(parent, tabbedPropertySheetPage);
49                Composite composite = getWidgetFactory()
50                                .createFlatFormComposite(parent);
51 
52                adapterFactory = new ComposedAdapterFactory();
53                adapterFactory
54                                .addAdapterFactory(new RepositoryItemProviderAdapterFactory());
55                adapterFactory.addAdapterFactory(new SeffItemProviderAdapterFactory());
56                adapterFactory
57                                .addAdapterFactory(new ResourceItemProviderAdapterFactory());
58                adapterFactory
59                                .addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
60 
61                propertySection = new EventTypesEditorSection(composite);
62                propertySection
63                                .setViewerContentProvider(new AdapterFactoryContentProvider(
64                                                adapterFactory));
65                propertySection
66                                .setViewerLabelProvider(new AdapterFactoryLabelProvider(
67                                                new EventTypesTabItemProviderAdapterFactory(
68                                                                new PalladioItemProviderAdapterFactory(
69                                                                                adapterFactory))));
70        }
71 
72        /**
73         * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
74         *      org.eclipse.jface.viewers.ISelection)
75         */
76        @Override
77        public void setInput(IWorkbenchPart part, ISelection selection) {
78                super.setInput(part, selection);
79                Assert.isTrue(selection instanceof IStructuredSelection);
80                Object input = ((IStructuredSelection) selection).getFirstElement();
81                if (input instanceof GraphicalEditPart){
82                        GraphicalEditPart ep = (GraphicalEditPart)input;
83                        input = ep.getModel();
84                }
85                if (input instanceof View){
86                        input = ((View)input).getElement();
87                }
88                if (input instanceof EventType) {
89                        EventType eventType = (EventType) input;
90                        input = eventType.getEventGroup__EventType();
91                }
92                
93                Assert.isTrue(input instanceof EObject);
94                // set input for 'TableViewer'
95                propertySection.setViewerInput(input);
96                // set in the diagram selected object to the add button action listener.
97                propertySection.getAddButtonListener().setSelectedInterface((EventGroup) input);
98        }
99 
100        /**
101         * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
102         */
103        @Override
104        public void refresh() {
105                propertySection.refresh();
106        }
107 
108        /**
109         * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
110         */
111        @Override
112        public boolean shouldUseExtraSpace() {
113                return true;
114        }
115}

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