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

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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