EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pipesandfilters.framework.recorder.launch]

COVERAGE SUMMARY FOR SOURCE FILE [RecorderExtensionHelper.java]

nameclass, %method, %block, %line, %
RecorderExtensionHelper.java0%   (0/1)0%   (0/9)0%   (0/260)0%   (0/62)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RecorderExtensionHelper0%   (0/1)0%   (0/9)0%   (0/260)0%   (0/62)
RecorderExtensionHelper (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getExtensionIdentifierForName (String): String 0%   (0/1)0%   (0/31)0%   (0/7)
getLaunchConfigTabs (): ILaunchConfigurationTab [] 0%   (0/1)0%   (0/38)0%   (0/9)
getNameForExtensionIdentifier (String): String 0%   (0/1)0%   (0/18)0%   (0/8)
getRecorderConfigForName (String): IRecorderConfiguration 0%   (0/1)0%   (0/37)0%   (0/9)
getRecorderNames (): String [] 0%   (0/1)0%   (0/37)0%   (0/8)
getWriteStrategyClassNameForName (String): String 0%   (0/1)0%   (0/37)0%   (0/9)
loadExtensions (String): List 0%   (0/1)0%   (0/31)0%   (0/6)
obtainConfigurationElement (String, IExtension): IConfigurationElement 0%   (0/1)0%   (0/28)0%   (0/5)

1package de.uka.ipd.sdq.pipesandfilters.framework.recorder.launch;
2 
3import java.util.ArrayList;
4import java.util.List;
5 
6import org.eclipse.core.runtime.CoreException;
7import org.eclipse.core.runtime.IConfigurationElement;
8import org.eclipse.core.runtime.IExtension;
9import org.eclipse.core.runtime.Platform;
10import org.eclipse.debug.ui.ILaunchConfigurationTab;
11 
12public class RecorderExtensionHelper {
13 
14        public static String[] getRecorderNames() throws CoreException {
15                List<IExtension> recorderExtensions = loadExtensions("de.uka.ipd.sdq.pipesandfilters.framework.recorder");
16                List<String> names = new ArrayList<String>();
17                for (IExtension extension : recorderExtensions) {
18                        IConfigurationElement e = obtainConfigurationElement("recorder",
19                                        extension);
20                        if (e != null) {
21                                names.add(e.getAttribute("name"));
22                        }
23                }
24                return names.toArray(new String[names.size()]);
25        }
26 
27        public static ILaunchConfigurationTab[] getLaunchConfigTabs()
28                        throws CoreException {
29                List<IExtension> recorderExtensions = loadExtensions("de.uka.ipd.sdq.pipesandfilters.framework.recorder");
30                List<ILaunchConfigurationTab> tabList = new ArrayList<ILaunchConfigurationTab>();
31                for (IExtension extension : recorderExtensions) {
32                        IConfigurationElement e = obtainConfigurationElement("recorder",
33                                        extension);
34                        if (e != null) {
35                                tabList.add((ILaunchConfigurationTab) e
36                                                .createExecutableExtension("launchConfigTab"));
37                        }
38                }
39                return tabList.toArray(new ILaunchConfigurationTab[tabList.size()]);
40        }
41 
42        public static String getExtensionIdentifierForName(String recorderName)
43                        throws CoreException {
44                List<IExtension> recorderExtensions = loadExtensions("de.uka.ipd.sdq.pipesandfilters.framework.recorder");
45                for (IExtension extension : recorderExtensions) {
46                        IConfigurationElement e = obtainConfigurationElement("recorder",
47                                        extension);
48                        if (e != null && e.getAttribute("name").equals(recorderName)) {
49                                return extension.getUniqueIdentifier();
50                        }
51                }
52                return null;
53        }
54 
55        public static IRecorderConfiguration getRecorderConfigForName(
56                        String recorderName) throws CoreException {
57                List<IExtension> recorderExtensions = loadExtensions("de.uka.ipd.sdq.pipesandfilters.framework.recorder");
58                for (IExtension extension : recorderExtensions) {
59                        IConfigurationElement e = obtainConfigurationElement("recorder",
60                                        extension);
61                        if (e != null && e.getAttribute("name").equals(recorderName)) {
62                                Object config = e.createExecutableExtension("configuration");
63                                if (config != null) {
64                                        return (IRecorderConfiguration) config;
65                                }
66                        }
67                }
68                return null;
69        }
70 
71        public static String getWriteStrategyClassNameForName(String recorderName)
72                        throws CoreException {
73                List<IExtension> recorderExtensions = loadExtensions("de.uka.ipd.sdq.pipesandfilters.framework.recorder");
74                for (IExtension extension : recorderExtensions) {
75                        IConfigurationElement e = obtainConfigurationElement("recorder",
76                                        extension);
77                        if (e != null && e.getAttribute("name").equals(recorderName)) {
78                                Object writeStrategy = e.getAttribute("writeStrategy");
79                                if (writeStrategy != null) {
80                                        return (String) writeStrategy;
81                                }
82                        }
83                }
84                return null;
85        }
86 
87        public static String getNameForExtensionIdentifier(String extensionID)
88                        throws CoreException {
89                IExtension ext = Platform.getExtensionRegistry().getExtensionPoint(
90                                "de.uka.ipd.sdq.pipesandfilters.framework.recorder")
91                                .getExtension(extensionID);
92                if (ext != null) {
93                        IConfigurationElement e = obtainConfigurationElement("recorder",
94                                        ext);
95                        return e.getAttribute("name");
96                }
97                return null;
98        }
99 
100        private static IConfigurationElement obtainConfigurationElement(
101                        String elementName, IExtension extension) throws CoreException {
102                IConfigurationElement[] elements = extension.getConfigurationElements();
103                for (IConfigurationElement element : elements) {
104                        if (element.getName().equals(elementName)) {
105                                return element;
106                        }
107                }
108                return null;
109        }
110 
111        private static List<IExtension> loadExtensions(String extensionPointID) {
112                IExtension[] exts = Platform.getExtensionRegistry().getExtensionPoint(
113                                extensionPointID).getExtensions();
114                List<IExtension> results = new ArrayList<IExtension>();
115                for (IExtension extension : exts) {
116                        results.add(extension);
117                }
118                return results;
119        }
120 
121}

[all classes][de.uka.ipd.sdq.pipesandfilters.framework.recorder.launch]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov