Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Laeubrich2020-08-09 16:47:50 +0000
committerAlexander Kurtakov2020-09-09 14:37:26 +0000
commit38a7402d9cc8c98aaba04267d2dbabfa2b1c5653 (patch)
tree878b608bfa13fdd5aa4841814f3543fb945274e7
parentb3ab49d227b758e93d2d5e7733a5d4c7e637cd46 (diff)
downloadrt.equinox.bundles-38a7402d9cc8c98aaba04267d2dbabfa2b1c5653.tar.gz
rt.equinox.bundles-38a7402d9cc8c98aaba04267d2dbabfa2b1c5653.tar.xz
rt.equinox.bundles-38a7402d9cc8c98aaba04267d2dbabfa2b1c5653.zip
Change-Id: I59370a1e61be564da4a3a500bb85cea07bd91d05 Signed-off-by: Christoph Laeubrich <laeubi@laeubi-soft.de>
-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/IProgressMonitor.java29
3 files changed, 30 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common/META-INF/MANIFEST.MF
index fb17d96df..046bb34e8 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.13.0.qualifier
+Bundle-Version: 3.14.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 ed82784de..e21dcb603 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.13.0-SNAPSHOT</version>
+ <version>3.14.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.java
index 04562e6cd..3eb19cb98 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.java
@@ -10,7 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Christoph Läubrich - join with IProgressMonitorWithBlocking
+ * Christoph Laeubrich - join with IProgressMonitorWithBlocking, add null aware helper methods
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -207,4 +207,31 @@ public interface IProgressMonitor {
public default void clearBlocked() {
//default implementation does nothing
}
+
+ /**
+ * Calls {@link #done()} on the given monitor if is non-null. If the given monitor is null,
+ * this is a no-op.
+ * @param monitor the monitor to make done, might be <code>null</code>
+ * @since 3.14
+ */
+ static void done(IProgressMonitor monitor) {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+
+ /**
+ * Returns a <code>null</code> safe access to the given monitor, for example in cases where a monitor is passed to
+ * a function the implementation can call this method to get a guaranteed non-null monitor reference
+ * @param monitor
+ * the monitor to check
+ * @return the passed monitor instance or {@link NullProgressMonitor} if monitor was <code>null</code>
+ * @since 3.14
+ */
+ static IProgressMonitor nullSafe(IProgressMonitor monitor) {
+ if (monitor == null) {
+ return new NullProgressMonitor();
+ }
+ return monitor;
+ }
}

Back to the top