[CDO] Fix model import

The model import suffers from a number of problems, both performance
and stability. This patch addresses them.

Change-Id: I36c6ac9dd6c64d5770208ac06d29cdd39bc13772
Signed-off-by: Eike Stepper <stepper@esc-net.de>
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF b/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
index b87f3bb..3e044af 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/META-INF/MANIFEST.MF
@@ -68,3 +68,4 @@
 Bundle-Description: %pluginDescription
 Bundle-SymbolicName: org.eclipse.papyrus.cdo.core;singleton:=true
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Automatic-Module-Name: org.eclipse.papyrus.cdo.core
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
index 5df0d72..e4d417c 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
@@ -42,10 +42,6 @@
 
 	boolean hasSashModelContent();
 
-	boolean isStripSashModelContent();
-
-	void setStripSashModelContent(boolean stripSashModelContent);
-
 	Diagnostic validate();
 
 	void dispose();
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
index 6c277e4..3f1eb97 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
@@ -82,6 +82,7 @@
 	private final CDOProxyManager proxyManager = new CDOProxyManager(this);
 
 	private final PapyrusCDOResourceFactory resourceFactory = new PapyrusCDOResourceFactory(this);
+	
 	private CDOCheckout checkout;
 
 	private CDOView view;
@@ -105,22 +106,22 @@
 
 	@Override
 	public EObject getEObject(URI uri, boolean loadOnDemand) {
-		return CDOUtils.isCDOURI(uri) ? getCDOObject(uri, loadOnDemand) : super.getEObject(uri, loadOnDemand);
+		if (CDOUtils.isCDOURI(uri)) {
+			return getCDOObject(uri, loadOnDemand);
+		}
+		
+		return super.getEObject(uri, loadOnDemand);
 	}
 
 	protected EObject getCDOObject(URI uri, boolean loadOnDemand) {
-		EObject result = null;
-
 		if (CDOProxyManager.isCDOProxyURI(uri)) {
 			// get a real proxy object, out of thin air, to give CDO the non-null
 			// instance that it needs (otherwise the 'non-null constraint' of
 			// all kinds of reference lists will be violated)
-			result = proxyManager.getProxy(uri);
-		} else {
-			result = super.getEObject(uri, loadOnDemand);
-		}
-
-		return result;
+			return proxyManager.getProxy(uri);
+		} 
+		
+		return super.getEObject(uri, loadOnDemand);
 	}
 
 	@Override
@@ -167,12 +168,12 @@
 	}
 
 	@Override
