Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Eckertson2016-10-17 21:25:50 +0000
committerChristian W. Damus2016-10-18 20:49:46 +0000
commit6ed0cea998ac53ce143268ec8175c4a740cfc4aa (patch)
treeb414d5d78cad0619202552638223681dd806ac4f
parent996af3925cd6056b2da2a5def111dd225fab3852 (diff)
downloadorg.eclipse.papyrus-6ed0cea998ac53ce143268ec8175c4a740cfc4aa.tar.gz
org.eclipse.papyrus-6ed0cea998ac53ce143268ec8175c4a740cfc4aa.tar.xz
org.eclipse.papyrus-6ed0cea998ac53ce143268ec8175c4a740cfc4aa.zip
Bug 502705 - Export All Diagrams fails unless the model is in the project root directory
Duplicate correction in Neon from Oxygen Signed-off-by: Fred Eckertson <fred.eckertson@cerner.com> Change-Id: I71dd8e5a7679388d5f2081971092324e837d8382
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java22
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsDialog.java7
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java50
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java16
6 files changed, 39 insertions, 60 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF
index 81b81099c9a..c025ee7ce4d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/META-INF/MANIFEST.MF
@@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0
org.eclipse.papyrus.infra.services.semantic;bundle-version="[1.2.0,2.0.0)"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.1.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.export.Activator
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml
index a06e4b6f4f1..36c286b5455 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.gmfdiag.export</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java
index 727a6bb4b97..5d48fb4de2d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsAction.java
@@ -10,15 +10,15 @@
* Jacques Lescot (Anyware Technologies) - initial API and implementation
* Anass RADOUANI (AtoS) - add verification of the selection if it is a papyrus file or not
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754
+ * Fred Eckertson (Cerner) - fred.eckertson@cerner.com - Bug 502705
******************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.export.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.IResource;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
@@ -102,22 +102,14 @@ public class ExportAllDiagramsAction extends AbstractHandler {
}
- // Ask to user the others export configuration parameters
- URI uriFile = null;
+ // Ask user the other export configuration parameters
+ URI uriDirectory = null;
if (file != null) {
- IContainer parentResource = file.getParent();
- IContainer containerForParentLocation = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(parentResource.getLocation());
- if (containerForParentLocation != null) {
- parentResource = containerForParentLocation;
- uriFile = URI.createPlatformResourceURI(parentResource.getLocation().toString(), true);
- } else {
- // linked resource
- uriFile = URI.createPlatformResourceURI(parentResource.getFullPath().toString(), true);
- }
-
+ IResource parentResource = file.getParent().findMember(".");
+ uriDirectory = URI.createURI(parentResource.getLocationURI().toString());
}
- ExportAllDiagramsDialog exportPopup = new ExportAllDiagramsDialog(Activator.getActiveWorkbenchShell(), uriFile);
+ ExportAllDiagramsDialog exportPopup = new ExportAllDiagramsDialog(Activator.getActiveWorkbenchShell(), uriDirectory);
if (exportPopup.open() == Window.OK) {
// Complete export configuration
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsDialog.java
index f55053f1483..c3fd6346fa2 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportAllDiagramsDialog.java
@@ -8,6 +8,7 @@
* Jacques Lescot (Anyware Technologies) - initial API and implementation
* Anass Radouani (AtoS) - use of ExporterManager removed
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754
+ * Fred Eckertson (Cerner) - fred.eckertson@cerner.com - Bug 502705
******************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.export.actions;
@@ -31,7 +32,7 @@ public class ExportAllDiagramsDialog extends Dialog {
/** The dialog composite. */
private ExportComposite dialogComposite = null;
- /** The selected diagram file. */
+ /** The output directory. */
private URI outPutDirectory = null;
@@ -40,8 +41,8 @@ public class ExportAllDiagramsDialog extends Dialog {
*
* @param parentShell
* the parent shell
- * @param selectedFile
- * the selected file
+ * @param initialOutputDirectory
+ * the initial output directory
*/
public ExportAllDiagramsDialog(Shell parentShell, URI initialOuputDirectory) {
super(parentShell);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java
index 8a3e8168257..5b3dd5b0e21 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java
@@ -6,14 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Anass RADOUANI (AtoS)
+ * Anass RADOUANI (AtoS)
+ * Fred Eckertson (Cerner) - fred.eckertson@cerner.com - Bug 502705
*******************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.export.actions;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
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 org.eclipse.emf.common.util.URI;
@@ -54,7 +55,7 @@ public class ExportComposite extends Composite {
protected boolean qualifiedName;
- private URI uriDiagramFile;
+ private URI uriOutputDirectory;
/**
* Constructor
@@ -152,45 +153,32 @@ public class ExportComposite extends Composite {
}
/**
- * set the file from which diagrams will be exported
+ * set the directory to which diagrams will be exported (the method is misnamed)
*
- * @param file
+ * @param outputDirectory The output directory.
*/
- public void setSelectedDiagramFileURI(URI uriFile) {
- uriDiagramFile = uriFile;
+ public void setSelectedDiagramFileURI(URI uriDirectory) {
+ uriOutputDirectory = uriDirectory;
loadData();
}
private void loadData() {
- if (uriDiagramFile != null) {
- IPath location = new Path(uriDiagramFile.toPlatformString(true));
- outputDirectory = ResourcesPlugin.getWorkspace().getRoot().findMember(location.makeRelativeTo(ResourcesPlugin.getWorkspace().getRoot().getLocation()));
- if (outputDirectory == null) {
- try {
- IResource[] members = ResourcesPlugin.getWorkspace().getRoot().members();
- for (int idx = 0; idx < members.length; idx++) {
- if (location.equals(members[idx].getLocation())) {
- outputDirectory = members[idx];
- break;
- }
- }
- } catch (CoreException e) {
- Activator.log.error(e);
- }
- }
- if(outputDirectory ==null) {
- Activator.log.error("Impossible to find the output directory", null);
- return;
- }
- outputPathTxt.setText(location.toString());
- }
for (ImageFileFormat imageFileFormat : ImageFileFormat.VALUES) {
outputFormatCb.add(imageFileFormat.toString());
}
-
outputFormatCb.setText(ImageFileFormat.getDefaultImageFormat().toString());
-
exporter = outputFormatCb.getText();
+ if (uriOutputDirectory != null) {
+ IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(java.net.URI.create(uriOutputDirectory.toString()));
+ if (containers.length > 0) {
+ outputDirectory = containers[0];
+ }
+ }
+ if(outputDirectory == null) {
+ Activator.log.error("Impossible to find the output directory", null);
+ return;
+ }
+ outputPathTxt.setText(outputDirectory.getLocation().toString());
}
/**
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java
index 0bf0faa0795..146bef5830e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/wizard/ExportAllWizard.java
@@ -9,12 +9,14 @@
* Contributors:
* Anass RADOUANI (AtoS)
* Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754
+ * Fred Eckertson (Cerner) - fred.eckertson@cerner.com - Bug 502705
*******************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.export.wizard;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -113,24 +115,20 @@ public class ExportAllWizard extends Wizard implements IExportWizard {
}
- // Ask to user the others export configuration parameters
- URI uriFile = null;
+ // Ask user the others export configuration parameters
+ URI uriDirectory = null;
if (file != null) {
- IContainer parentResource = file.getParent();
- parentResource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(parentResource.getLocation());
- uriFile = URI.createPlatformResourceURI(parentResource.getLocation().toString(), true);
-
+ IResource parentResource = file.getParent().findMember(".");
+ uriDirectory = URI.createURI(parentResource.getLocationURI().toString());
}
if (parameter == null) {
pageError = new ExportDiagramsErrorPage();
addPage(pageError);
} else {
- page = new ExportDiagramsPage(uriFile);
+ page = new ExportDiagramsPage(uriDirectory);
addPage(page);
}
-
-
}
/**

Back to the top