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

COVERAGE SUMMARY FOR SOURCE FILE [VisualisationMenuItemContributions.java]

nameclass, %method, %block, %line, %
VisualisationMenuItemContributions.java0%   (0/1)0%   (0/3)0%   (0/84)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VisualisationMenuItemContributions0%   (0/1)0%   (0/3)0%   (0/84)0%   (0/19)
VisualisationMenuItemContributions (): void 0%   (0/1)0%   (0/3)0%   (0/2)
VisualisationMenuItemContributions (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
getContributionItems (): IContributionItem [] 0%   (0/1)0%   (0/77)0%   (0/15)

1package de.uka.ipd.sdq.sensorframework.visualisation.menu;
2 
3import java.util.ArrayList;
4 
5import org.eclipse.core.runtime.IConfigurationElement;
6import org.eclipse.core.runtime.Platform;
7import org.eclipse.jface.action.ActionContributionItem;
8import org.eclipse.jface.action.IContributionItem;
9import org.eclipse.ui.actions.CompoundContributionItem;
10 
11import de.uka.ipd.sdq.sensorframework.adapter.AdapterRegistry;
12import de.uka.ipd.sdq.sensorframework.adapter.IAdapterFactory;
13 
14 
15/**
16 * A compound contribution is a contribution item consisting of a dynamic list
17 * of contribution items.
18 */
19public class VisualisationMenuItemContributions extends CompoundContributionItem {
20 
21        /* (non-Javadoc)
22         * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
23         */
24        @Override
25        public IContributionItem[] getContributionItems() {
26                ArrayList<IContributionItem> items = new ArrayList<IContributionItem>();
27                for(IConfigurationElement configurationElement : Platform.getExtensionRegistry().
28                                getConfigurationElementsFor("de.uka.ipd.sdq.sensorframework.visualisation")){
29                        String executableObject = configurationElement.getAttribute("acceptsData");
30                        try {
31                                Class<?> viewerAcceptsClass = Class.forName(executableObject);
32                                for (IAdapterFactory f : AdapterRegistry.singleton().getAllAvailableFactories(viewerAcceptsClass)) {
33                                        String displayName = configurationElement.getAttribute("displayName");
34                                        displayName = displayName.replace("{0}", f.getMetricLabel());
35                                        items.add(new ActionContributionItem(
36                                                        new OpenAction(displayName,
37                                                                f.getAdapterFactoryID(),        
38                                                                configurationElement.getAttribute("editorID"))));
39                                }
40                        } catch (Exception e) {
41                                e.printStackTrace();
42                        }
43                }
44                return items.toArray(new IContributionItem[]{});
45        }
46 
47        public VisualisationMenuItemContributions() {
48                // TODO Auto-generated constructor stub
49        }
50        
51        public VisualisationMenuItemContributions(String id) {
52                super(id);
53                // TODO Auto-generated constructor stub
54        }
55}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.menu]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov