Package: SourceViewerEditorManager

SourceViewerEditorManager

nameinstructionbranchcomplexitylinemethod
SourceViewerEditorManager()
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getContentTypeIds()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEditorId(String)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEditors()
M: 39 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getInstance()
M: 8 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.debug
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.debug.ui.model;
23:
24: import java.util.Collection;
25: import java.util.Hashtable;
26: import java.util.Map;
27:
28: import org.eclipse.core.runtime.IConfigurationElement;
29: import org.eclipse.core.runtime.Platform;
30: import org.overture.ide.debug.core.IDebugConstants;
31:
32: public class SourceViewerEditorManager
33: {
34:         /**
35:          * A handle to the unique Singleton instance.
36:          */
37:         static private SourceViewerEditorManager _instance = null;
38:         static final Map<String, String> editors = new Hashtable<String, String>();
39:
40:         /**
41:          * @return The unique instance of this class.
42:          */
43:         static public SourceViewerEditorManager getInstance()
44:         {
45:•                if (null == _instance)
46:                 {
47:                         _instance = new SourceViewerEditorManager();
48:                 }
49:                 return _instance;
50:         }
51:
52:         public SourceViewerEditorManager()
53:         {
54:                 editors.putAll(getEditors());
55:         }
56:
57:         private Map<String, String> getEditors()
58:         {
59:                 Map<String, String> editors = new Hashtable<String, String>();
60:
61:                 IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(IDebugConstants.EXTENSION_SOURCEVIEWER_EDITOR);
62:
63:•                for (IConfigurationElement e : config)
64:                 {
65:                         String editorId = e.getAttribute("EditorId");
66:                         String contentTypeId = e.getAttribute("ContentTypeId");
67:
68:                         editors.put(contentTypeId, editorId);
69:                 }
70:
71:                 return editors;
72:         }
73:
74:         public Collection<String> getContentTypeIds()
75:         {
76:                 return editors.keySet();
77:         }
78:
79:         public String getEditorId(String contentTypeId)
80:         {
81:                 return editors.get(contentTypeId);
82:         }
83:
84: }