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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelPropertySection.java]

nameclass, %method, %block, %line, %
PalladioComponentModelPropertySection.java0%   (0/1)0%   (0/6)0%   (0/123)0%   (0/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelPropertySection0%   (0/1)0%   (0/6)0%   (0/123)0%   (0/37)
PalladioComponentModelPropertySection (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAdapterFactory (Object): AdapterFactory 0%   (0/1)0%   (0/3)0%   (0/2)
getPropertySource (Object): IPropertySource 0%   (0/1)0%   (0/30)0%   (0/10)
getPropertySourceProvider (): IPropertySourceProvider 0%   (0/1)0%   (0/2)0%   (0/1)
setInput (IWorkbenchPart, ISelection): void 0%   (0/1)0%   (0/46)0%   (0/13)
transformSelection (Object): Object 0%   (0/1)0%   (0/39)0%   (0/10)

1/*
2 * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.sheet;
5 
6import java.util.ArrayList;
7import java.util.Iterator;
8 
9import org.eclipse.core.runtime.IAdaptable;
10import org.eclipse.emf.common.notify.AdapterFactory;
11import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
12import org.eclipse.emf.edit.provider.IItemPropertySource;
13import org.eclipse.emf.edit.ui.provider.PropertySource;
14import org.eclipse.emf.transaction.TransactionalEditingDomain;
15import org.eclipse.emf.transaction.util.TransactionUtil;
16import org.eclipse.gef.EditPart;
17import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
18import org.eclipse.gmf.runtime.notation.View;
19import org.eclipse.jface.viewers.ISelection;
20import org.eclipse.jface.viewers.StructuredSelection;
21import org.eclipse.ui.IWorkbenchPart;
22import org.eclipse.ui.views.properties.IPropertySource;
23import org.eclipse.ui.views.properties.IPropertySourceProvider;
24 
25import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelSeffDiagramEditorPlugin;
26import de.uka.ipd.sdq.pcmbench.propertytabs.PalladioAdapterFactoryContentProvider;
27 
28/**
29 * @generated
30 */
31public class PalladioComponentModelPropertySection extends
32                AdvancedPropertySection implements IPropertySourceProvider {
33 
34        /**
35         * @generated not
36         */
37        public IPropertySource getPropertySource(Object object) {
38                if (object instanceof IPropertySource) {
39                        return (IPropertySource) object;
40                }
41                AdapterFactory af = getAdapterFactory(object);
42                if (af != null) {
43                        return new PalladioAdapterFactoryContentProvider(af)
44                                        .getPropertySource(object);
45                }
46                if (object instanceof IAdaptable) {
47                        return (IPropertySource) ((IAdaptable) object)
48                                        .getAdapter(IPropertySource.class);
49                }
50                return null;
51        }
52 
53        /**
54         * @generated
55         */
56        protected IPropertySourceProvider getPropertySourceProvider() {
57                return this;
58        }
59 
60        /**
61         * Modify/unwrap selection.
62         * @generated
63         */
64        protected Object transformSelection(Object selected) {
65 
66                if (selected instanceof EditPart) {
67                        Object model = ((EditPart) selected).getModel();
68                        return model instanceof View ? ((View) model).getElement() : null;
69                }
70                if (selected instanceof View) {
71                        return ((View) selected).getElement();
72                }
73                if (selected instanceof IAdaptable) {
74                        View view = (View) ((IAdaptable) selected).getAdapter(View.class);
75                        if (view != null) {
76                                return view.getElement();
77                        }
78                }
79                return selected;
80        }
81 
82        /**
83         * @generated
84         */
85        public void setInput(IWorkbenchPart part, ISelection selection) {
86                if (selection.isEmpty()
87                                || false == selection instanceof StructuredSelection) {
88                        super.setInput(part, selection);
89                        return;
90                }
91                final StructuredSelection structuredSelection = ((StructuredSelection) selection);
92                ArrayList transformedSelection = new ArrayList(structuredSelection
93                                .size());
94                for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
95                        Object r = transformSelection(it.next());
96                        if (r != null) {
97                                transformedSelection.add(r);
98                        }
99                }
100                super.setInput(part, new StructuredSelection(transformedSelection));
101        }
102 
103        /**
104         * @generated not
105         */
106        protected AdapterFactory getAdapterFactory(Object object) {
107                return PalladioComponentModelSeffDiagramEditorPlugin.getInstance()
108                                .getItemProvidersAdapterFactory();
109                //                if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
110                //                        return ((AdapterFactoryEditingDomain) getEditingDomain())
111                //                                        .getAdapterFactory();
112                //                }
113                //                TransactionalEditingDomain editingDomain = TransactionUtil
114                //                                .getEditingDomain(object);
115                //                if (editingDomain != null) {
116                //                        return ((AdapterFactoryEditingDomain) editingDomain)
117                //                                        .getAdapterFactory();
118                //                }
119                //                return null;
120        }
121 
122}

[all classes][de.uka.ipd.sdq.pcm.gmf.seff.sheet]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov