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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelPropertySection.java]

nameclass, %method, %block, %line, %
PalladioComponentModelPropertySection.java0%   (0/1)0%   (0/6)0%   (0/147)0%   (0/46)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelPropertySection0%   (0/1)0%   (0/6)0%   (0/147)0%   (0/46)
PalladioComponentModelPropertySection (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAdapterFactory (Object): AdapterFactory 0%   (0/1)0%   (0/20)0%   (0/9)
getPropertySource (Object): IPropertySource 0%   (0/1)0%   (0/37)0%   (0/12)
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 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.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 
25/**
26 * @generated
27 */
28public class PalladioComponentModelPropertySection extends
29                AdvancedPropertySection implements IPropertySourceProvider {
30 
31        /**
32         * @generated
33         */
34        public IPropertySource getPropertySource(Object object) {
35                if (object instanceof IPropertySource) {
36                        return (IPropertySource) object;
37                }
38                AdapterFactory af = getAdapterFactory(object);
39                if (af != null) {
40                        IItemPropertySource ips = (IItemPropertySource) af.adapt(object,
41                                        IItemPropertySource.class);
42                        if (ips != null) {
43                                return new PropertySource(object, ips);
44                        }
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
105         */
106        protected AdapterFactory getAdapterFactory(Object object) {
107                if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
108                        return ((AdapterFactoryEditingDomain) getEditingDomain())
109                                        .getAdapterFactory();
110                }
111                TransactionalEditingDomain editingDomain = TransactionUtil
112                                .getEditingDomain(object);
113                if (editingDomain != null) {
114                        return ((AdapterFactoryEditingDomain) editingDomain)
115                                        .getAdapterFactory();
116                }
117                return null;
118        }
119 
120}

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