Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-09-24 10:46:30 +0000
committerEike Stepper2012-09-24 10:46:30 +0000
commit6a638ab57dd982c3164a172e99ce8c064953b006 (patch)
tree7857c4e372c7dc33a6055a120def7c3731a27178 /plugins/org.eclipse.emf.cdo.transfer/src
parent5099a29f7a689840273b7c75102ed404a278c6ac (diff)
downloadcdo-6a638ab57dd982c3164a172e99ce8c064953b006.tar.gz
cdo-6a638ab57dd982c3164a172e99ce8c064953b006.tar.xz
cdo-6a638ab57dd982c3164a172e99ce8c064953b006.zip
[388928] Develop a resource transfer framework
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388928
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.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java35
2 files changed, 45 insertions, 23 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 8c094d1e12..a65dd5f68b 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
@@ -159,28 +159,28 @@ public class CDOTransfer implements INotifier
return mappings.size();
}
- public CDOTransferMapping map(IPath sourcePath)
+ public CDOTransferMapping map(IPath sourcePath, IProgressMonitor monitor)
{
CDOTransferElement source = sourceSystem.getElement(sourcePath);
- return map(source);
+ return map(source, monitor);
}
- public CDOTransferMapping map(String sourcePath)
+ public CDOTransferMapping map(String sourcePath, IProgressMonitor monitor)
{
- return map(new Path(sourcePath));
+ return map(new Path(sourcePath), monitor);
}
- public CDOTransferMapping map(CDOTransferElement source)
+ public CDOTransferMapping map(CDOTransferElement source, IProgressMonitor monitor)
{
- return map(source, rootMapping);
+ return map(source, rootMapping, monitor);
}
- protected CDOTransferMapping map(CDOTransferElement source, CDOTransferMapping parent)
+ protected CDOTransferMapping map(CDOTransferElement source, CDOTransferMapping parent, IProgressMonitor monitor)
{
CDOTransferMapping mapping = mappings.get(source);
if (mapping == null)
{
- mapping = createMapping(source, parent);
+ mapping = createMapping(source, parent, monitor);
mappings.put(source, mapping);
}
else
@@ -200,9 +200,10 @@ public class CDOTransfer implements INotifier
mapping.getChildren();
}
- protected CDOTransferMapping createMapping(CDOTransferElement source, CDOTransferMapping parent)
+ protected CDOTransferMapping createMapping(CDOTransferElement source, CDOTransferMapping parent,
+ IProgressMonitor monitor)
{
- return new CDOTransferMappingImpl(this, source, parent);
+ return new CDOTransferMappingImpl(this, source, parent, monitor);
}
protected ModelTransferContext createModelTransferContext()
@@ -217,18 +218,18 @@ public class CDOTransfer implements INotifier
return CDOTransferType.FOLDER;
}
- if (modelTransferContext.hasResourceFactory(source))
+ CDOTransferType type = sourceSystem.getDefaultTransferType(source);
+ if (type != null)
{
- return CDOTransferType.MODEL;
+ return type;
}
- CDOTransferType type = sourceSystem.getDefaultTransferType(source);
- if (type == null)
+ if (modelTransferContext.hasResourceFactory(source))
{
- type = getDefaultTransferType();
+ return CDOTransferType.MODEL;
}
- return type;
+ return getDefaultTransferType();
}
protected void validate(CDOTransferMapping mapping, IProgressMonitor monitor)
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java
index bcf80020df..c04a480f0b 100644
--- a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java
@@ -13,7 +13,9 @@ package org.eclipse.emf.cdo.transfer;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
import java.util.ArrayList;
import java.util.Arrays;
@@ -37,7 +39,8 @@ class CDOTransferMappingImpl implements CDOTransferMapping
private IPath relativePath;
- public CDOTransferMappingImpl(CDOTransfer transfer, CDOTransferElement source, CDOTransferMapping parent)
+ public CDOTransferMappingImpl(CDOTransfer transfer, CDOTransferElement source, CDOTransferMapping parent,
+ IProgressMonitor monitor)
{
this.transfer = transfer;
this.source = source;
@@ -52,12 +55,30 @@ class CDOTransferMappingImpl implements CDOTransferMapping
this.parent.addChild(this);
}
- if (isDirectory())
+ try
{
- for (CDOTransferElement child : source.getChildren())
+ if (isDirectory())
{
- transfer.map(child, this);
+ CDOTransferElement[] children = source.getChildren();
+ monitor.beginTask("", 1 + children.length);
+ monitor.subTask("Mapping " + source);
+ monitor.worked(1);
+
+ for (CDOTransferElement child : children)
+ {
+ transfer.map(child, this, new SubProgressMonitor(monitor, 1));
+ }
}
+ else
+ {
+ monitor.beginTask("", 1);
+ monitor.subTask("Mapping " + source);
+ monitor.worked(1);
+ }
+ }
+ finally
+ {
+ monitor.done();
}
}
@@ -117,10 +138,10 @@ class CDOTransferMappingImpl implements CDOTransferMapping
public void setRelativePath(IPath path)
{
- if (!ObjectUtil.equals(this.relativePath, path))
+ if (!ObjectUtil.equals(relativePath, path))
{
- IPath oldPath = this.relativePath;
- this.relativePath = path;
+ IPath oldPath = relativePath;
+ relativePath = path;
transfer.relativePathChanged(this, oldPath, path);
}
}

Back to the top