Author: adietish
Date: 2010-11-17 09:53:50 -0500 (Wed, 17 Nov 2010)
New Revision: 26668
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/log/StatusFactory.java
Log:
[JBIDE-7597] added method to create multi status instance
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/log/StatusFactory.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/log/StatusFactory.java 2010-11-17
14:47:59 UTC (rev 26667)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/log/StatusFactory.java 2010-11-17
14:53:50 UTC (rev 26668)
@@ -7,10 +7,11 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.common.log;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
public class StatusFactory {
@@ -18,11 +19,11 @@
public final static String UNSPECIFIED_MESSAGE = null;
public final static String EMPTY_MESSAGE = ""; //$NON-NLS-1$
public final static String EMPTY_PLUGIN = ""; //$NON-NLS-1$
-
+
public static IStatus getInstance(int severity, String pluginId,
int code, String message, Throwable t) {
return new Status(severity, pluginId == null ? EMPTY_PLUGIN : pluginId,
- code, checkMessage(message, t) , t);
+ code, checkMessage(message, t), t);
}
public static IStatus getInstance(int severity, int code, String message,
@@ -44,26 +45,41 @@
Throwable t) {
return getInstance(severity, pluginId, UNDEFINED_ERROR, EMPTY_MESSAGE, t);
}
-
+
public static IStatus getInstance(int severity, String pluginId,
int code, Throwable t) {
return getInstance(severity, pluginId, code, EMPTY_MESSAGE, t);
}
-
+
public static IStatus getInstance(int severity, String pluginId,
int code, String message) {
return getInstance(severity, pluginId, code, message, null);
}
-
+
+ /**
+ * Returns a multi status with the given severity, plugin id, error code,
+ * message, cause and child status instances.
+ *
+ * @param severity
+ * @param pluginId
+ * @param message
+ * @param t
+ * @param status
+ * @return a multi status
+ */
+ public static IStatus getInstance(int severity, String pluginId, String message,
Throwable t, IStatus... status) {
+ return new MultiStatus(pluginId, UNDEFINED_ERROR, status, message, t);
+ }
+
private static String checkMessage(String message, Throwable t) {
if (message == UNSPECIFIED_MESSAGE) {
if (t != null && t.getMessage() != null) {
return t.getMessage();
}
-
+
return EMPTY_MESSAGE;
}
-
+
return message;
}
}