|
Lines 114-119
Link Here
|
| 114 |
} |
114 |
} |
| 115 |
|
115 |
|
| 116 |
public void writeTaskList(TaskList taskList, File outFile) { |
116 |
public void writeTaskList(TaskList taskList, File outFile) { |
|
|
117 |
try { |
| 118 |
writeTaskList(taskList, new FileOutputStream(outFile)); |
| 119 |
} catch (Exception fnfe) { |
| 120 |
StatusHandler.log(fnfe, "TaskList could not be found"); |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
public void writeTaskList(TaskList taskList, OutputStream outputStream) { |
| 117 |
Document doc = createTaskListDocument(); |
125 |
Document doc = createTaskListDocument(); |
| 118 |
if (doc == null) { |
126 |
if (doc == null) { |
| 119 |
return; |
127 |
return; |
|
Lines 168-174
Link Here
|
| 168 |
} |
176 |
} |
| 169 |
|
177 |
|
| 170 |
// doc.appendChild(root); |
178 |
// doc.appendChild(root); |
| 171 |
writeDOMtoFile(doc, outFile); |
179 |
writeDOMtoFile(doc, outputStream); |
| 172 |
return; |
180 |
return; |
| 173 |
} |
181 |
} |
| 174 |
|
182 |
|
|
Lines 198-206
Link Here
|
| 198 |
* |
206 |
* |
| 199 |
* doc - the document to write file - the file to be written to |
207 |
* doc - the document to write file - the file to be written to |
| 200 |
*/ |
208 |
*/ |
| 201 |
private void writeDOMtoFile(Document doc, File file) { |
209 |
private void writeDOMtoFile(Document doc, OutputStream stream) { |
| 202 |
try { |
210 |
try { |
| 203 |
ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(file)); |
211 |
ZipOutputStream outputStream = new ZipOutputStream(stream); |
| 204 |
writeTaskList(doc, outputStream); |
212 |
writeTaskList(doc, outputStream); |
| 205 |
outputStream.close(); |
213 |
outputStream.close(); |
| 206 |
} catch (Exception fnfe) { |
214 |
} catch (Exception fnfe) { |
|
Lines 646-651
Link Here
|
| 646 |
} |
654 |
} |
| 647 |
|
655 |
|
| 648 |
public void writeTask(AbstractTask task, File outFile) { |
656 |
public void writeTask(AbstractTask task, File outFile) { |
|
|
657 |
try { |
| 658 |
writeTask(task, new FileOutputStream(outFile)); |
| 659 |
} catch (Exception e) { |
| 660 |
StatusHandler.log(e, "Task data was not written"); |
| 661 |
} |
| 662 |
} |
| 663 |
|
| 664 |
public void writeTask(AbstractTask task, OutputStream stream) { |
| 649 |
Set<TaskRepository> repositories = new HashSet<TaskRepository>(); |
665 |
Set<TaskRepository> repositories = new HashSet<TaskRepository>(); |
| 650 |
if (!task.isLocal()) { |
666 |
if (!task.isLocal()) { |
| 651 |
repositories.add(TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryUrl())); |
667 |
repositories.add(TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryUrl())); |
|
Lines 660-666
Link Here
|
| 660 |
|
676 |
|
| 661 |
delagatingExternalizer.createTaskElement(task, doc, root); |
677 |
delagatingExternalizer.createTaskElement(task, doc, root); |
| 662 |
try { |
678 |
try { |
| 663 |
ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(outFile)); |
679 |
ZipOutputStream outputStream = new ZipOutputStream(stream); |
| 664 |
// write task data |
680 |
// write task data |
| 665 |
writeTaskList(doc, outputStream); |
681 |
writeTaskList(doc, outputStream); |
| 666 |
|
682 |
|