Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-09-13 14:59:34 +0000
committerEike Stepper2012-09-13 14:59:34 +0000
commitfcbc41822ee66299be45911598a87d16572e94d5 (patch)
treecbd9121c38aaff2fb496f578216a9910b32ea7d9 /plugins
parent1e471bbbeea7116481ea08522a43b58d8f2b9b47 (diff)
downloadcdo-fcbc41822ee66299be45911598a87d16572e94d5.tar.gz
cdo-fcbc41822ee66299be45911598a87d16572e94d5.tar.xz
cdo-fcbc41822ee66299be45911598a87d16572e94d5.zip
[388928] Develop a resource transfer framework
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388928
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/icons/export_wiz.pngbin0 -> 6675 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/icons/import_wiz.pngbin0 -> 6650 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/icons/transfer_wiz.pngbin0 -> 6417 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDialog.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDropAdapter.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferTreeComposite.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java415
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java447
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.workspace/src/org/eclipse/emf/cdo/transfer/spi/workspace/WorkspaceTransferSystem.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/ResourceFactoryRegistryWithoutDefaults.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java15
19 files changed, 1264 insertions, 57 deletions
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.transfer.ui/META-INF/MANIFEST.MF
index e424bfa8d1..41a290ebff 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.4.0,4.0.0)";visibility:=reexport,
org.eclipse.net4j.util.ui;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.net4j.ui.shared;bundle-version="[4.1.0,5.0.0)",
org.eclipse.emf.cdo.ui.shared;bundle-version="[4.1.0,5.0.0)",
org.eclipse.emf.cdo.transfer;bundle-version="[4.2.0,5.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.transfer.workspace;bundle-version="[4.2.0,5.0.0)";resolution:=optional
@@ -17,6 +18,7 @@ Export-Package: org.eclipse.emf.cdo.transfer.internal.ui;version="4.2.0";x-inter
org.eclipse.emf.cdo.transfer.internal.ui.bundle;version="4.2.0";x-internal:=true,
org.eclipse.emf.cdo.transfer.spi.ui;version="4.2.0",
org.eclipse.emf.cdo.transfer.ui;version="4.2.0",
- org.eclipse.emf.cdo.transfer.ui.swt;version="4.2.0"
+ org.eclipse.emf.cdo.transfer.ui.swt;version="4.2.0",
+ org.eclipse.wb.swt;version="4.2.0";x-internal:=true
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.emf.cdo.transfer.internal.ui.bundle.OM$Activator
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/build.properties b/plugins/org.eclipse.emf.cdo.transfer.ui/build.properties
index e07e9fa27f..cacfa9776a 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/build.properties
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/build.properties
@@ -15,7 +15,8 @@ bin.includes = .,\
.options,\
about.html,\
copyright.txt,\
- plugin.xml
+ plugin.xml,\
+ icons/
src.includes = about.html,\
copyright.txt
jars.compile.order = .
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/icons/export_wiz.png b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/export_wiz.png
new file mode 100644
index 0000000000..aa787ef561
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/export_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/icons/import_wiz.png b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/import_wiz.png
new file mode 100644
index 0000000000..732631c0ac
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/import_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/icons/transfer_wiz.png b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/transfer_wiz.png
new file mode 100644
index 0000000000..72ab80ff94
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/icons/transfer_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
index 0282fbd426..f794276137 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
@@ -36,9 +36,23 @@ public abstract class OM
*/
public static final class Activator extends UIActivator
{
+ public static Activator INSTANCE;
+
public Activator()
{
super(BUNDLE);
}
+
+ @Override
+ protected void doStart() throws Exception
+ {
+ INSTANCE = this;
+ }
+
+ @Override
+ protected void doStop() throws Exception
+ {
+ INSTANCE = null;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDialog.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDialog.java
new file mode 100644
index 0000000000..8c7db273d0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDialog.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.transfer.ui;
+
+import org.eclipse.emf.cdo.transfer.CDOTransfer;
+import org.eclipse.emf.cdo.transfer.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.transfer.ui.swt.TransferComposite;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Eike Stepper
+ */
+public class TransferDialog extends TitleAreaDialog
+{
+ private CDOTransfer transfer;
+
+ private TransferComposite transferComposite;
+
+ private Image wizban;
+
+ public TransferDialog(Shell parentShell, CDOTransfer transfer)
+ {
+ super(parentShell);
+ setShellStyle(SWT.RESIZE | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ this.transfer = transfer;
+ }
+
+ public TransferComposite getTransferComposite()
+ {
+ return transferComposite;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ ImageDescriptor descriptor = OM.Activator.INSTANCE.loadImageDescriptor("icons/transfer_wiz.png");
+ Display display = parent.getDisplay();
+ wizban = descriptor.createImage(display);
+
+ setTitle("Transfer from " + transfer.getSourceSystem() + " to " + transfer.getTargetSystem());
+ setTitleImage(wizban);
+
+ Composite area = (Composite)super.createDialogArea(parent);
+
+ Composite container = new Composite(area, SWT.NONE);
+ container.setLayout(new FillLayout());
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ transferComposite = new TransferComposite(container, transfer);
+
+ return area;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ @Override
+ protected Point getInitialSize()
+ {
+ return new Point(1000, 800);
+ }
+
+ @Override
+ public boolean close()
+ {
+ if (wizban != null)
+ {
+ wizban.dispose();
+ wizban = null;
+ }
+
+ return super.close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDropAdapter.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDropAdapter.java
index 76729020b3..f12146f9c4 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDropAdapter.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferDropAdapter.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.transfer.ui;
import org.eclipse.emf.cdo.transfer.CDOTransfer;
import org.eclipse.emf.cdo.transfer.CDOTransferElement;
import org.eclipse.emf.cdo.transfer.CDOTransferSystem;
-import org.eclipse.emf.cdo.transfer.internal.ui.TransferView;
import org.eclipse.emf.cdo.transfer.spi.ui.TransferUIProvider;
import org.eclipse.emf.cdo.transfer.spi.ui.TransferUIProvider.Factory;
@@ -24,6 +23,7 @@ import org.eclipse.net4j.util.ui.dnd.DNDDropAdapter;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Shell;
import java.util.ArrayList;
import java.util.List;
@@ -108,12 +108,21 @@ public class TransferDropAdapter extends DNDDropAdapter<Object>
protected boolean performTransfer(CDOTransfer transfer)
{
- if (TransferView.INSTANCE == null)
+ Shell shell = getViewer().getControl().getShell();
+ TransferDialog dialog = new TransferDialog(shell, transfer);
+ if (dialog.open() == TransferDialog.OK)
{
- return false;
+ transfer.perform();
+ return true;
}
- TransferView.INSTANCE.setTransfer(transfer);
+ // if (TransferView.INSTANCE == null)
+ // {
+ // return false;
+ // }
+ //
+ // TransferView.INSTANCE.setTransfer(transfer);
+
return false;
}
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
index 369873291a..3591102e28 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.transfer.CDOTransfer;
import org.eclipse.emf.cdo.transfer.CDOTransferMapping;
import org.eclipse.emf.cdo.transfer.CDOTransferMapping.Status;
import org.eclipse.emf.cdo.transfer.CDOTransferSystem;
+import org.eclipse.emf.cdo.transfer.CDOTransferType;
import org.eclipse.emf.cdo.transfer.spi.ui.TransferUIProvider;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -115,8 +116,16 @@ public class TransferLabelProvider extends LabelProvider implements ITableLabelP
{
case 0:
return null;
+
case 1:
+ CDOTransferType transferType = mapping.getTransferType();
+ if (transferType == CDOTransferType.FOLDER)
+ {
+ return TransferLabelProvider.GRAY;
+ }
+
return null;
+
case 2:
case 3:
Status status = mapping.getStatus();
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
index 52b0e68143..4180479580 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
@@ -11,8 +11,11 @@
package org.eclipse.emf.cdo.transfer.ui.swt;
import org.eclipse.emf.cdo.transfer.CDOTransfer;
+import org.eclipse.emf.cdo.transfer.CDOTransfer.ModelTransferContext;
+import org.eclipse.emf.cdo.transfer.CDOTransfer.ModelTransferResolution;
import org.eclipse.emf.cdo.transfer.CDOTransferElement;
import org.eclipse.emf.cdo.transfer.CDOTransferMapping;
+import org.eclipse.emf.cdo.transfer.CDOTransferSystem;
import org.eclipse.emf.cdo.transfer.CDOTransferType;
import org.eclipse.emf.cdo.transfer.ui.TransferTypeContentProvider;
@@ -21,6 +24,7 @@ import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.ui.StructuredContentProvider;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
@@ -28,6 +32,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
@@ -39,6 +44,7 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -46,6 +52,7 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
import java.util.Arrays;
import java.util.HashSet;
@@ -81,6 +88,12 @@ public class TransferDetailsComposite extends Composite implements IListener
private ListViewer unmappedModels;
+ private Button mapSource;
+
+ private Button replaceTarget;
+
+ private Button keepAsIs;
+
public TransferDetailsComposite(Composite parent, int style, final CDOTransfer transfer)
{
super(parent, style);
@@ -252,11 +265,21 @@ public class TransferDetailsComposite extends Composite implements IListener
unmappedModels = new ListViewer(this, SWT.BORDER);
org.eclipse.swt.widgets.List list = unmappedModels.getList();
+ list.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
unmappedModels.setContentProvider(new UnmappedModelsContentProvider());
- unmappedModels.setLabelProvider(new UnmappedModelsLabelProvider());
+ unmappedModels.setLabelProvider(new UnmappedModelsLabelProvider(transfer));
unmappedModels.setInput(transfer);
+ unmappedModels.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ IStructuredSelection selection = (IStructuredSelection)unmappedModels.getSelection();
+ Resource resource = (Resource)selection.getFirstElement();
+ updateTransformationButtons(resource);
+ }
+ });
GridLayout transformationButtonsPaneLayout = new GridLayout(1, false);
transformationButtonsPaneLayout.marginWidth = 0;
@@ -266,7 +289,7 @@ public class TransferDetailsComposite extends Composite implements IListener
transformationButtonsPane.setLayout(transformationButtonsPaneLayout);
transformationButtonsPane.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1));
- Button mapSource = new Button(transformationButtonsPane, SWT.NONE);
+ mapSource = new Button(transformationButtonsPane, SWT.NONE);
mapSource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mapSource.setBounds(0, 0, 75, 25);
mapSource.setText("Map From Source");
@@ -284,15 +307,31 @@ public class TransferDetailsComposite extends Composite implements IListener
}
});
- Button replaceTarget = new Button(transformationButtonsPane, SWT.NONE);
+ replaceTarget = new Button(transformationButtonsPane, SWT.NONE);
replaceTarget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
replaceTarget.setBounds(0, 0, 75, 25);
replaceTarget.setText("Replace With Target");
- Button keepAsIs = new Button(transformationButtonsPane, SWT.NONE);
+ keepAsIs = new Button(transformationButtonsPane, SWT.NONE);
keepAsIs.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
keepAsIs.setBounds(0, 0, 75, 25);
keepAsIs.setText("Keep As Is");
+ keepAsIs.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ IStructuredSelection selection = (IStructuredSelection)unmappedModels.getSelection();
+ Resource resource = (Resource)selection.getFirstElement();
+
+ URI uri = resource.getURI();
+ transfer.getModelTransferContext().setResolution(uri, new ModelTransferResolution()
+ {
+ });
+ }
+ });
+
+ updateTransformationButtons(null);
}
@Override
@@ -395,6 +434,16 @@ public class TransferDetailsComposite extends Composite implements IListener
notifyMappingEvent(e);
}
}
+ else if (event instanceof CDOTransfer.UnmappedModelsEvent)
+ {
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ unmappedModels.refresh();
+ }
+ });
+ }
}
protected void notifyMappingEvent(CDOTransfer.MappingEvent event)
@@ -444,6 +493,26 @@ public class TransferDetailsComposite extends Composite implements IListener
Arrays.sort(transferTypes);
}
+ protected void updateTransformationButtons(Resource resource)
+ {
+ if (resource == null)
+ {
+ mapSource.setEnabled(false);
+ replaceTarget.setEnabled(false);
+ keepAsIs.setEnabled(false);
+ return;
+ }
+
+ URI uri = resource.getURI();
+ CDOTransferSystem sourceSystem = transfer.getSourceSystem();
+ CDOTransferElement sourceElement = sourceSystem.getElement(uri);
+ mapSource.setEnabled(sourceElement != null);
+
+ ModelTransferContext context = transfer.getModelTransferContext();
+ ModelTransferResolution resolution = context.getResolution(uri);
+ keepAsIs.setEnabled(resolution == null); // TODO Test type of resolution
+ }
+
/**
* @author Eike Stepper
*/
@@ -460,8 +529,24 @@ public class TransferDetailsComposite extends Composite implements IListener
/**
* @author Eike Stepper
*/
- public static class UnmappedModelsLabelProvider extends LabelProvider
+ public static class UnmappedModelsLabelProvider extends LabelProvider implements IColorProvider
{
+ public static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+
+ public static final Color RED = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
+
+ private CDOTransfer transfer;
+
+ public UnmappedModelsLabelProvider(CDOTransfer transfer)
+ {
+ this.transfer = transfer;
+ }
+
+ public CDOTransfer getTransfer()
+ {
+ return transfer;
+ }
+
@Override
public String getText(Object element)
{
@@ -473,5 +558,28 @@ public class TransferDetailsComposite extends Composite implements IListener
return super.getText(element);
}
+
+ public Color getForeground(Object element)
+ {
+ if (element instanceof Resource)
+ {
+ Resource resource = (Resource)element;
+ URI uri = resource.getURI();
+
+ ModelTransferContext context = transfer.getModelTransferContext();
+ ModelTransferResolution resolution = context.getResolution(uri);
+ if (resolution != null) // TODO Test type of resolution
+ {
+ return GRAY;
+ }
+ }
+
+ return RED;
+ }
+
+ public Color getBackground(Object element)
+ {
+ return null;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferTreeComposite.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferTreeComposite.java
index 7ab732aafd..6332a29803 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferTreeComposite.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferTreeComposite.java
@@ -15,12 +15,19 @@ import org.eclipse.emf.cdo.transfer.CDOTransferMapping;
import org.eclipse.emf.cdo.transfer.ui.TransferContentProvider;
import org.eclipse.emf.cdo.transfer.ui.TransferLabelProvider;
+import org.eclipse.net4j.ui.shared.SharedIcons;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
@@ -70,6 +77,21 @@ public class TransferTreeComposite extends Composite
viewer.setContentProvider(new TransferContentProvider());
viewer.setLabelProvider(new TransferLabelProvider(transfer));
viewer.setInput(transfer.getRootMapping());
+
+ MenuManager manager = new MenuManager();
+ Menu menu = manager.createContextMenu(tree);
+ manager.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ CDOTransferMapping mapping = (CDOTransferMapping)selection.getFirstElement();
+ manager.add(new UnmapAction(mapping));
+ }
+ });
+
+ manager.setRemoveAllWhenShown(true);
+ tree.setMenu(menu);
}
public CDOTransfer getTransfer()
@@ -93,4 +115,29 @@ public class TransferTreeComposite extends Composite
{
return viewer.getTree().setFocus();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class UnmapAction extends Action
+ {
+ private CDOTransferMapping mapping;
+
+ public UnmapAction(CDOTransferMapping mapping)
+ {
+ super("Unmap", SharedIcons.getDescriptor(SharedIcons.ETOOL_DELETE));
+ this.mapping = mapping;
+ }
+
+ public CDOTransferMapping getMapping()
+ {
+ return mapping;
+ }
+
+ @Override
+ public void run()
+ {
+ mapping.unmap();
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java
new file mode 100644
index 0000000000..c1bfc8b578
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/ResourceManager.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Google, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Google, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wb.swt;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.osgi.framework.Bundle;
+
+/**
+ * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
+ * etc.
+ *
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ *
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ *
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class ResourceManager extends SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>();
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified
+ * class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image descriptor.
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) {
+ return ImageDescriptor.createFromFile(clazz, path);
+ }
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ try {
+ return ImageDescriptor.createFromURL(new File(path).toURI().toURL());
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+ /**
+ * Returns an {@link Image} based on the specified {@link ImageDescriptor}.
+ *
+ * @param descriptor
+ * the {@link ImageDescriptor} for the {@link Image}.
+ * @return the {@link Image} based on the specified {@link ImageDescriptor}.
+ */
+ public static Image getImage(ImageDescriptor descriptor) {
+ if (descriptor == null) {
+ return null;
+ }
+ Image image = m_descriptorImageMap.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage();
+ m_descriptorImageMap.put(descriptor, image);
+ }
+ return image;
+ }
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @return {@link Image} The resulting decorated image.
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @param corner
+ * the corner to place decorator image.
+ * @return the resulting decorated {@link Image}.
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ final Rectangle bib = baseImage.getBounds();
+ final Rectangle dib = decorator.getBounds();
+ final Point baseImageSize = new Point(bib.width, bib.height);
+ CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(baseImage.getImageData(), 0, 0);
+ if (corner == TOP_LEFT) {
+ drawImage(decorator.getImageData(), 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ drawImage(decorator.getImageData(), 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height);
+ }
+ }
+ @Override
+ protected Point getSize() {
+ return baseImageSize;
+ }
+ };
+ //
+ result = compositImageDesc.createImage();
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached images.
+ */
+ public static void disposeImages() {
+ SWTResourceManager.disposeImages();
+ // dispose ImageDescriptor images
+ {
+ for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_descriptorImageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ // dispose plugin images
+ {
+ for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_URLImageMap.clear();
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Plugin images support
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps URL to images.
+ */
+ private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>();
+ /**
+ * Provider for plugin resources, used by WindowBuilder at design time.
+ */
+ public interface PluginResourceProvider {
+ URL getEntry(String symbolicName, String path);
+ }
+ /**
+ * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time.
+ */
+ private static PluginResourceProvider m_designTimePluginResourceProvider = null;
+ /**
+ * Returns an {@link Image} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image
+ * @param name
+ * the path to the image within the plugin
+ * @return the {@link Image} stored in the file at the specified path
+ *
+ * @deprecated Use {@link #getPluginImage(String, String)} instead.
+ */
+ @Deprecated
+ public static Image getPluginImage(Object plugin, String name) {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link Image} stored in the file at the specified path.
+ */
+ public static Image getPluginImage(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on given {@link URL}.
+ */
+ private static Image getPluginImageFromUrl(URL url) {
+ try {
+ try {
+ String key = url.toExternalForm();
+ Image image = m_URLImageMap.get(key);
+ if (image == null) {
+ InputStream stream = url.openStream();
+ try {
+ image = getImage(stream);
+ m_URLImageMap.put(key, image);
+ } finally {
+ stream.close();
+ }
+ }
+ return image;
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image.
+ * @param name
+ * the path to th eimage within the plugin.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead.
+ */
+ @Deprecated
+ public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) {
+ try {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ return ImageDescriptor.createFromURL(url);
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ */
+ public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return ImageDescriptor.createFromURL(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a {@link Bundle} and resource entry path.
+ */
+ private static URL getPluginImageURL(String symbolicName, String path) {
+ // try runtime plugins
+ {
+ Bundle bundle = Platform.getBundle(symbolicName);
+ if (bundle != null) {
+ return bundle.getEntry(path);
+ }
+ }
+ // try design time provider
+ if (m_designTimePluginResourceProvider != null) {
+ return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
+ }
+ // no such resource
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the file path.
+ * @param name
+ * the file path.
+ * @return the {@link URL} representing the file at the specified path.
+ * @throws Exception
+ */
+ private static URL getPluginImageURL(Object plugin, String name) throws Exception {
+ // try to work with 'plugin' as with OSGI BundleContext
+ try {
+ Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$
+ Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$
+ if (BundleContextClass.isAssignableFrom(plugin.getClass())) {
+ Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$
+ Object bundle = getBundleMethod.invoke(plugin, new Object[0]);
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$
+ Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(null, new Object[]{bundle, path});
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ // else work with 'plugin' as with usual Eclipse plugin
+ {
+ Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$
+ if (PluginClass.isAssignableFrom(plugin.getClass())) {
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Method findMethod = PluginClass.getMethod("find", new Class[]{IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(plugin, new Object[]{path});
+ }
+ }
+ return null;
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeFonts();
+ disposeImages();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java
new file mode 100644
index 0000000000..d8a285807a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/wb/swt/SWTResourceManager.java
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Google, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Google, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wb.swt;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
+ * <p>
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ * <p>
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Color
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>();
+ /**
+ * Returns the system {@link Color} matching the specific ID.
+ *
+ * @param systemColorID
+ * the ID value for the color
+ * @return the system {@link Color} matching the specific ID
+ */
+ public static Color getColor(int systemColorID) {
+ Display display = Display.getCurrent();
+ return display.getSystemColor(systemColorID);
+ }
+ /**
+ * Returns a {@link Color} given its red, green and blue component values.
+ *
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return the {@link Color} matching the given red, green and blue component values
+ */
+ public static Color getColor(int r, int g, int b) {
+ return getColor(new RGB(r, g, b));
+ }
+ /**
+ * Returns a {@link Color} given its RGB value.
+ *
+ * @param rgb
+ * the {@link RGB} value of the color
+ * @return the {@link Color} matching the RGB value
+ */
+ public static Color getColor(RGB rgb) {
+ Color color = m_colorMap.get(rgb);
+ if (color == null) {
+ Display display = Display.getCurrent();
+ color = new Color(display, rgb);
+ m_colorMap.put(rgb, color);
+ }
+ return color;
+ }
+ /**
+ * Dispose of all the cached {@link Color}'s.
+ */
+ public static void disposeColors() {
+ for (Color color : m_colorMap.values()) {
+ color.dispose();
+ }
+ m_colorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps image paths to images.
+ */
+ private static Map<String, Image> m_imageMap = new HashMap<String, Image>();
+ /**
+ * Returns an {@link Image} encoded by the specified {@link InputStream}.
+ *
+ * @param stream
+ * the {@link InputStream} encoding the image data
+ * @return the {@link Image} encoded by the specified input stream
+ */
+ protected static Image getImage(InputStream stream) throws IOException {
+ try {
+ Display display = Display.getCurrent();
+ ImageData data = new ImageData(stream);
+ if (data.transparentPixel > 0) {
+ return new Image(display, data, data.getTransparencyMask());
+ }
+ return new Image(display, data);
+ } finally {
+ stream.close();
+ }
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(String path) {
+ Image image = m_imageMap.get(path);
+ if (image == null) {
+ try {
+ image = getImage(new FileInputStream(path));
+ m_imageMap.put(path, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(path, image);
+ }
+ }
+ return image;
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image
+ * @param path
+ * the path to the image file, if starts with <code>'/'</code>
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(Class<?> clazz, String path) {
+ String key = clazz.getName() + '|' + path;
+ Image image = m_imageMap.get(key);
+ if (image == null) {
+ try {
+ image = getImage(clazz.getResourceAsStream(path));
+ m_imageMap.put(key, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(key, image);
+ }
+ }
+ return image;
+ }
+ private static final int MISSING_IMAGE_SIZE = 10;
+ /**
+ * @return the small {@link Image} that can be used as placeholder for missing image.
+ */
+ private static Image getMissingImage() {
+ Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ //
+ GC gc = new GC(image);
+ gc.setBackground(getColor(SWT.COLOR_RED));
+ gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ gc.dispose();
+ //
+ return image;
+ }
+ /**
+ * Style constant for placing decorator image in top left corner of base image.
+ */
+ public static final int TOP_LEFT = 1;
+ /**
+ * Style constant for placing decorator image in top right corner of base image.
+ */
+ public static final int TOP_RIGHT = 2;
+ /**
+ * Style constant for placing decorator image in bottom left corner of base image.
+ */
+ public static final int BOTTOM_LEFT = 3;
+ /**
+ * Style constant for placing decorator image in bottom right corner of base image.
+ */
+ public static final int BOTTOM_RIGHT = 4;
+ /**
+ * Internal value.
+ */
+ protected static final int LAST_CORNER_KEY = 5;
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @return {@link Image} The resulting decorated image
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @param corner
+ * the corner to place decorator image
+ * @return the resulting decorated {@link Image}
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ Rectangle bib = baseImage.getBounds();
+ Rectangle dib = decorator.getBounds();
+ //
+ result = new Image(Display.getCurrent(), bib.width, bib.height);
+ //
+ GC gc = new GC(result);
+ gc.drawImage(baseImage, 0, 0);
+ if (corner == TOP_LEFT) {
+ gc.drawImage(decorator, 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ gc.drawImage(decorator, 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
+ }
+ gc.dispose();
+ //
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached {@link Image}'s.
+ */
+ public static void disposeImages() {
+ // dispose loaded images
+ {
+ for (Image image : m_imageMap.values()) {
+ image.dispose();
+ }
+ m_imageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Font
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps font names to fonts.
+ */
+ private static Map<String, Font> m_fontMap = new HashMap<String, Font>();
+ /**
+ * Maps fonts to their bold versions.
+ */
+ private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>();
+ /**
+ * Returns a {@link Font} based on its name, height and style.
+ *
+ * @param name
+ * the name of the font
+ * @param height
+ * the height of the font
+ * @param style
+ * the style of the font
+ * @return {@link Font} The font matching the name, height and style
+ */
+ public static Font getFont(String name, int height, int style) {
+ return getFont(name, height, style, false, false);
+ }
+ /**
+ * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
+ * flags are also supported.
+ *
+ * @param name
+ * the name of the font
+ * @param size
+ * the size of the font
+ * @param style
+ * the style of the font
+ * @param strikeout
+ * the strikeout flag (warning: Windows only)
+ * @param underline
+ * the underline flag (warning: Windows only)
+ * @return {@link Font} The font matching the name, height, style, strikeout and underline
+ */
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
+ Font font = m_fontMap.get(fontName);
+ if (font == null) {
+ FontData fontData = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
+ Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
+ if (logFont != null && logFontClass != null) {
+ if (strikeout) {
+ logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ if (underline) {
+ logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ }
+ } catch (Throwable e) {
+ System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ font = new Font(Display.getCurrent(), fontData);
+ m_fontMap.put(fontName, font);
+ }
+ return font;
+ }
+ /**
+ * Returns a bold version of the given {@link Font}.
+ *
+ * @param baseFont
+ * the {@link Font} for which a bold version is desired
+ * @return the bold version of the given {@link Font}
+ */
+ public static Font getBoldFont(Font baseFont) {
+ Font font = m_fontToBoldFontMap.get(baseFont);
+ if (font == null) {
+ FontData fontDatas[] = baseFont.getFontData();
+ FontData data = fontDatas[0];
+ font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
+ m_fontToBoldFontMap.put(baseFont, font);
+ }
+ return font;
+ }
+ /**
+ * Dispose all of the cached {@link Font}'s.
+ */
+ public static void disposeFonts() {
+ // clear fonts
+ for (Font font : m_fontMap.values()) {
+ font.dispose();
+ }
+ m_fontMap.clear();
+ // clear bold fonts
+ for (Font font : m_fontToBoldFontMap.values()) {
+ font.dispose();
+ }
+ m_fontToBoldFontMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Cursor
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps IDs to cursors.
+ */
+ private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>();
+ /**
+ * Returns the system cursor matching the specific ID.
+ *
+ * @param id
+ * int The ID value for the cursor
+ * @return Cursor The system cursor matching the specific ID
+ */
+ public static Cursor getCursor(int id) {
+ Integer key = Integer.valueOf(id);
+ Cursor cursor = m_idToCursorMap.get(key);
+ if (cursor == null) {
+ cursor = new Cursor(Display.getDefault(), id);
+ m_idToCursorMap.put(key, cursor);
+ }
+ return cursor;
+ }
+ /**
+ * Dispose all of the cached cursors.
+ */
+ public static void disposeCursors() {
+ for (Cursor cursor : m_idToCursorMap.values()) {
+ cursor.dispose();
+ }
+ m_idToCursorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeImages();
+ disposeFonts();
+ disposeCursors();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.transfer.workspace/src/org/eclipse/emf/cdo/transfer/spi/workspace/WorkspaceTransferSystem.java b/plugins/org.eclipse.emf.cdo.transfer.workspace/src/org/eclipse/emf/cdo/transfer/spi/workspace/WorkspaceTransferSystem.java
index 6ce0e21ed3..cf46bf86ec 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.workspace/src/org/eclipse/emf/cdo/transfer/spi/workspace/WorkspaceTransferSystem.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.workspace/src/org/eclipse/emf/cdo/transfer/spi/workspace/WorkspaceTransferSystem.java
@@ -27,6 +27,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import java.io.InputStream;
@@ -95,7 +96,7 @@ public class WorkspaceTransferSystem extends CDOTransferSystem
switch (type)
{
case org.eclipse.team.core.Team.BINARY:
- return CDOTransferType.FOLDER;
+ return CDOTransferType.BINARY;
case org.eclipse.team.core.Team.TEXT:
String encoding = getEncoding(file);
return CDOTransferType.text(encoding);
@@ -115,7 +116,7 @@ public class WorkspaceTransferSystem extends CDOTransferSystem
public CDOTransferElement getElement(IPath path)
{
IResource resource = ROOT.findMember(path);
- if (resource.exists())
+ if (resource != null && resource.exists())
{
return new Element(this, resource);
}
@@ -128,7 +129,8 @@ public class WorkspaceTransferSystem extends CDOTransferSystem
{
if (uri.isPlatformResource())
{
- return getElement(uri.path());
+ IPath path = new Path(uri.path()).removeFirstSegments(1).makeAbsolute();
+ return getElement(path);
}
return null;
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/ResourceFactoryRegistryWithoutDefaults.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/ResourceFactoryRegistryWithoutDefaults.java
new file mode 100644
index 0000000000..75dd22131b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/ResourceFactoryRegistryWithoutDefaults.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.spi.transfer;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.Resource.Factory;
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class ResourceFactoryRegistryWithoutDefaults extends ResourceFactoryRegistryImpl
+{
+ public ResourceFactoryRegistryWithoutDefaults()
+ {
+ getProtocolToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap());
+ getExtensionToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());
+ getContentTypeToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap());
+
+ getExtensionToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_EXTENSION);
+ getContentTypeToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER);
+ }
+
+ @Override
+ protected Factory delegatedGetFactory(URI uri, String contentTypeIdentifier)
+ {
+ return null;
+ }
+} \ No newline at end of file
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 867bb0171d..be1714d55b 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
@@ -10,6 +10,8 @@
*/
package org.eclipse.emf.cdo.transfer;
+import org.eclipse.emf.cdo.spi.transfer.ResourceFactoryRegistryWithoutDefaults;
+
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
@@ -21,9 +23,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Factory;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -54,7 +54,7 @@ public class CDOTransfer implements INotifier
private final Map<CDOTransferElement, CDOTransferMapping> mappings = new HashMap<CDOTransferElement, CDOTransferMapping>();
- private CDOTransferType defaultTransferType = CDOTransferType.UNKNOWN;
+ private CDOTransferType defaultTransferType = CDOTransferType.BINARY;
private ModelTransferContext modelTransferContext = createModelTransferContext();
@@ -182,7 +182,7 @@ public class CDOTransfer implements INotifier
protected ModelTransferContext createModelTransferContext()
{
- return new ModelTransferContext();
+ return new ModelTransferContext(this);
}
protected CDOTransferType getTransferType(CDOTransferElement source)
@@ -198,7 +198,7 @@ public class CDOTransfer implements INotifier
}
CDOTransferType type = sourceSystem.getDefaultTransferType(source);
- if (type == CDOTransferType.UNKNOWN)
+ if (type == null)
{
type = getDefaultTransferType();
}
@@ -484,8 +484,23 @@ public class CDOTransfer implements INotifier
/**
* @author Eike Stepper
*/
- public class ModelTransferContext
+ public static class UnmappedModelsEvent extends Event
+ {
+ private static final long serialVersionUID = 1L;
+
+ private UnmappedModelsEvent(CDOTransfer transfer)
+ {
+ super(transfer);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class ModelTransferContext
{
+ private final CDOTransfer transfer;
+
private ResourceSet sourceResourceSet;
private ResourceSet targetResourceSet;
@@ -496,14 +511,23 @@ public class CDOTransfer implements INotifier
private Set<Resource> unmappedModels;
- protected ModelTransferContext()
+ private Map<URI, ModelTransferResolution> resolutions = new HashMap<URI, ModelTransferResolution>();
+
+ protected ModelTransferContext(CDOTransfer transfer)
{
+ this.transfer = transfer;
+ }
+
+ public final CDOTransfer getTransfer()
+ {
+ return transfer;
}
public final ResourceSet getSourceResourceSet()
{
if (sourceResourceSet == null)
{
+ CDOTransferSystem sourceSystem = transfer.getSourceSystem();
sourceResourceSet = sourceSystem.provideResourceSet();
if (sourceResourceSet == null)
{
@@ -518,6 +542,7 @@ public class CDOTransfer implements INotifier
{
if (targetResourceSet == null)
{
+ CDOTransferSystem targetSystem = transfer.getTargetSystem();
targetResourceSet = targetSystem.provideResourceSet();
if (targetResourceSet == null)
{
@@ -585,11 +610,34 @@ public class CDOTransfer implements INotifier
unmappedModels.add(resource);
}
}
+
+ fireUnmappedModelsEvent();
}
return unmappedModels;
}
+ public ModelTransferResolution getResolution(URI uri)
+ {
+ return resolutions.get(uri);
+ }
+
+ public ModelTransferResolution setResolution(URI uri, ModelTransferResolution resolution)
+ {
+ ModelTransferResolution old = resolutions.put(uri, resolution);
+ if (resolution != old)
+ {
+ fireUnmappedModelsEvent();
+ }
+
+ return old;
+ }
+
+ protected void fireUnmappedModelsEvent()
+ {
+ transfer.notifier.fireEvent(new UnmappedModelsEvent(transfer));
+ }
+
protected void addModelMapping(CDOTransferMapping mapping)
{
CDOTransferElement element = mapping.getSource();
@@ -600,6 +648,7 @@ public class CDOTransfer implements INotifier
elementResources.put(element, resource);
resourceElements.put(resource, element);
unmappedModels = null;
+ fireUnmappedModelsEvent();
}
protected void removeModelMapping(CDOTransferMapping mapping)
@@ -616,6 +665,7 @@ public class CDOTransfer implements INotifier
}
unmappedModels = null;
+ fireUnmappedModelsEvent();
}
protected Resource getSourceResource(CDOTransferMapping mapping)
@@ -629,6 +679,7 @@ public class CDOTransfer implements INotifier
{
IPath path = mapping.getFullPath();
ResourceSet targetResourceSet = getTargetResourceSet();
+ CDOTransferSystem targetSystem = transfer.getTargetSystem();
return targetSystem.createModel(targetResourceSet, path);
}
@@ -679,22 +730,8 @@ public class CDOTransfer implements INotifier
/**
* @author Eike Stepper
*/
- protected static class ResourceFactoryRegistryWithoutDefaults extends ResourceFactoryRegistryImpl
+ public interface ModelTransferResolution
{
- public ResourceFactoryRegistryWithoutDefaults()
- {
- getProtocolToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap());
- getExtensionToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());
- getContentTypeToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap());
-
- getExtensionToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_EXTENSION);
- getContentTypeToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER);
- }
- @Override
- protected Factory delegatedGetFactory(URI uri, String contentTypeIdentifier)
- {
- return null;
- }
}
}
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 336f169d94..2bd6b5907d 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
@@ -221,11 +221,6 @@ class CDOTransferMappingImpl implements CDOTransferMapping
{
if (!ObjectUtil.equals(this.transferType, transferType))
{
- // if (transferType == CDOTransferType.MODEL && !transfer.getModelTransferContext().hasResourceFactory(source))
- // {
- // throw new IllegalStateException("No resource factory registered for " + this);
- // }
-
CDOTransferType oldType = this.transferType;
this.transferType = transferType;
transfer.transferTypeChanged(this, oldType, transferType);
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 747b19f08a..0972286a83 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
@@ -51,7 +51,7 @@ public abstract class CDOTransferSystem
return CDOTransferType.FOLDER;
}
- return CDOTransferType.UNKNOWN;
+ return null;
}
public abstract URI getURI(IPath path);
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java
index 40b7d5b08d..2c538bf2ee 100644
--- a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java
@@ -15,12 +15,9 @@ import org.eclipse.emf.cdo.internal.transfer.bundle.OM;
import org.eclipse.net4j.util.ObjectUtil;
import java.nio.charset.Charset;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
/**
* @author Eike Stepper
@@ -33,15 +30,6 @@ public class CDOTransferType implements Comparable<CDOTransferType>
*/
private static final Map<String, CDOTransferType> MAP = new HashMap<String, CDOTransferType>();
- public static final CDOTransferType UNKNOWN = new CDOTransferType()
- {
- @Override
- public String toString()
- {
- return "<Unknown>";
- }
- };
-
public static final CDOTransferType FOLDER = new CDOTransferType()
{
@Override
@@ -71,9 +59,6 @@ public class CDOTransferType implements Comparable<CDOTransferType>
public static final Text UTF8 = text("UTF-8");
- public static final Set<CDOTransferType> STANDARD_TYPES = new HashSet<CDOTransferType>(Arrays.asList(UNKNOWN, FOLDER,
- MODEL, BINARY, UTF8));
-
public static final Map<String, CDOTransferType> REGISTRY = Collections.unmodifiableMap(MAP);
private CDOTransferType()

Back to the top