From 9c720885633122716ff41b2bf9d24c9c7ab3dc91 Mon Sep 17 00:00:00 2001 From: lingutln Date: Mon, 5 Mar 2012 21:08:08 +0000 Subject: [PATCH] Saving as a zip file functionality. Done by Nikhil. svn path=/; revision=306 --- .../ie/dcu/apps/ist/actions/ExportImageMapAction.java | 10 +++++++++- Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java | 2 +- .../src/ie/dcu/apps/ist/export/imagemap/ImageMap.java | 4 +--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java index 196d869..191e737 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java @@ -20,6 +20,11 @@ import org.eclipse.swt.program.Program; */ public class ExportImageMapAction extends AppAction{ + /** + * The file extension given to a this object when it is saved on a disk + */ + public static final String IMGMAP_EXTENSION = ".imgmap"; + public ExportImageMapAction(ActionManager m) { super(m); } @@ -44,9 +49,12 @@ public class ExportImageMapAction extends AppAction{ Exporter exporter = new Exporter(image); exporter.setEffect(result.effect); exporter.setHtmlFile(result.html); + + // Taking html file name and making the same as filename of imagemap int dotIndex = result.html.indexOf('.'); String zipFile = result.html.substring(0, dotIndex); - exporter.setZipFile(zipFile+".zip"); + exporter.setZipFile(zipFile+IMGMAP_EXTENSION); + exporter.setImageFile(result.image); exporter.setObjectLink(result.link); exporter.setExportShape(result.shape); diff --git a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java index 823f176..5c956b6 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/OpenAction.java @@ -83,7 +83,7 @@ public class OpenAction extends AppAction { if (dialog == null) { dialog = new FileDialog(window.getShell(), SWT.OPEN | SWT.SHEET); dialog.setText(property("OpenAction.dialog.text")); - dialog.setFilterExtensions(getFilters()); + //dialog.setFilterExtensions(getFilters()); dialog.setFilterNames(getFilterNames()); } } diff --git a/Annotation/src/ie/dcu/apps/ist/export/imagemap/ImageMap.java b/Annotation/src/ie/dcu/apps/ist/export/imagemap/ImageMap.java index 2a3e1c4..f09ba48 100644 --- a/Annotation/src/ie/dcu/apps/ist/export/imagemap/ImageMap.java +++ b/Annotation/src/ie/dcu/apps/ist/export/imagemap/ImageMap.java @@ -200,9 +200,7 @@ public class ImageMap { } public void exportToFile(ZipOutputStream o) throws IOException { - DataOutputStream out = new DataOutputStream( - new BufferedOutputStream(o)); - System.out.println("Exxporting content : "+export()); + DataOutputStream out = new DataOutputStream(new BufferedOutputStream(o)); out.writeBytes(export()); // Flush out.flush(); -- 2.34.1