KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > core > EclEmmaStatus


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: EclEmmaStatus.java 154 2006-10-25 14:57:17Z mtnminds $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.core;
9
10 import org.eclipse.core.runtime.IStatus;
11 import org.eclipse.core.runtime.Status;
12 import org.eclipse.osgi.util.NLS;
13
14 import com.mountainminds.eclemma.internal.core.CoreMessages;
15 import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin;
16
17 /**
18  * Status objects used by the core plugin.
19  *
20  * @author Marc R. Hoffmann
21  * @version $Revision: 154 $
22  */

23 public final class EclEmmaStatus {
24
25   public final int code;
26
27   public final int severity;
28
29   public final String JavaDoc message;
30
31   private EclEmmaStatus(int code, int severity, String JavaDoc message) {
32     this.code = code;
33     this.severity = severity;
34     this.message = message;
35   }
36
37   public IStatus getStatus() {
38     String JavaDoc m = NLS.bind(message, new Integer JavaDoc(code));
39     return new Status(severity, EclEmmaCorePlugin.ID, code, m, null);
40   }
41
42   public IStatus getStatus(Throwable JavaDoc t) {
43     String JavaDoc m = NLS.bind(message, new Integer JavaDoc(code));
44     return new Status(severity, EclEmmaCorePlugin.ID, code, m, t);
45   }
46
47   public IStatus getStatus(Object JavaDoc param1, Throwable JavaDoc t) {
48     String JavaDoc m = NLS.bind(message, new Integer JavaDoc(code), param1);
49     return new Status(severity, EclEmmaCorePlugin.ID, code, m, t);
50   }
51
52   /**
53    * Info before inplace instrumentation happens.
54    */

55   public static final EclEmmaStatus INPLACE_INSTRUMENTATION_INFO = new EclEmmaStatus(
56       2000, IStatus.INFO,
57       CoreMessages.StatusINPLACE_INSTRUMENTATION_INFO_message);
58
59   /**
60    * Status indicating that it was not possible to obtain a local version of the
61    * emma.jar file.
62    */

63   public static final EclEmmaStatus NO_LOCAL_EMMAJAR_ERROR = new EclEmmaStatus(
64       5000, IStatus.ERROR, CoreMessages.StatusNO_LOCAL_EMMAJAR_ERROR_message);
65
66   /**
67    * Status indication that it was not possible to generate a internal id for a
68    * resource.
69    */

70   public static final EclEmmaStatus ID_CREATION_ERROR = new EclEmmaStatus(
71       5001, IStatus.ERROR, CoreMessages.StatusID_CREATION_ERROR_message);
72
73   /**
74    * The requested launch type is not known.
75    */

76   public static final EclEmmaStatus UNKOWN_LAUNCH_TYPE_ERROR = new EclEmmaStatus(
77       5002, IStatus.ERROR, CoreMessages.StatusUNKOWN_LAUNCH_TYPE_ERROR_message);
78
79   /**
80    * The coverage runtime classpath provider has been called in an invalid
81    * execution context, i.e. outside of <code>CoverageLauncher.launch()</code>.
82    */

83   public static final EclEmmaStatus INVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR = new EclEmmaStatus(
84       5003, IStatus.ERROR,
85       CoreMessages.StatusINVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR_message);
86
87   /**
88    * The coverage launch info object is missing unexpectedly.
89    */

90   public static final EclEmmaStatus MISSING_LAUNCH_INFO_ERROR = new EclEmmaStatus(
91       5004, IStatus.ERROR, CoreMessages.StatusMISSING_LAUNCH_INFO_ERROR_message);
92
93   /**
94    * Error while creating the JAR containing emma runtime properties.
95    */

96   public static final EclEmmaStatus EMMA_PROPERTIES_CREATION_ERROR = new EclEmmaStatus(
97       5005, IStatus.ERROR,
98       CoreMessages.StatusEMMA_PROPERTIES_CREATION_ERROR_message);
99
100   /**
101    * Error while reading coverage data file.
102    */

103   public static final EclEmmaStatus COVERAGEDATA_FILE_READ_ERROR = new EclEmmaStatus(
104       5006, IStatus.ERROR,
105       CoreMessages.StatusCOVERAGEDATA_FILE_READ_ERROR_message);
106
107   /**
108    * Error while reading meta data file.
109    */

110   public static final EclEmmaStatus METADATA_FILE_READ_ERROR = new EclEmmaStatus(
111       5007, IStatus.ERROR, CoreMessages.StatusMETADATA_FILE_READ_ERROR_message);
112
113   /**
114    * Error while extracting source files.
115    */

116   public static final EclEmmaStatus SOURCE_EXTRACTION_ERROR = new EclEmmaStatus(
117       5008, IStatus.ERROR, CoreMessages.StatusSOURCE_EXTRACTION_ERROR_message);
118
119   /**
120    * Error while importing external coverage session.
121    */

122   public static final EclEmmaStatus IMPORT_ERROR = new EclEmmaStatus(
123       5009, IStatus.ERROR, CoreMessages.StatusIMPORT_ERROR_message);
124   
125   /**
126    * Trying to instrument instrumented class files. This status is used to issue
127    * an error prompt during launching.
128    */

129   public static final EclEmmaStatus ALREADY_INSTRUMENTED_ERROR = new EclEmmaStatus(
130       5100, IStatus.ERROR, CoreMessages.StatusALREADY_INSTRUMENTED_ERROR_message);
131
132   /**
133    * No coverage data file has been created during a coverage launch. This
134    * status is used to issue an error prompt.
135    */

136   public static final EclEmmaStatus NO_COVERAGE_DATA_ERROR = new EclEmmaStatus(
137       5101, IStatus.ERROR, CoreMessages.StatusALREADY_INSTRUMENTED_ERROR_message);
138
139   /**
140    * No classes are selected for instrumentation. This status is used to issue
141    * an error prompt during launching.
142    */

143   public static final EclEmmaStatus NO_INSTRUMENTED_CLASSES = new EclEmmaStatus(
144       5102, IStatus.ERROR, CoreMessages.StatusNO_INSTRUMENTED_CLASSES_message);
145
146   
147 }
148
Popular Tags