Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-11-04 19:02:04 -0500
committermkersten2005-11-04 19:02:04 -0500
commite0fcf13e9d5d6d7c0d43a20c0c57f879aeeb35a2 (patch)
tree0639ec926f1cdb120b08d9a1bc8031be173ecbc2
parent4b7f70afb224274caffe0d29ec1f89e14e92ea27 (diff)
downloadorg.eclipse.mylyn.tasks-e0fcf13e9d5d6d7c0d43a20c0c57f879aeeb35a2.tar.gz
org.eclipse.mylyn.tasks-e0fcf13e9d5d6d7c0d43a20c0c57f879aeeb35a2.tar.xz
org.eclipse.mylyn.tasks-e0fcf13e9d5d6d7c0d43a20c0c57f879aeeb35a2.zip
Patch for Bugzilla Bug 114162 Export to zip files
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java22
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizardPage.java3
2 files changed, 22 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java
index 30e149872..3a4c9e226 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java
@@ -7,7 +7,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -37,7 +39,7 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard {
*/
private final static String SETTINGS_SECTION = "org.eclipse.mylar.tasklist.ui.exportWizard";
- public final static String ZIP_FILE_NAME = "mylartaskdata.zip";
+ public final static String ZIP_FILE_NAME = TaskDataExportWizardPage.ZIP_FILE_NAME;
private final static String WINDOW_TITLE = "Export";
@@ -89,6 +91,13 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard {
//Get file paths to check for existence
String destDir = exportPage.getDestinationDirectory();
+ File destDirFile = new File(destDir);
+ if (!destDirFile.exists() || !destDirFile.isDirectory()){
+ //This should never happen
+ MylarPlugin.fail(new Exception("File Export Exception"), "Could not export data because specified location does not exist or is not a folder", true);
+ return false;
+ }
+
File destTaskListFile = new File(destDir + File.separator
+ MylarTasklistPlugin.DEFAULT_TASK_LIST_FILE);
File destActivationHistoryFile = new File(destDir
@@ -140,7 +149,12 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard {
//Save the files
+ //List of files to add to the zip archive
List<File> filesToZip = new ArrayList<File>();
+
+ //Map of file paths used to avoid duplicates
+ Map<String,String> filesToZipMap = new HashMap<String, String>();
+
if (exportPage.exportTaskList()) {
MylarTasklistPlugin.getTaskListManager().saveTaskList();
@@ -192,8 +206,12 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard {
File destTaskFile = new File(destDir + File.separator + task.getPath() + MylarContextManager.FILE_EXTENSION);
File sourceTaskFile = new File(MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + task.getPath() + MylarContextManager.FILE_EXTENSION);
+
if (zip){
- filesToZip.add(sourceTaskFile);
+ if (!filesToZipMap.containsKey(task.getPath())){
+ filesToZip.add(sourceTaskFile);
+ filesToZipMap.put(task.getPath(), null);
+ }
}
else{
if (!copy(sourceTaskFile, destTaskFile) && !errorDisplayed){
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizardPage.java
index cdf8d0f7d..da4fccad5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizardPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizardPage.java
@@ -27,6 +27,7 @@ public class TaskDataExportWizardPage extends WizardPage {
protected final static String PAGE_TITLE = "Export Mylar Task Data";
public final static String PAGE_NAME = PAGE_TITLE;
+ public final static String ZIP_FILE_NAME = "MylarTaskData.zip";
//Control fields
private Button taskListCheckBox = null;
@@ -68,7 +69,7 @@ public class TaskDataExportWizardPage extends WizardPage {
createFileSelectionControl(container);
createExportDirectoryControl(container);
- zipCheckBox = createCheckBox(container, "Export to zip file");
+ zipCheckBox = createCheckBox(container, "Export to zip file: " + ZIP_FILE_NAME);
overwriteCheckBox = createCheckBox(container, "Overwrite existing files without warning");
initSettings();

Back to the top