Package: Activator

Activator

nameinstructionbranchcomplexitylinemethod
Activator()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getDefault()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
log(IStatus)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
log(Throwable)
M: 31 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
logError(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
logError(String, Throwable)
M: 24 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
logWarning(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
logWarning(String, Throwable)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
start(BundleContext)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
stop(BundleContext)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.vdmsl.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.vdmsl.debug;
23:
24: import org.eclipse.core.runtime.IStatus;
25: import org.eclipse.core.runtime.ListenerList;
26: import org.eclipse.core.runtime.Plugin;
27: import org.eclipse.core.runtime.Status;
28: import org.eclipse.debug.core.DebugException;
29: import org.osgi.framework.BundleContext;
30:
31:
32: public class Activator extends Plugin
33: {
34:
35:         // The plug-in ID
36:         public static final String PLUGIN_ID = IVdmSlDebugConstants.PLUGIN_ID;//"org.overture.core";
37:
38:         public static final boolean DEBUG = true;
39:         public static final int INTERNAL_ERROR = 120;
40:         
41:         
42:         // The shared instance
43:         private static Activator plugin;
44:         
45:         /**
46:          * The constructor
47:          */
48:         public Activator() {
49:         }
50:
51:         /*
52:          * (non-Javadoc)
53:          * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
54:          */
55:         @Override
56:         public void start(BundleContext context) throws Exception {
57:                 super.start(context);
58:                 plugin = this;
59:         }
60:
61:         /*
62:          * (non-Javadoc)
63:          * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
64:          */
65:         @Override
66:         public void stop(BundleContext context) throws Exception {
67:                 plugin = null;
68:                 super.stop(context);
69:         }
70:
71:         /**
72:          * Returns the shared instance
73:          *
74:          * @return the shared instance
75:          */
76:         public static Activator getDefault() {
77:                 return plugin;
78:         }
79:
80:         public static void log(Throwable t) {
81:                 Throwable top = t;
82:•                if (t instanceof DebugException) {
83:                         Throwable throwable = ((DebugException) t).getStatus()
84:                                         .getException();
85:•                        if (throwable != null) {
86:                                 top = throwable;
87:                         }
88:                 }
89:                 log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR,
90:                                 "internalErrorLoggedFromVdmPpDebugPlugin" + top.getMessage(), top));
91:         }
92:
93:         public static void log(IStatus status) {
94:                 getDefault().getLog().log(status);
95:         }
96:         
97:         public static void logWarning(String message) {
98:                 logWarning(message, null);
99:         }
100:
101:         public static void logWarning(String message, Throwable t) {
102:                 log(new Status(IStatus.WARNING, PLUGIN_ID, INTERNAL_ERROR, message, t));
103:         }
104:
105:         public static void logError(String message) {
106:                 logError(message, null);
107:         }
108:
109:         public static void logError(String message, Throwable t) {
110:                 Throwable top = t;
111:•                if (t instanceof DebugException) {
112:                         Throwable throwable = ((DebugException) t).getStatus()
113:                                         .getException();
114:•                        if (throwable != null) {
115:                                 top = throwable;
116:                         }
117:                 }
118:                 log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, message, top));
119:         }
120:         
121:         @SuppressWarnings("unused")
122:         private final ListenerList shutdownListeners = new ListenerList();
123:
124: }