Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2016-07-27 16:10:35 +0000
committerGerrit Code Review @ Eclipse.org2016-07-29 14:51:39 +0000
commit19f521c824e2c072bfa0bea24e1d896f208c10e8 (patch)
tree198e2e1e8e65f37fbc02108388ee741f24652e04 /plugins/infra/gmfdiag
parent0482fe93ac76b42b014592a09b34100b45745e75 (diff)
downloadorg.eclipse.papyrus-19f521c824e2c072bfa0bea24e1d896f208c10e8.tar.gz
org.eclipse.papyrus-19f521c824e2c072bfa0bea24e1d896f208c10e8.tar.xz
org.eclipse.papyrus-19f521c824e2c072bfa0bea24e1d896f208c10e8.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>
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.export/src/org/eclipse/papyrus/infra/gmfdiag/export/actions/ExportComposite.java22
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

Back to the top