Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-27 21:04:36 +0000
committerChristian W. Damus2014-03-27 21:04:36 +0000
commitfc4dd812a5fd0ed7ade3f30bb0a8569bb81ec031 (patch)
tree805a8e7dab3049b663b726114cf40fbe479fa3dd /plugins
parent1230915743ed9598a4c6e468d2f500840b36d724 (diff)
downloadorg.eclipse.papyrus-fc4dd812a5fd0ed7ade3f30bb0a8569bb81ec031.tar.gz
org.eclipse.papyrus-fc4dd812a5fd0ed7ade3f30bb0a8569bb81ec031.tar.xz
org.eclipse.papyrus-fc4dd812a5fd0ed7ade3f30bb0a8569bb81ec031.zip
431411: [Export Diagrams] Export all diagrams does nothing
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431411 Load all component resources of the logical Papyrus model to account for the new scheme in which the *.di resource is empty.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
index 32fe14d66de..d6758195975 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.export/src/org/eclipse/papyrus/infra/export/ExportAllDiagrams.java
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Anyware Technologies. 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
+ * Copyright (c) 2007, 2014 Anyware Technologies, CEA, 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: Jacques Lescot (Anyware Technologies) - initial API and
- * implementation
+ * Contributors: Jacques Lescot (Anyware Technologies) - initial API and implementation
* Thibault Landre (Atos Origin) - refactor to extract the exportAllDiagram from ExportAllDiagramsAction
* Alexia Allanic (Atos Origin) - Add margin to not truncate images
* Anass Radouani (AtoS) - add use GMF exporting tool and remove manual extraction
+ * Christian W. Damus (CEA) - bug 431411
*
******************************************************************************/
package org.eclipse.papyrus.infra.export;
@@ -24,6 +24,7 @@ import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -63,6 +64,8 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.export.internal.Activator;
+import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
@@ -164,8 +167,17 @@ public class ExportAllDiagrams {
final ResourceSetImpl resourceSet = new ResourceSetImpl();
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true);
- resourceSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
-
+
+ // Since the *.di file is empty as of Luna, we cannot rely on it to find all diagrams by resolving cross-references
+ IPapyrusFile logical = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(file);
+ if(logical != null) {
+ for(IResource component : logical.getAssociatedResources()) {
+ if(component.getType() == IResource.FILE) {
+ resourceSet.getResource(URI.createPlatformResourceURI(component.getFullPath().toString(), true), true);
+ }
+ }
+ }
+
// create transactional editing domain
TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resourceSet);

Back to the top