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

COVERAGE SUMMARY FOR SOURCE FILE [RegisteredCompletions.java]

nameclass, %method, %block, %line, %
RegisteredCompletions.java0%   (0/2)0%   (0/8)0%   (0/109)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RegisteredCompletions0%   (0/1)0%   (0/4)0%   (0/82)0%   (0/22)
RegisteredCompletions (): void 0%   (0/1)0%   (0/3)0%   (0/1)
findCompletion (String): RegisteredCompletion 0%   (0/1)0%   (0/24)0%   (0/6)
getCompletions (): Collection 0%   (0/1)0%   (0/50)0%   (0/14)
getLabelProvider (): IBaseLabelProvider 0%   (0/1)0%   (0/5)0%   (0/1)
     
class RegisteredCompletions$RegisteredCompletionLabelProvider0%   (0/1)0%   (0/4)0%   (0/27)0%   (0/7)
RegisteredCompletions$RegisteredCompletionLabelProvider (): void 0%   (0/1)0%   (0/3)0%   (0/1)
RegisteredCompletions$RegisteredCompletionLabelProvider (RegisteredCompletion... 0%   (0/1)0%   (0/3)0%   (0/1)
getColumnImage (Object, int): Image 0%   (0/1)0%   (0/2)0%   (0/1)
getColumnText (Object, int): String 0%   (0/1)0%   (0/19)0%   (0/5)

1package de.uka.ipd.sdq.cip.completions;
2 
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.List;
6 
7import org.eclipse.core.runtime.IConfigurationElement;
8import org.eclipse.core.runtime.IExtensionRegistry;
9import org.eclipse.core.runtime.InvalidRegistryObjectException;
10import org.eclipse.core.runtime.Platform;
11import org.eclipse.jface.viewers.IBaseLabelProvider;
12import org.eclipse.jface.viewers.ITableLabelProvider;
13import org.eclipse.jface.viewers.LabelProvider;
14import org.eclipse.swt.graphics.Image;
15 
16import de.uka.ipd.sdq.cip.CipPlugin;
17import de.uka.ipd.sdq.cip.ConstantsContainer;
18 
19/**
20 * @author Thomas Schuischel
21 *
22 */
23public class RegisteredCompletions {
24        
25        /**
26         * Cache enumerated completions for performance
27         */
28        private static Collection<RegisteredCompletion> cachedCompletions;
29        
30        public static RegisteredCompletion findCompletion(String ID) {
31                if(cachedCompletions == null)
32                        getCompletions();
33                
34                for(RegisteredCompletion completion : cachedCompletions)
35                {
36                        if(completion.getId().equals(ID)) 
37                                return completion;
38                }
39                
40                return null;
41        }
42        
43        public static Collection<RegisteredCompletion> getCompletions() {
44                if(cachedCompletions != null)
45                        return cachedCompletions;
46                
47                List<RegisteredCompletion> found = new ArrayList<RegisteredCompletion>();
48                IExtensionRegistry reg = Platform.getExtensionRegistry();
49                try {
50                        IConfigurationElement[] elements = reg.getConfigurationElementsFor(CipPlugin.PLUGIN_ID,ConstantsContainer.COMPLETION_EXTENSION_POINT_ID);
51                        for(int i = 0; i < elements.length; i++) {
52                                IConfigurationElement element = elements[i];
53                                if(element.getName().equals(ConstantsContainer.NODE_COMPLETION)){
54                                        RegisteredCompletion rc = RegisteredCompletion.parseCompletion(element,element.getContributor().getName());
55                                        if(rc != null)
56                                                found.add(rc);
57                                                
58                                }
59                        }
60                        cachedCompletions =  found;
61                }
62                catch (InvalidRegistryObjectException e) {
63                        //logger.logError(msg,e);
64                }
65                
66                return cachedCompletions;
67        }
68        
69        private static class RegisteredCompletionLabelProvider extends LabelProvider implements ITableLabelProvider {
70 
71                @Override
72                public Image getColumnImage(Object element, int columnIndex) {
73                        return null;
74                }
75 
76                @Override
77                public String getColumnText(Object element, int columnIndex) {
78                        RegisteredCompletion rc = (RegisteredCompletion) element;
79                        switch (columnIndex) {
80                        case 0:
81                                return rc.getName(); 
82                        case 1:
83                                return rc.getId();
84 
85                        default:
86                                return "unkown " +  columnIndex;
87                        }
88                        
89                }
90                
91        }
92        
93        public static IBaseLabelProvider getLabelProvider() {
94                return new RegisteredCompletions.RegisteredCompletionLabelProvider();
95        }
96        
97        
98}

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