Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-10-25 09:36:52 +0000
committerEike Stepper2020-10-25 09:36:52 +0000
commitb8b35d2a71656299f59ff81f178ff5a86b8ab231 (patch)
tree0d0354d2267b4468b31b45c3d2101d544b6d564f /plugins/org.eclipse.emf.cdo.transfer/src
parentc7dd466c29b321a707d3f58dea2f0cf7fee833bb (diff)
downloadcdo-b8b35d2a71656299f59ff81f178ff5a86b8ab231.tar.gz
cdo-b8b35d2a71656299f59ff81f178ff5a86b8ab231.tar.xz
cdo-b8b35d2a71656299f59ff81f178ff5a86b8ab231.zip
[568207] Add various small APIs to net4j.util and cdo
https://bugs.eclipse.org/bugs/show_bug.cgi?id=568207
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.transfer/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java8
2 files changed, 6 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java
index cb1bf2f58d..fbba8ea733 100644
--- a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.transfer;
import org.eclipse.emf.cdo.spi.transfer.ResourceFactoryRegistryWithoutDefaults;
+import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -35,7 +36,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import java.io.InputStream;
@@ -271,11 +271,7 @@ public class CDOTransfer implements INotifier
protected void validate(CDOTransferMapping mapping, IProgressMonitor monitor)
{
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
-
+ ConcurrencyUtil.checkCancelation(monitor);
if (mapping.getStatus() == CDOTransferMapping.Status.CONFLICT)
{
throw new IllegalStateException("Conflict: " + mapping);
@@ -284,6 +280,7 @@ public class CDOTransfer implements INotifier
monitor.worked(1);
for (CDOTransferMapping child : mapping.getChildren())
{
+ ConcurrencyUtil.checkCancelation(monitor);
validate(child, monitor);
}
}
@@ -315,10 +312,7 @@ public class CDOTransfer implements INotifier
protected void perform(CDOTransferMapping mapping, IProgressMonitor monitor)
{
monitor.subTask("Transferring " + mapping);
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
+ ConcurrencyUtil.checkCancelation(monitor);
CDOTransferType transferType = mapping.getTransferType();
if (transferType == CDOTransferType.FOLDER)
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java
index e9ca42fe06..4f0b0b9b0b 100644
--- a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.transfer;
+import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
import org.eclipse.net4j.util.io.IORuntimeException;
import org.eclipse.emf.common.util.EList;
@@ -19,7 +20,6 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import java.io.IOException;
@@ -97,11 +97,7 @@ public abstract class CDOTransferSystem
for (Resource resource : resources)
{
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
-
+ ConcurrencyUtil.checkCancelation(monitor);
monitor.subTask("Saving " + resource.getURI());
resource.save(null);
monitor.worked(1);

Back to the top