diff options
| author | Remi Schnekenburger | 2016-07-27 16:10:35 +0000 |
|---|---|---|
| committer | Remi Schnekenburger | 2016-07-29 14:51:53 +0000 |
| commit | 3df3f613b9d4f241015574a5e5bb46275f133893 (patch) | |
| tree | d86dc5cdfa9c6e83101aad80a6d5b98d87632cf3 | |
| parent | 11a22feca182165dd2e22d9f4b52e2fc77efb6e6 (diff) | |
| download | org.eclipse.papyrus-3df3f613b9d4f241015574a5e5bb46275f133893.tar.gz org.eclipse.papyrus-3df3f613b9d4f241015574a5e5bb46275f133893.tar.xz org.eclipse.papyrus-3df3f613b9d4f241015574a5e5bb46275f133893.zip | |
Bug 473803 - Papyrus versions 1.1.0, 1.1.1, 1.1.2, 1.1.3 and 2.0.0 fail
to export diagrams as images (Eclipse Neon and Mars)
- fixing algorithm to select the output directory
Change-Id: Id888a121551410d142c9f674013e3dae1f0c52db
Signed-off-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
(cherry picked from commit 19f521c824e2c072bfa0bea24e1d896f208c10e8)
| -rw-r--r-- | plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java | 22 |
1 files changed, 20 insertions, 2 deletions
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 23f65300f34..8a3e8168257 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 @@ -13,6 +13,7 @@ package org.eclipse.papyrus.infra.gmfdiag.export.actions; 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; @@ -41,7 +42,7 @@ public class ExportComposite extends Composite { private Text outputPathTxt; private Button outputDirectoryBtn; - + private Combo outputFormatCb; private Button btnCheckButton; @@ -164,6 +165,23 @@ public class ExportComposite extends Composite { 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) { @@ -201,4 +219,4 @@ public class ExportComposite extends Composite { public boolean getQualifiedName() { return qualifiedName; } -} +}
\ No newline at end of file |
