Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-06 20:34:15 +0000
committerChristian W. Damus2014-03-06 20:35:34 +0000
commita10d9125b1b754f2849bded045b84bec5ac63dab (patch)
tree25b32be3cb13c5dfa71aa6d6cb47870590efa69a /extraplugins
parent1171b834e781066ac98fba93c347425bd659ae90 (diff)
downloadorg.eclipse.papyrus-a10d9125b1b754f2849bded045b84bec5ac63dab.tar.gz
org.eclipse.papyrus-a10d9125b1b754f2849bded045b84bec5ac63dab.tar.xz
org.eclipse.papyrus-a10d9125b1b754f2849bded045b84bec5ac63dab.zip
429242: [CDO] [Resource Management] Refactoring of the 3-files model and PageManager
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429242 Add model import option to strip the sash model from the *.di resource, putting it instead into the *.sash resource in the workspace metadata area.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java12
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java6
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java9
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java37
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java46
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java18
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java7
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java11
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties6
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java8
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java8
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java51
12 files changed, 193 insertions, 26 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
index dce8356bdb3..2d67e844f06 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.importer;
@@ -36,6 +38,12 @@ public interface IModelTransferConfiguration {
IModelTransferOperation.Context getOperationContext();
+ boolean hasSashModelContent();
+
+ boolean isStripSashModelContent();
+
+ void setStripSashModelContent(boolean stripSashModelContent);
+
Diagnostic validate();
void dispose();
@@ -52,7 +60,7 @@ public interface IModelTransferConfiguration {
/**
* Creates a new model transfer configuration. If a {@code ResourceSet} is provided,
- * then the configuration will it to load resources for dependency analysis. It will
+ * then the configuration will use it to load resources for dependency analysis. It will
* then be the caller's responsibility to clean up that resource set, if necessary,
* after completion of the transfer process.
*
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java
index 5a497f3b4df..1fa1f6ebd34 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/importer/IModelTransferNode.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.importer;
@@ -22,6 +24,8 @@ public interface IModelTransferNode {
String getName();
+ IModelTransferConfiguration getConfiguration();
+
URI getPrimaryResourceURI();
Collection<URI> getResourceURIs();
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
index 6d4cf6e4cff..5bc824712dd 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/DependencyAdapter.java
@@ -30,7 +30,7 @@ import org.eclipse.papyrus.cdo.internal.core.CDOUtils;
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.SashWindowsMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
@@ -178,12 +178,7 @@ public class DependencyAdapter extends AdapterImpl {
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)
- for(EObject next : resource.getContents()) {
- if(next instanceof SashWindowsMngr) {
- result = true;
- break;
- }
- }
+ result = DiUtils.lookupSashWindowsMngr(resource) != null;
}
return result;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
index 209403de4e8..22102b48878 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelImporter.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.core.importer;
@@ -36,13 +38,16 @@ import org.eclipse.papyrus.cdo.core.importer.IModelTransferConfiguration;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferNode;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferOperation;
import org.eclipse.papyrus.cdo.internal.core.Activator;
+import org.eclipse.papyrus.cdo.internal.core.CDOUtils;
import org.eclipse.papyrus.cdo.internal.core.IInternalPapyrusRepository;
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;
import com.google.common.collect.Sets;
@@ -63,6 +68,7 @@ public class ModelImporter implements IModelImporter {
super();
}
+ @Override
public Diagnostic importModels(final IModelImportMapping mapping) {
BasicDiagnostic result = new BasicDiagnostic();
@@ -72,6 +78,7 @@ public class ModelImporter implements IModelImporter {
if(result.getSeverity() < Diagnostic.ERROR) {
add(result, mapping.getConfiguration().getOperationContext().run(new IModelTransferOperation() {
+ @Override
public Diagnostic run(IProgressMonitor monitor) {
return doImport(mapping, monitor);
}
@@ -104,7 +111,15 @@ public class ModelImporter implements IModelImporter {
try {
transaction.commit(sub.newChild(1));
- } catch (CommitException e) {
+
+ // save sash resources (if any)
+ for(Resource next : 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);
+ }
+ }
+ } catch (Exception e) {
result.add(new BasicDiagnostic(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.ModelImporter_5, new Object[]{ e }));
}
@@ -152,8 +167,20 @@ public class ModelImporter implements IModelImporter {
for(URI next : model.getResourceURIs()) {
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
+ URI sashURI = new CDOSashModelProvider().initialize(transaction).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(rset.getResource(next, true), destination));
+ add(result, importResource(source, destination));
sub.worked(1);
}
@@ -230,9 +257,9 @@ public class ModelImporter implements IModelImporter {
protected void mergeDIContent(Resource source, Resource destination) {
// snip out the source window manager and get its counterpart
- SashWindowsMngr srcMngr = (SashWindowsMngr)EcoreUtil.getObjectByType(source.getContents(), DiPackage.Literals.SASH_WINDOWS_MNGR);
+ SashWindowsMngr srcMngr = DiUtils.lookupSashWindowsMngr(source);
EcoreUtil.remove(srcMngr);
- SashWindowsMngr dstMngr = (SashWindowsMngr)EcoreUtil.getObjectByType(destination.getContents(), DiPackage.Literals.SASH_WINDOWS_MNGR);
+ SashWindowsMngr dstMngr = DiUtils.lookupSashWindowsMngr(destination);
// merge the window manager contents
if(dstMngr == null) {
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
index 9ed764fa647..ea38d46ab41 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.core.importer;
@@ -35,6 +37,7 @@ import org.eclipse.papyrus.cdo.core.importer.IModelTransferOperation;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferOperation.Context;
import org.eclipse.papyrus.cdo.internal.core.Activator;
import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
@@ -52,6 +55,8 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
private ResourceSet resourceSet;
+ private boolean stripSashModelContent;
+
private final boolean ownResourceSet;
private final IModelTransferOperation.Context operationContext;
@@ -88,6 +93,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
return direction;
}
+ @Override
public void dispose() {
if(resourceSet != null) {
if(ownResourceSet) {
@@ -114,18 +120,22 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
listeners.clear();
}
+ @Override
public ResourceSet getResourceSet() {
return resourceSet;
}
+ @Override
public Context getOperationContext() {
return operationContext;
}
+ @Override
public Collection<IModelTransferNode> getModelsToTransfer() {
return Collections.unmodifiableSet(modelsToImport);
}
+ @Override
public IModelTransferNode addModelToTransfer(URI resourceURI) {
IModelTransferNode result = getNode(resourceURI);
@@ -150,6 +160,7 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
Diagnostic problems = getOperationContext().run(new IModelTransferOperation() {
+ @Override
public Diagnostic run(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelTransferConfiguration_0, dependentsProviders.size());
@@ -197,18 +208,21 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
return result;
}
+ @Override
public void removeModelToTransfer(IModelTransferNode node) {
if(modelsToImport.remove(node)) {
fireModelsToImportChanged();
}
}
+ @Override
public void addModelDependentsProvider(IModelDependentsProvider provider) {
if(!dependentsProviders.contains(provider)) {
dependentsProviders.add(provider);
}
}
+ @Override
public Diagnostic validate() {
BasicDiagnostic result = new BasicDiagnostic();
@@ -276,10 +290,12 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
return result.build();
}
+ @Override
public void addModelTransferListener(IModelTransferListener listener) {
listeners.addIfAbsent(listener);
}
+ @Override
public void removeModelTransferListener(IModelTransferListener listener) {
listeners.remove(listener);
}
@@ -320,6 +336,34 @@ public class ModelTransferConfiguration implements IModelTransferConfiguration {
return resources.containsKey(uri);
}
+ @Override
+ public boolean hasSashModelContent() {
+ boolean result = false;
+
+ ResourceSet rset = getResourceSet();
+ if(rset != null) {
+ for(IModelTransferNode next : importNodes.values()) {
+ Resource primary = rset.getResource(next.getPrimaryResourceURI(), false);
+ if((primary != null) && (DiUtils.lookupSashWindowsMngr(primary) != null)) {
+ result = true;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean isStripSashModelContent() {
+ return stripSashModelContent;
+ }
+
+ @Override
+ public void setStripSashModelContent(boolean stripSashModelContent) {
+ this.stripSashModelContent = stripSashModelContent;
+ }
+
//
// Nested types
//
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java
index cb6e5692a36..5631834914e 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/importer/ModelTransferNode.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.core.importer;
@@ -23,6 +25,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.cdo.core.importer.IModelTransferConfiguration;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferNode;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferOperation;
import org.eclipse.papyrus.cdo.internal.core.l10n.Messages;
@@ -59,6 +62,7 @@ public class ModelTransferNode implements IModelTransferNode {
context.run(new IModelTransferOperation() {
+ @Override
public Diagnostic run(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, Messages.ModelTransferNode_0, 2);
@@ -76,6 +80,7 @@ public class ModelTransferNode implements IModelTransferNode {
});
}
+ @Override
public String getName() {
if(name == null) {
URI uri = getPrimaryResourceURI();
@@ -92,14 +97,21 @@ public class ModelTransferNode implements IModelTransferNode {
return name;
}
+ @Override
+ public IModelTransferConfiguration getConfiguration() {
+ return config;
+ }
+
Resource getPrimaryResource() {
return resource;
}
+ @Override
public URI getPrimaryResourceURI() {
return resource.getURI();
}
+ @Override
public Collection<URI> getResourceURIs() {
ImmutableSet.Builder<URI> result = ImmutableSet.builder();
@@ -110,10 +122,12 @@ public class ModelTransferNode implements IModelTransferNode {
return result.build();
}
+ @Override
public Collection<IModelTransferNode> getDependencies() {
return Collections.unmodifiableSet(dependencies);
}
+ @Override
public Collection<IModelTransferNode> getDependents() {
return Collections.unmodifiableSet(dependents);
}
@@ -177,6 +191,7 @@ public class ModelTransferNode implements IModelTransferNode {
return result;
}
+ @Override
public boolean isModelParentUnit(IModelTransferNode other) {
boolean result = false;
@@ -200,6 +215,7 @@ public class ModelTransferNode implements IModelTransferNode {
return result;
}
+ @Override
public boolean isModelSubUnit(IModelTransferNode other) {
boolean result = false;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java
index 6b3c35486f0..2db7a6eb997 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/resource/CDOSashModelProvider.java
@@ -41,10 +41,15 @@ public class CDOSashModelProvider extends AbstractSashModelProvider {
CDOView view = CDOUtils.getView(modelSet);
if(view != null) { // Model probably is in the workspace if null
- indexFolder = SASH_MODEL_STORAGE_ROOT.append(view.getSession().getRepositoryInfo().getUUID());
+ initialize(view);
}
}
+ public CDOSashModelProvider initialize(CDOView view) {
+ indexFolder = SASH_MODEL_STORAGE_ROOT.append(view.getSession().getRepositoryInfo().getUUID());
+ return this;
+ }
+
@Override
public URI getSashModelURI(URI userModelURI) {
final URI uriWithoutExtension = userModelURI.trimFileExtension();
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
index a1a0ed51721..dc9f509abea 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/Messages.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,13 +8,15 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.l10n;
import org.eclipse.osgi.util.NLS;
/**
- * This is the Messages type. Enjoy.
+ * This is the Messages type. Enjoy.
*/
public class Messages extends NLS {
@@ -176,12 +178,16 @@ public class Messages extends NLS {
public static String ModelReferencesPage_1;
+ public static String ModelReferencesPage_2;
+
public static String ModelReferencesPage_3;
public static String ModelReferencesPage_4;
public static String ModelReferencesPage_5;
+ public static String ModelReferencesPage_6;
+
public static String ModelReferencesPage_7;
public static String ModelReferencesPage_8;
@@ -293,6 +299,7 @@ public class Messages extends NLS {
public static String RepositorySelectionPage_3;
public static String RepositorySelectionPage_4;
+
public static String ResolveConflictsHandler_0;
public static String ResolveConflictsHandler_1;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
index 81b2d8a6525..49edf2b64ac 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/l10n/messages.properties
@@ -1,5 +1,5 @@
#############################################################################
-# Copyright (c) 2013 CEA LIST.
+# Copyright (c) 2013, 2014 CEA LIST and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
#
# Contributors:
# CEA LIST - Initial API and implementation
+# Christian W. Damus (CEA) - bug 429242
+#
#############################################################################
AddRepositoryAction_0=Add Repository...
AddRepositoryDialog_0=Add Repository
@@ -87,9 +89,11 @@ ModelMappingsPage_8=Please enter a valid path.
ModelMappingsPage_9=Please enter a path.
ModelReferencesPage_0=Select referenced models to import into the repository.
ModelReferencesPage_1=Select referenced models to export to the workspace.
+ModelReferencesPage_2=Strip editor pages from model (recommended)
ModelReferencesPage_3=Model Cross-References
ModelReferencesPage_4=Models:
ModelReferencesPage_5=Path:
+ModelReferencesPage_6=Move information about open diagrams from the *.di resource to user-private storage
ModelReferencesPage_7=Please select at least one model to {0}.
ModelReferencesPage_8=import
ModelReferencesPage_9=export
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java
index 65157c95ac2..f3c6b42cfbe 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelExportWizard.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.wizards;
@@ -64,6 +66,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard {
super();
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = localView.translate(selection);
@@ -96,6 +99,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard {
// has been presented
Display.getCurrent().asyncExec(new Runnable() {
+ @Override
public void run() {
for(DIModel next : getSelection()) {
exportConfig.addModelToTransfer(next.getResource().getURI());
@@ -143,7 +147,7 @@ public class ModelExportWizard extends Wizard implements IWorkbenchWizard {
Diagnostic problems = exporter.exportModels(mappingsPage.getMapping());
if(problems.getSeverity() > Diagnostic.INFO) {
- StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.SHOW);
+ StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.BLOCK);
}
return result;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
index 5d262d03889..a74f4dadd0e 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelImportWizard.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.wizards;
@@ -57,6 +59,7 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard {
super();
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
@@ -91,6 +94,7 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard {
// has been presented
Display.getCurrent().asyncExec(new Runnable() {
+ @Override
public void run() {
for(IPapyrusFile next : getSelection()) {
importConfig.addModelToTransfer(URI.createPlatformResourceURI(next.getMainFile().getFullPath().toString(), true));
@@ -135,7 +139,7 @@ public class ModelImportWizard extends Wizard implements IWorkbenchWizard {
Diagnostic problems = importer.importModels(mappingsPage.getSelectedMapping());
if(problems.getSeverity() > Diagnostic.INFO) {
- StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.SHOW);
+ StatusManager.getManager().handle(BasicDiagnostic.toIStatus(problems), StatusManager.BLOCK);
}
return result;
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
index 125b628957f..a95a7157e3d 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/wizards/ModelReferencesPage.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 429242
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.wizards;
@@ -40,8 +42,11 @@ import org.eclipse.papyrus.cdo.internal.ui.Activator;
import org.eclipse.papyrus.cdo.internal.ui.l10n.Messages;
import org.eclipse.papyrus.cdo.internal.ui.providers.ModelImportNodeLabelProvider;
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;
@@ -73,12 +78,15 @@ public class ModelReferencesPage extends ModelImportWizardPage {
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$
this.isImport = isImport;
}
+ @Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
@@ -98,8 +106,25 @@ public class ModelReferencesPage extends ModelImportWizardPage {
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() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection)event.getSelection();
if(!sel.isEmpty()) {
@@ -113,9 +138,11 @@ public class ModelReferencesPage extends ModelImportWizardPage {
((ICheckable)modelsTree).addCheckStateListener(contents);
((ICheckable)modelsTree).addCheckStateListener(new ICheckStateListener() {
+ @Override
public void checkStateChanged(CheckStateChangedEvent event) {
Display.getCurrent().asyncExec(new Runnable() {
+ @Override
public void run() {
validatePage();
}
@@ -147,6 +174,17 @@ public class ModelReferencesPage extends ModelImportWizardPage {
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();
@@ -252,6 +290,7 @@ public class ModelReferencesPage extends ModelImportWizardPage {
private Viewer viewer;
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
nodes.clear();
elements = null;
@@ -261,6 +300,7 @@ public class ModelReferencesPage extends ModelImportWizardPage {
this.viewer = viewer;
}
+ @Override
public Object[] getElements(Object inputElement) {
Object[] result = elements;
@@ -283,25 +323,30 @@ public class ModelReferencesPage extends ModelImportWizardPage {
return result;
}
+ @Override
public boolean hasChildren(Object element) {
IModelTransferNode importNode = ((TreeNode)element).getElement();
return !(importNode.getDependencies().isEmpty() && importNode.getDependents().isEmpty());
}
+ @Override
public Object getParent(Object element) {
return ((TreeNode)element).getParent();
}
+ @Override
public Object[] getChildren(Object parentElement) {
return ((TreeNode)parentElement).getChildren();
}
+ @Override
public void dispose() {
nodes.clear();
elements = null;
}
+ @Override
public void checkStateChanged(CheckStateChangedEvent event) {
ITreeNode node = (ITreeNode)event.getElement();
IModelTransferNode model = node.getElement();
@@ -345,14 +390,17 @@ public class ModelReferencesPage extends ModelImportWizardPage {
nodes.put(element, this);
}
+ @Override
public IModelTransferNode getElement() {
return element;
}
+ @Override
public boolean isDependent() {
return (getParent() != null) && dependent;
}
+ @Override
public boolean isDependency() {
return (getParent() != null) && !dependent;
}
@@ -396,6 +444,7 @@ public class ModelReferencesPage extends ModelImportWizardPage {
// initialize check state of new children from configuration
Display.getCurrent().asyncExec(new Runnable() {
+ @Override
public void run() {
if(config != null) {
Collection<IModelTransferNode> imported = config.getModelsToTransfer();

Back to the top