Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.common')
-rw-r--r--bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.common/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java51
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java84
4 files changed, 135 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
index b708fc24c..d9d7f32df 100644
--- a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.common; singleton:=true
-Bundle-Version: 3.11.0.qualifier
+Bundle-Version: 3.12.0.qualifier
Bundle-Localization: plugin
Export-Package: org.eclipse.core.internal.boot;x-friends:="org.eclipse.core.resources,org.eclipse.pde.build",
org.eclipse.core.internal.runtime;common=split;mandatory:=common;
diff --git a/bundles/org.eclipse.equinox.common/pom.xml b/bundles/org.eclipse.equinox.common/pom.xml
index 1e656fa93..696e75bdf 100644
--- a/bundles/org.eclipse.equinox.common/pom.xml
+++ b/bundles/org.eclipse.equinox.common/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
index b7a1c21b5..6628d201c 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alexander Fedorov (ArSysOp) - Bug 561712
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -31,6 +32,25 @@ public class MultiStatus extends Status {
/**
* Creates and returns a new multi-status object with the given children.
*
+ * @param caller the relevant class to build unique identifier from
+ * @param code the caller-specific status code
+ * @param newChildren the list of children status objects
+ * @param message a human-readable message, localized to the
+ * current locale
+ * @param exception a low-level exception, or <code>null</code> if not
+ * applicable
+ *
+ * @since 3.12
+ */
+ public MultiStatus(Class<?> caller, int code, IStatus[] newChildren, String message, Throwable exception) {
+ this(caller, code, message, exception);
+ Assert.isLegal(newChildren != null);
+ addAllInternal(newChildren);
+ }
+
+ /**
+ * Creates and returns a new multi-status object with the given children.
+ *
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param newChildren the list of children status objects
@@ -48,6 +68,22 @@ public class MultiStatus extends Status {
/**
* Creates and returns a new multi-status object with no children.
*
+ * @param caller the relevant class to build unique identifier from
+ * @param code the caller-specific status code
+ * @param message a human-readable message, localized to the
+ * current locale
+ * @param exception a low-level exception, or <code>null</code> if not
+ * applicable
+ *
+ * @since 3.12
+ */
+ public MultiStatus(Class<?> caller, int code, String message, Throwable exception) {
+ super(OK, caller, code, message, exception);
+ }
+
+ /**
+ * Creates and returns a new multi-status object with no children.
+ *
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param message a human-readable message, localized to the
@@ -62,6 +98,19 @@ public class MultiStatus extends Status {
/**
* Creates and returns a new multi-status object with no children.
*
+ * @param caller the relevant class to build unique identifier from
+ * @param code the caller-specific status code
+ * @param message a human-readable message, localized to the current locale
+ *
+ * @since 3.12
+ */
+ public MultiStatus(Class<?> caller, int code, String message) {
+ super(OK, caller, code, message, null);
+ }
+
+ /**
+ * Creates and returns a new multi-status object with no children.
+ *
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param message a human-readable message, localized to the current locale
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
index fe1835a07..aa63c3ffd 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Status.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,10 +10,13 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alexander Fedorov (ArSysOp) - Bug 561712
*******************************************************************************/
package org.eclipse.core.runtime;
+import java.util.Optional;
import org.eclipse.core.internal.runtime.LocalizationUtils;
+import org.osgi.framework.FrameworkUtil;
/**
* A concrete status implementation, suitable either for
@@ -78,6 +81,28 @@ public class Status implements IStatus {
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param caller the relevant class to build unique identifier from
+ * @param code the caller-specific status code, or <code>OK</code>
+ * @param message a human-readable message, localized to the
+ * current locale
+ * @param exception a low-level exception, or <code>null</code> if not
+ * applicable
+ *
+ * @since 3.12
+ */
+ public Status(int severity, Class<?> caller, int code, String message, Throwable exception) {
+ setSeverity(severity);
+ setPlugin(identifier(caller));
+ setCode(code);
+ setMessage(message);
+ setException(exception);
+ }
+
+ /**
+ * Creates a new status object. The created status has no children.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code, or <code>OK</code>
* @param message a human-readable message, localized to the
@@ -99,6 +124,28 @@ public class Status implements IStatus {
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param caller the relevant class to build unique identifier from
+ * @param message a human-readable message, localized to the
+ * current locale
+ * @param exception a low-level exception, or <code>null</code> if not
+ * applicable
+ *
+ * @since 3.12
+ */
+ public Status(int severity, Class<?> caller, String message, Throwable exception) {
+ setSeverity(severity);
+ setPlugin(identifier(caller));
+ setMessage(message);
+ setException(exception);
+ setCode(OK);
+ }
+
+ /**
+ * Simplified constructor of a new status object; assumes that code is <code>OK</code>.
+ * The created status has no children.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
@@ -121,6 +168,26 @@ public class Status implements IStatus {
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
+ * @param caller the relevant class to build unique identifier from
+ * @param message a human-readable message, localized to the
+ * current locale
+ *
+ * @since 3.12
+ */
+ public Status(int severity, Class<?> caller, String message) {
+ setSeverity(severity);
+ setPlugin(identifier(caller));
+ setMessage(message);
+ setCode(OK);
+ setException(null);
+ }
+
+ /**
+ * Simplified constructor of a new status object; assumes that code is <code>OK</code> and
+ * exception is <code>null</code>. The created status has no children.
+ *
+ * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
+ * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
@@ -135,6 +202,21 @@ public class Status implements IStatus {
setException(null);
}
+ /**
+ * Extracts an identifier from the given class: either bundle symbolic name or class name, never returns <code>null</code>
+ *
+ * @param caller the relevant class to build unique identifier from
+ * @return identifier extracted for the given class
+ */
+ private String identifier(Class<?> caller) {
+ return Optional.ofNullable(caller)//
+ .flatMap(c -> Optional.ofNullable(FrameworkUtil.getBundle(c)))//
+ .map(b -> b.getSymbolicName())//
+ .orElseGet(() -> Optional.ofNullable(caller)//
+ .map(c -> c.getName())//
+ .orElse(getClass().getName()));
+ }
+
@Override
public IStatus[] getChildren() {
return theEmptyStatusArray;

Back to the top