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

COVERAGE SUMMARY FOR SOURCE FILE [CompletionConfigNode.java]

nameclass, %method, %block, %line, %
CompletionConfigNode.java0%   (0/5)0%   (0/22)0%   (0/370)0%   (0/62)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompletionConfigNode0%   (0/1)0%   (0/8)0%   (0/195)0%   (0/41)
CompletionConfigNode (CompletionConfigNode$CompletionConfigNodeID, String, Co... 0%   (0/1)0%   (0/12)0%   (0/5)
createRegisteredNode (): CompletionConfigNode 0%   (0/1)0%   (0/29)0%   (0/6)
createUserDefinedNode (): CompletionConfigNode 0%   (0/1)0%   (0/45)0%   (0/7)
createWorkspaceNode (): CompletionConfigNode 0%   (0/1)0%   (0/17)0%   (0/5)
getCaption (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getChildren (): Object [] 0%   (0/1)0%   (0/4)0%   (0/1)
getID (): CompletionConfigNode$CompletionConfigNodeID 0%   (0/1)0%   (0/3)0%   (0/1)
scanFolder (IContainer): List 0%   (0/1)0%   (0/82)0%   (0/15)
     
class CompletionConfigNode$CompletionConfigNodeID0%   (0/1)0%   (0/4)0%   (0/60)0%   (0/5)
<static initializer> 0%   (0/1)0%   (0/34)0%   (0/4)
CompletionConfigNode$CompletionConfigNodeID (String, int): void 0%   (0/1)0%   (0/5)0%   (0/1)
valueOf (String): CompletionConfigNode$CompletionConfigNodeID 0%   (0/1)0%   (0/5)0%   (0/1)
values (): CompletionConfigNode$CompletionConfigNodeID [] 0%   (0/1)0%   (0/16)0%   (0/1)
     
class CompletionConfigNode$FeatureConfig0%   (0/1)0%   (0/3)0%   (0/30)0%   (0/5)
CompletionConfigNode$FeatureConfig (IFile): void 0%   (0/1)0%   (0/6)0%   (0/3)
getFileURI (): String 0%   (0/1)0%   (0/8)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/16)0%   (0/1)
     
class CompletionConfigNode$UserDefined0%   (0/1)0%   (0/3)0%   (0/15)0%   (0/6)
CompletionConfigNode$UserDefined (String, CompletionConfigNode$UserDefinedID)... 0%   (0/1)0%   (0/9)0%   (0/4)
getCaption (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getID (): CompletionConfigNode$UserDefinedID 0%   (0/1)0%   (0/3)0%   (0/1)
     
class CompletionConfigNode$UserDefinedID0%   (0/1)0%   (0/4)0%   (0/70)0%   (0/6)
<static initializer> 0%   (0/1)0%   (0/44)0%   (0/5)
CompletionConfigNode$UserDefinedID (String, int): void 0%   (0/1)0%   (0/5)0%   (0/1)
valueOf (String): CompletionConfigNode$UserDefinedID 0%   (0/1)0%   (0/5)0%   (0/1)
values (): CompletionConfigNode$UserDefinedID [] 0%   (0/1)0%   (0/16)0%   (0/1)

1package de.uka.ipd.sdq.cip.runtime.wizards;
2 
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.List;
6 
7import org.eclipse.core.resources.IContainer;
8import org.eclipse.core.resources.IFile;
9import org.eclipse.core.resources.IProject;
10import org.eclipse.core.resources.IResource;
11import org.eclipse.core.resources.IWorkspace;
12import org.eclipse.core.resources.IWorkspaceRoot;
13import org.eclipse.core.resources.ResourcesPlugin;
14import org.eclipse.core.runtime.CoreException;
15import org.eclipse.emf.common.util.URI;
16 
17import de.uka.ipd.sdq.cip.completions.RegisteredCompletion;
18import de.uka.ipd.sdq.cip.completions.RegisteredCompletions;
19 
20public class CompletionConfigNode {
21 
22        static public class FeatureConfig {
23 
24                private IFile file;
25 
26                public FeatureConfig(IFile file) {
27                        this.file = file;
28                }
29 
30                public String getName() {
31                        return file.getName() + " - " + file.getProject().getName();
32                }
33                
34                public String getFileURI() {
35                        return URI.createPlatformResourceURI(file.getLocationURI().toString(),true).toString();
36                }
37                
38        }
39        
40        static public class UserDefined {
41                
42                private String caption;
43                private UserDefinedID id;
44 
45                public UserDefined(String caption, UserDefinedID id) {
46                        this.caption = caption;
47                        this.id = id;
48                }
49 
50                public String getCaption() {
51                        return caption;
52                }
53                public UserDefinedID getID() {
54                        return id;
55                }
56 
57                
58                
59        }
60        
61        public enum CompletionConfigNodeID{
62                WORKSPACE,
63                REGISTRED,
64                USERDEFINED
65                
66        };
67        
68        public enum UserDefinedID{
69                FEATURECONFIG,
70                ANNOTATED,
71                PLAIN,
72                PLAINQVTO
73                
74        };
75        
76        private CompletionConfigNodeID id;
77        private Collection<?> configElements;
78        private String caption;
79        
80        private CompletionConfigNode(CompletionConfigNodeID id, String caption,Collection<?> configElements) {
81                this.id = id;
82                this.caption = caption;
83                this.configElements = configElements;
84        }
85        
86        public static CompletionConfigNode createWorkspaceNode() throws CoreException {
87                
88                IWorkspace workspace = ResourcesPlugin.getWorkspace(); 
89                IWorkspaceRoot workspaceRoot = workspace.getRoot();
90                List<?> featureConfigs = (List<?>) scanFolder(workspaceRoot);
91                CompletionConfigNode node = new CompletionConfigNode(CompletionConfigNodeID.WORKSPACE,"Workspace FeatureConfigs",featureConfigs);
92                return node;
93        }
94        
95        private static List< FeatureConfig> scanFolder(IContainer container) throws CoreException {
96                IResource[] resources = container.members();
97                ArrayList<FeatureConfig> featureConfigs = new ArrayList<FeatureConfig>();
98                for(int i = 0; i < resources.length; i++) {
99                        if(resources[i].getType() == IResource.PROJECT){
100                                IProject project = (IProject) resources[i];
101                                if(project.isOpen()) {
102                                        featureConfigs.addAll(scanFolder((IContainer)resources[i]));
103                                }
104                        }
105                        if(resources[i].getType() == IResource.FOLDER)
106                                featureConfigs.addAll(scanFolder((IContainer)resources[i]));
107                        else if (resources[i].getType() == IResource.FILE){
108                                IFile file = (IFile) resources[i];
109                                if(file.getFileExtension() != null && file.getFileExtension().contains("featureconfig"))
110                                {
111                                        FeatureConfig featureConfig = new FeatureConfig(file);
112                                        featureConfigs.add(featureConfig);
113                                }
114                        }
115                }
116                
117                return featureConfigs;
118        }
119 
120        public static CompletionConfigNode createRegisteredNode() {
121                Collection<RegisteredCompletion> completions = RegisteredCompletions.getCompletions();
122                for(RegisteredCompletion completion : completions) {
123                        if(completion.getFeaturemodel() != null)
124                                completions.remove(completion);
125                }
126                CompletionConfigNode node = new CompletionConfigNode(CompletionConfigNodeID.REGISTRED,"Registered Completions", completions);
127                return node;
128        }
129        public static CompletionConfigNode createUserDefinedNode() {
130                ArrayList<UserDefined> userDefineds = new ArrayList<UserDefined>();
131                userDefineds.add(new UserDefined("FeatureConfig based Completion",UserDefinedID.FEATURECONFIG));
132                userDefineds.add(new UserDefined("Annotated Completion",UserDefinedID.ANNOTATED));
133                userDefineds.add(new UserDefined("Plain Completion",UserDefinedID.PLAIN));
134                userDefineds.add(new UserDefined("Plain QVTO Completion",UserDefinedID.PLAINQVTO));
135                CompletionConfigNode node = new CompletionConfigNode(CompletionConfigNodeID.USERDEFINED,"User-defined", userDefineds);
136                return node;
137        }
138        
139        public  Object[] getChildren() {
140                return configElements.toArray();
141        }
142        
143        public String getCaption() {
144                return caption;
145        }
146        
147        public CompletionConfigNodeID getID() {
148                return id;
149        }
150}

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