Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Läubrich2020-05-28 17:41:10 +0000
committerAlexander Kurtakov2020-08-07 11:20:50 +0000
commit6d7f963b18a7571025baf6cba2983956d89bf4bf (patch)
tree0b7a976b7cfe0da6de3fe9b4e4220d42da896cf3
parentccb76f870db16c1eae81bd85b6932f139e18b452 (diff)
downloadrt.equinox.bundles-6d7f963b18a7571025baf6cba2983956d89bf4bf.tar.gz
rt.equinox.bundles-6d7f963b18a7571025baf6cba2983956d89bf4bf.tar.xz
rt.equinox.bundles-6d7f963b18a7571025baf6cba2983956d89bf4bf.zip
Bug 552683 - Merge IProgressMonitor and IProgressMonitorWithBlocking
Change-Id: Ibce49e9bd1a30dc179666c60d18888255b26cdf9 Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
-rw-r--r--bundles/org.eclipse.equinox.common/.settings/.api_filters17
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.java37
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java32
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java9
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.java10
5 files changed, 66 insertions, 39 deletions
diff --git a/bundles/org.eclipse.equinox.common/.settings/.api_filters b/bundles/org.eclipse.equinox.common/.settings/.api_filters
new file mode 100644
index 000000000..1dfadffc6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common/.settings/.api_filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.equinox.common" version="2">
+ <resource path="src/org/eclipse/core/runtime/IProgressMonitor.java" type="org.eclipse.core.runtime.IProgressMonitor">
+ <filter comment="Default implemented method is backward-compatible" id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.core.runtime.IProgressMonitor"/>
+ <message_argument value="clearBlocked()"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Default implemented method is backward-compatible" id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.core.runtime.IProgressMonitor"/>
+ <message_argument value="setBlocked(IStatus)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
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 f6f1b3b92..04562e6cd 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 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
+ * Christoph Läubrich - join with IProgressMonitorWithBlocking
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -172,4 +173,38 @@ public interface IProgressMonitor {
* @param work a non-negative number of work units just completed
*/
public void worked(int work);
+
+ /**
+ * Indicates that this operation is blocked by some background activity. If
+ * a running operation ever calls <code>setBlocked</code>, it must
+ * eventually call <code>clearBlocked</code> before the operation
+ * completes.
+ * <p>
+ * If the caller is blocked by a currently executing job, this method will return
+ * an <code>IJobStatus</code> indicating the job that is currently blocking
+ * the caller. If this blocking job is not known, this method will return a plain
+ * informational <code>IStatus</code> object.
+ * </p>
+ *
+ * @param reason an optional status object whose message describes the
+ * reason why this operation is blocked, or <code>null</code> if this
+ * information is not available.
+ * @see #clearBlocked()
+ * @since 3.13
+ */
+ public default void setBlocked(IStatus reason) {
+ //default implementation does nothing
+ }
+
+ /**
+ * Clears the blocked state of the running operation. If a running
+ * operation ever calls <code>setBlocked</code>, it must eventually call
+ * <code>clearBlocked</code> before the operation completes.
+ *
+ * @see #setBlocked(IStatus)
+ * @since 3.13
+ */
+ public default void clearBlocked() {
+ //default implementation does nothing
+ }
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
index eff41bd41..bd70f73e1 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 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 - Initial API and implementation
+ * Christoph Läubrich - join with IProgressMonitorWithBlocking
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -32,33 +33,8 @@ package org.eclipse.core.runtime;
* @see IProgressMonitor
* @since 3.0
*/
+@Deprecated
public interface IProgressMonitorWithBlocking extends IProgressMonitor {
- /**
- * Indicates that this operation is blocked by some background activity. If
- * a running operation ever calls <code>setBlocked</code>, it must
- * eventually call <code>clearBlocked</code> before the operation
- * completes.
- * <p>
- * If the caller is blocked by a currently executing job, this method will return
- * an <code>IJobStatus</code> indicating the job that is currently blocking
- * the caller. If this blocking job is not known, this method will return a plain
- * informational <code>IStatus</code> object.
- * </p>
- *
- * @param reason an optional status object whose message describes the
- * reason why this operation is blocked, or <code>null</code> if this
- * information is not available.
- * @see #clearBlocked()
- */
- public void setBlocked(IStatus reason);
-
- /**
- * Clears the blocked state of the running operation. If a running
- * operation ever calls <code>setBlocked</code>, it must eventually call
- * <code>clearBlocked</code> before the operation completes.
- *
- * @see #setBlocked(IStatus)
- */
- public void clearBlocked();
+ //content moved to IProgressMonitor
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java
index ceca7eec5..5a21cfec6 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.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
+ * Christoph Läubrich - adjust to new API
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -62,8 +63,7 @@ public abstract class ProgressMonitorWrapper implements IProgressMonitor, IProgr
*/
@Override
public void clearBlocked() {
- if (progressMonitor instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) progressMonitor).clearBlocked();
+ progressMonitor.clearBlocked();
}
/**
@@ -125,8 +125,7 @@ public abstract class ProgressMonitorWrapper implements IProgressMonitor, IProgr
*/
@Override
public void setBlocked(IStatus reason) {
- if (progressMonitor instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) progressMonitor).setBlocked(reason);
+ progressMonitor.setBlocked(reason);
}
/**
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.java
index d704e244b..c6628aa70 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,6 +16,7 @@
* Stefan Xenos (Google) - bug 475747 - Support efficient, convenient cancellation checks in SubMonitor
* Stefan Xenos (Google) - bug 476924 - Add a SUPPRESS_ISCANCELED flag to SubMonitor
* IBM Corporation - ongoing maintenance
+ * Christoph Läubrich - adjust to new API
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -260,13 +261,12 @@ public final class SubMonitor implements IProgressMonitorWithBlocking {
}
public void clearBlocked() {
- if (root instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) root).clearBlocked();
+ root.clearBlocked();
}
public void setBlocked(IStatus reason) {
- if (root instanceof IProgressMonitorWithBlocking)
- ((IProgressMonitorWithBlocking) root).setBlocked(reason);
+
+ root.setBlocked(reason);
}
public void checkForCancellation() {

Back to the top