-	protected Resource setResourceOptions(Resource r) {
-		if (r instanceof CDOResource) {
-			return r;
+	protected Resource setResourceOptions(Resource resource) {
+		if (resource instanceof CDOResource) {
+			return resource;
 		}
 
-		return super.setResourceOptions(r);
+		return super.setResourceOptions(resource);
 	}
 
 	protected void resourceLoadedHook(Resource resource) {
@@ -215,9 +216,6 @@
 		}
 	}
 
-	/**
-	 * @param resource
-	 */
 	protected void initTransaction(Resource resource) {
 		if (resource instanceof CDOResource) {
 			CDOResource cdoResource = (CDOResource) resource;
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
index bb95148..c322dc7 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
@@ -32,7 +32,6 @@
 import org.eclipse.papyrus.infra.core.resource.ModelSet;
 import org.eclipse.papyrus.infra.core.resource.ModelsReader;
 import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
@@ -95,7 +94,7 @@
 	}
 
 	private void analyze(Resource resource) {
-		if (resource.getContents().isEmpty() && isDIResource(resource)) {
+		if (isDIResource(resource)) {
 			// similarly-named resources that are recognized by Papyrus are implicitly components
 			for (Resource next : getImplicitComponents(resource)) {
 				if (isUserModelResource(next.getURI())) {
@@ -142,7 +141,7 @@
 	boolean isUserModelResource(URI uri) {
 		ModelSet modelSet = getModelSet();
 		boolean result = (modelSet != null) ? modelSet.isUserModelResource(uri) :
-				// config.hasResource(uri) &&
+		// config.hasResource(uri) &&
 				uri.isPlatformResource() || uri.isFile() || CDOUtils.isCDOURI(uri);
 
 		return result && !uri.isArchive();
@@ -175,13 +174,8 @@
 	public static boolean isDIResource(Resource resource) {
 		boolean result = false;
 
-		if (resource.getContents().isEmpty()) {
-			// DI resources are typically empty; just markers
-			result = DiModel.DI_FILE_EXTENSION.equals(resource.getURI().fileExtension());
-		} else {
-			// Look for legacy DI content (the Sash Model that now is in a *.sash resource in the workspace metadata area)
-			result = DiUtils.lookupSashWindowsMngr(resource) != null;
-		}
+		// DI resources are typically empty; just markers
+		result = DiModel.DI_FILE_EXTENSION.equals(resource.getURI().fileExtension());
 
 		return result;
 	}
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
index db89363..9b1749d 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
@@ -24,7 +24,6 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
 import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
 import org.eclipse.emf.cdo.transaction.CDOTransaction;
 import org.eclipse.emf.cdo.util.CommitException;
@@ -47,9 +46,7 @@
 import org.eclipse.papyrus.cdo.internal.core.CDOUtils;
 import org.eclipse.papyrus.cdo.internal.core.controlmode.CDOControlModeParticipant;
 import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
-import org.eclipse.papyrus.cdo.internal.core.resource.CDOSashModelProvider;
 import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
 import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
 import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
 import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
@@ -78,11 +75,11 @@
 	public Diagnostic importModels(final IModelImportMapping mapping) {
 		BasicDiagnostic result = new BasicDiagnostic();
 
-		add(result, mapping.getConfiguration().validate());
-		add(result, mapping.validate());
+		addDiagnostic(result, mapping.getConfiguration().validate());
+		addDiagnostic(result, mapping.validate());
 
 		if (result.getSeverity() < Diagnostic.ERROR) {
-			add(result, mapping.getConfiguration().getOperationContext().run(new IModelTransferOperation() {
+			addDiagnostic(result, mapping.getConfiguration().getOperationContext().run(new IModelTransferOperation() {
 
 				@Override
 				public Diagnostic run(IProgressMonitor monitor) {
@@ -95,8 +92,12 @@
 	}
 
 	protected Diagnostic doImport(IModelImportMapping mapping, IProgressMonitor monitor) {
+
 		BasicDiagnostic result = new BasicDiagnostic();
+
 		IModelTransferConfiguration configuration = mapping.getConfiguration();
+		ResourceSet source = configuration.getResourceSet();
+		ResourceSet destination = new ResourceSetImpl();
 
 		// by the time the configuration has analyzed every model to be
 		// imported, all proxies have been resolved that can be. So,
@@ -104,25 +105,27 @@
 
 		// 1/resource for import and 1/resource for sub-unit proxies
 		// 1 for each transaction commit, 1 for saving affected non-imported models, and 1 for clean-up
-		SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelImporter_4, configuration.getModelsToTransfer().size() + 4);
+		Collection<IModelTransferNode> modelsToTransfer = configuration.getModelsToTransfer();
+		SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelImporter_4, modelsToTransfer.size() + 4);
 
 		CDOCheckout checkout = mapping.getCheckout();
-		CDOTransaction transaction = checkout.openTransaction(new ResourceSetImpl());
-		ResourceSet destination = transaction.getResourceSet();
+		CDOTransaction transaction = checkout.openTransaction(destination);
 
 		try {
-			for (IModelTransferNode model : configuration.getModelsToTransfer()) {
-				add(result, importModel(model, configuration.getResourceSet(), mapping.getMapping(model), transaction, sub.newChild(1)));
+			for (IModelTransferNode model : modelsToTransfer) {
+				IPath modelMapping = mapping.getMapping(model);
+				Diagnostic modelDiagnostic = importModel(model, source, modelMapping, transaction, sub.newChild(1));
+				addDiagnostic(result, modelDiagnostic);
 			}
 
 			try {
 				transaction.commit(sub.newChild(1));
 
 				// save sash resources (if any)
-				for (Resource next : destination.getResources()) {
+				for (Resource resource : destination.getResources()) {
 					// sash resource would have been saved by commit if it were a CDO URI
-					if (DependencyAdapter.isDIResource(next) && !CDOUtils.isCDOURI(next.getURI())) {
-						next.save(null);
+					if (DependencyAdapter.isDIResource(resource) && !CDOUtils.isCDOURI(resource.getURI())) {
+						resource.save(null);
 					}
 				}
 			} catch (Exception e) {
@@ -153,7 +156,7 @@
 				result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_6, new Object[] { e }));
 			}
 		} finally {
-			EMFHelper.unload(configuration.getResourceSet());
+			EMFHelper.unload(source);
 			CDOUtils.unload(transaction);
 			transaction.close();
 			EMFHelper.unload(destination);
@@ -176,19 +179,7 @@
 			Resource destination = transaction.getOrCreateResource(basePath.addFileExtension(next.fileExtension()).toString());
 			Resource source = rset.getResource(next, true);
 
-			if (model.getConfiguration().isStripSashModelContent() && DependencyAdapter.isDIResource(source)) {
-				// import *.di content into the *.sash
-				CDOCheckout checkout = CDOExplorerUtil.getCheckout(transaction);
-				URI sashURI = new CDOSashModelProvider().initialize(checkout).getSashModelURI(destination.getURI());
-				ResourceSet dset = destination.getResourceSet();
-				Resource sashResource = dset.getURIConverter().exists(sashURI, null) ? dset.getResource(sashURI, true) : null;
-				if (sashResource == null) {
-					sashResource = dset.createResource(sashURI);
-				}
-				destination = sashResource;
-			}
-
-			add(result, importResource(source, destination));
+			addDiagnostic(result, importResource(source, destination));
 			sub.worked(1);
 		}
 
@@ -285,8 +276,8 @@
 				}
 			}
 
-			PageList dstPages = dstMngr.getPageList();
-			PageList srcPages = srcMngr.getPageList();
+			org.eclipse.papyrus.infra.core.sashwindows.di.PageList dstPages = dstMngr.getPageList();
+			org.eclipse.papyrus.infra.core.sashwindows.di.PageList srcPages = srcMngr.getPageList();
 
 			if (dstPages == null) {
 				dstMngr.setPageList(srcPages);
@@ -331,7 +322,7 @@
 							try {
 								resource.save(null);
 							} catch (Exception e) {
-								add(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_10, new Object[] { e }));
+								addDiagnostic(result, new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_10, new Object[] { e }));
 							}
 						}
 					}
@@ -346,7 +337,7 @@
 		return result;
 	}
 
-	private static void add(DiagnosticChain diagnostics, Diagnostic diagnostic) {
+	private static void addDiagnostic(DiagnosticChain diagnostics, Diagnostic diagnostic) {
 		if (diagnostic.getSeverity() > Diagnostic.OK) {
 			diagnostics.merge(diagnostic);
 		}
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
index 7def03e..866ba35 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
@@ -59,8 +59,6 @@
 
 	private ResourceSet resourceSet;
 
-	private boolean stripSashModelContent;
-
 	private final boolean ownResourceSet;
 
 	private final IModelTransferOperation.Context operationContext;
@@ -352,15 +350,6 @@
 		return result;
 	}
 
-	@Override
-	public boolean isStripSashModelContent() {
-		return stripSashModelContent;
-	}
-
-	@Override
-	public void setStripSashModelContent(boolean stripSashModelContent) {
-		this.stripSashModelContent = stripSashModelContent;
-	}
 
 	//
 	// Nested types
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java
index 66781a5..7378fec 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorManager.java
@@ -28,7 +28,6 @@
 import org.eclipse.emf.cdo.CDOObject;
 import org.eclipse.emf.cdo.eresource.CDOResource;
 import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
-import org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorOpener;
 import org.eclipse.emf.cdo.internal.ui.InteractiveConflictHandlerSelector;
 import org.eclipse.emf.cdo.transaction.CDOTransaction;
 import org.eclipse.emf.cdo.ui.CDOInvalidRootAgent;
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionBlock.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionBlock.java
index 6dcab13..16787fa 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionBlock.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionBlock.java
@@ -14,6 +14,7 @@
 package org.eclipse.papyrus.cdo.internal.ui.wizards;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.function.Predicate;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -22,22 +23,18 @@
 import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
 import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
 import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckoutManager;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutContentProvider;
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.operation.IRunnableContext;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
 import org.eclipse.papyrus.cdo.ui.Activator;
-import org.eclipse.papyrus.cdo.ui.SharedImages;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.statushandlers.StatusManager;
@@ -54,29 +51,37 @@
 
 	private final Supplier<? extends IRunnableContext> runnableContext;
 
-	private TableViewer repoList;
+	private TreeViewer checkoutList;
 
 	private CDOCheckout selectedCheckout;
 
+
 	public CheckoutSelectionBlock(EventBus bus, Supplier<? extends IRunnableContext> runnableContext) {
 		this.bus = bus;
 		this.runnableContext = runnableContext;
 	}
 
+	@SuppressWarnings("restriction")
 	public Control createControl(Composite parent) {
-		CDOCheckoutManager mgr = CDOExplorerUtil.getCheckoutManager();
-		repoList = new TableViewer(parent);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(repoList.getControl());
-		repoList.setContentProvider(new RepositoryContentProvider());
-		repoList.setLabelProvider(new RepositoryLabelProvider());
-		repoList.setInput(mgr);
+		checkoutList = CDOCheckoutContentProvider.createTreeViewer(parent, new Predicate<Object>() {
+			@Override
+			public boolean test(Object child) {
+				if (child instanceof CDOCheckout) {
+					CDOCheckout checkout = (CDOCheckout) child;
+					return !checkout.isReadOnly();
+				}
+				return false;
+			}
+		});
+
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(checkoutList.getControl());
 
 		if (selectedCheckout != null) {
-			repoList.setSelection(new StructuredSelection(selectedCheckout));
+			checkoutList.setSelection(new StructuredSelection(selectedCheckout));
 			selected(selectedCheckout);
 		}
 
-		repoList.addSelectionChangedListener(new ISelectionChangedListener() {
+		checkoutList.addSelectionChangedListener(new ISelectionChangedListener() {
 
 			@Override
 			public void selectionChanged(SelectionChangedEvent event) {
@@ -85,7 +90,7 @@
 				if (sel.isEmpty()) {
 					if (selectedCheckout != null) {
 						// veto empty selection
-						repoList.setSelection(new StructuredSelection(selectedCheckout));
+						checkoutList.setSelection(new StructuredSelection(selectedCheckout));
 					}
 				} else {
 					selected((CDOCheckout) sel.getFirstElement());
@@ -94,16 +99,16 @@
 		});
 
 		// initially select the first connected repo
-		for (CDOCheckout next : mgr.getCheckouts()) {
+		for (CDOCheckout next : CDOExplorerUtil.getCheckoutManager().getCheckouts()) {
 
 			if (next.isOpen()) {
 				selected(next);
-				repoList.setSelection(new StructuredSelection(next));
+				checkoutList.setSelection(new StructuredSelection(next));
 				break;
 			}
 		}
 
-		return repoList.getControl();
+		return checkoutList.getControl();
 	}
 
 	public void dispose() {
@@ -111,13 +116,13 @@
 	}
 
 	public void setEnabled(boolean enabled) {
-		if (repoList != null) {
-			repoList.getControl().setEnabled(enabled);
+		if (checkoutList != null) {
+			checkoutList.getControl().setEnabled(enabled);
 		}
 	}
 
 	public boolean isEnabled() {
-		return (repoList != null) && repoList.getControl().isEnabled();
+		return (checkoutList != null) && checkoutList.getControl().isEnabled();
 	}
 
 	void selected(final CDOCheckout checkout) {
@@ -145,13 +150,14 @@
 								}
 							}
 
-							repoList.getControl().getDisplay().asyncExec(new Runnable() {
+							checkoutList.getControl().getDisplay().asyncExec(new Runnable() {
 
 								@Override
 								public void run() {
-									if (!repoList.getControl().isDisposed()) {
-										repoList.update(checkout, null);
+									if (!checkoutList.getControl().isDisposed()) {
+										checkoutList.update(checkout, null);
 										bus.post(checkout);
+										selectionChanged();
 									}
 								}
 							});
@@ -166,13 +172,17 @@
 		}
 
 		bus.post(checkout);
+		selectionChanged();
+	}
+
+	protected void selectionChanged() {
 	}
 
 	public void setSelectedCheckout(CDOCheckout checkout) {
 		this.selectedCheckout = checkout;
 
-		if (repoList != null) {
-			repoList.setSelection(new StructuredSelection(selectedCheckout));
+		if (checkoutList != null) {
+			checkoutList.setSelection(new StructuredSelection(selectedCheckout));
 			selected(selectedCheckout);
 		}
 	}
@@ -180,40 +190,4 @@
 	public CDOCheckout getSelectedCheckout() {
 		return selectedCheckout;
 	}
-
-	//
-	// Nested types
-	//
-
-	private static class RepositoryContentProvider implements IStructuredContentProvider {
-
-		@Override
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-			viewer.refresh();
-		}
-
-		@Override
-		public Object[] getElements(Object inputElement) {
-			return CDOExplorerUtil.getCheckoutManager().getCheckouts();
-		}
-
-		@Override
-		public void dispose() {
-			// pass
-		}
-	}
-
-	private static class RepositoryLabelProvider extends LabelProvider {
-
-		@Override
-		public Image getImage(Object element) {
-			boolean open = ((CDOCheckout) element).isOpen();
-			return SharedImages.getImage(open ? Activator.ICON_OPEN_REPOSITORY : Activator.ICON_CLOSED_REPOSITORY);
-		}
-
-		@Override
-		public String getText(Object element) {
-			return ((CDOCheckout) element).getLabel();
-		}
-	}
 }
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionPage.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionPage.java
index 6464f57..af5ff32 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionPage.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/CheckoutSelectionPage.java
@@ -15,12 +15,10 @@
 
 import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
 import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 
 import com.google.common.base.Suppliers;
@@ -52,7 +50,14 @@
 
 		new Label(result, SWT.NONE).setText(Messages.CheckoutSelectionPage_3);
 
-		checkoutSelectionBlock = new CheckoutSelectionBlock(getEventBus(), Suppliers.ofInstance(getContainer()));
+		checkoutSelectionBlock = new CheckoutSelectionBlock(getEventBus(), Suppliers.ofInstance(getContainer())) {
+			@Override
+			protected void selectionChanged() {
+				super.selectionChanged();
+				validatePage();
+			}
+		};
+
 		checkoutSelectionBlock.createControl(result);
 
 		if (checkout != null) {
@@ -84,14 +89,14 @@
 	protected Diagnostic doValidatePage() {
 		Diagnostic result = Diagnostic.CANCEL_INSTANCE;
 
-		if (getSelectedRepository() != null) {
+		if (getSelectedCheckout() != null) {
 			result = Diagnostic.OK_INSTANCE;
 		}
 
 		return result;
 	}
 
-	public CDOCheckout getSelectedRepository() {
+	public CDOCheckout getSelectedCheckout() {
 		return checkout;
 	}
 }
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
index 4d6ddb0..b939c38 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
@@ -142,7 +142,7 @@
 		Diagnostic problems = importer.importModels(mappingsPage.getSelectedMapping());
 
 		if (problems.getSeverity() > Diagnostic.INFO) {
-			StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.BLOCK);
+			StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.LOG | StatusManager.BLOCK);
 		}
 
 		return result;
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
index 3e842db..c459464 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
@@ -45,11 +45,8 @@
 import org.eclipse.papyrus.cdo.internal.ui.providers.ModelImportNodeLabelProvider;
 import org.eclipse.papyrus.cdo.ui.Activator;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
@@ -81,7 +78,6 @@
 
 	private Text pathText;
 
-	private Button stripSashModelContent;
 
 	public ModelReferencesPage(EventBus bus, boolean isImport) {
 		super("references", Messages.ModelReferencesPage_3, null, bus, isImport ? IMPORT_MESSAGE : EXPORT_MESSAGE); //$NON-NLS-1$
@@ -109,21 +105,6 @@
 		pathText = new Text(result, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
 		pathText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, convertHeightInCharsToPixels(3)).create());
 
-		if (isImport) {
-			stripSashModelContent = new Button(result, SWT.CHECK);
-			stripSashModelContent.setText(Messages.ModelReferencesPage_2);
-			stripSashModelContent.setToolTipText(Messages.ModelReferencesPage_6);
-
-			stripSashModelContent.addSelectionListener(new SelectionAdapter() {
-
-				@Override
-				public void widgetSelected(SelectionEvent e) {
-					if (getConfiguration() != null) {
-						getConfiguration().setStripSashModelContent(stripSashModelContent.getSelection());
-					}
-				}
-			});
-		}
 
 		modelsTree.addSelectionChangedListener(new ISelectionChangedListener() {
 
@@ -177,19 +158,7 @@
 		if (configuration != null) {
 			// initialize the checkboxes
 			initializeCheckedNodes();
-
-			// determine enablement of strip-sash-model option
-			if (stripSashModelContent != null) {
-				stripSashModelContent.setSelection(true);
-				stripSashModelContent.setEnabled(configuration.hasSashModelContent());
-
-				this.importConfig.setStripSashModelContent(true);
-			}
-		} else if (stripSashModelContent != null) {
-			stripSashModelContent.setSelection(true);
-			stripSashModelContent.setEnabled(false);
 		}
-
 		validatePage();
 	}