Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-09-13 10:53:03 +0000
committerEike Stepper2012-09-13 10:53:03 +0000
commit60bd9db3a11ef8619f73069628e3317fe6bfb288 (patch)
tree23b461e622959fd3ea72b05d6d7b1a9db6eb13bf /plugins/org.eclipse.emf.cdo.transfer.workspace.ui
parent7e37ab497ef46dfd7441815b17df74609f8ebb72 (diff)
downloadcdo-60bd9db3a11ef8619f73069628e3317fe6bfb288.tar.gz
cdo-60bd9db3a11ef8619f73069628e3317fe6bfb288.tar.xz
cdo-60bd9db3a11ef8619f73069628e3317fe6bfb288.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.workspace.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.workspace.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.workspace.ui/src/org/eclipse/emf/cdo/transfer/internal/workspace/WorkspaceUIProvider.java37
2 files changed, 38 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/META-INF/MANIFEST.MF
index 2e8aeddc05..032a9392b4 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.transfer.ui;bundle-version="[4.2.0,5.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.transfer.workspace;bundle-version="[4.2.0,5.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.transfer.internal.workspace;version="4.2.0";x-internal:=true,
diff --git a/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/src/org/eclipse/emf/cdo/transfer/internal/workspace/WorkspaceUIProvider.java b/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/src/org/eclipse/emf/cdo/transfer/internal/workspace/WorkspaceUIProvider.java
index b1d211618c..a7da8500b8 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/src/org/eclipse/emf/cdo/transfer/internal/workspace/WorkspaceUIProvider.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.workspace.ui/src/org/eclipse/emf/cdo/transfer/internal/workspace/WorkspaceUIProvider.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.transfer.internal.workspace;
+import org.eclipse.emf.cdo.transfer.CDOTransferElement;
import org.eclipse.emf.cdo.transfer.CDOTransferSystem;
import org.eclipse.emf.cdo.transfer.spi.ui.NativeObjectLabelProvider;
import org.eclipse.emf.cdo.transfer.spi.ui.TransferUIProvider;
@@ -17,11 +18,17 @@ import org.eclipse.emf.cdo.transfer.spi.workspace.WorkspaceTransferSystem;
import org.eclipse.net4j.util.factory.ProductCreationException;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.dnd.Transfer;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.ResourceTransfer;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -40,6 +47,36 @@ public class WorkspaceUIProvider implements TransferUIProvider
return new NativeObjectLabelProvider(delegate);
}
+ public void addSupportedTransfers(List<Transfer> transfers)
+ {
+ transfers.add(ResourceTransfer.getInstance());
+ }
+
+ public List<CDOTransferElement> convertTransferData(Object data)
+ {
+ if (data instanceof IResource[])
+ {
+ IResource[] resources = (IResource[])data;
+ List<CDOTransferElement> result = new ArrayList<CDOTransferElement>(resources.length);
+ for (int i = 0; i < resources.length; i++)
+ {
+ IResource resource = resources[i];
+ CDOTransferElement element = WorkspaceTransferSystem.INSTANCE.getElement(resource.getFullPath());
+ result.add(element);
+ }
+
+ return result;
+ }
+
+ return null;
+ }
+
+ public CDOTransferElement convertTransferTarget(Object target)
+ {
+ // TODO: implement WorkspaceUIProvider.convertTransferTarget(target)
+ return null;
+ }
+
/**
* @author Eike Stepper
*/

Back to the top