|
Lines 121-126
Link Here
|
| 121 |
} |
121 |
} |
| 122 |
|
122 |
|
| 123 |
public void writeTaskList(TaskList taskList, File outFile) { |
123 |
public void writeTaskList(TaskList taskList, File outFile) { |
|
|
124 |
try { |
| 125 |
writeTaskList(taskList, new FileOutputStream(outFile)); |
| 126 |
} catch (Exception e) { |
| 127 |
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Task data was not written", e)); |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
public void writeTaskList(TaskList taskList, OutputStream outputStream) { |
| 124 |
Document doc = createTaskListDocument(); |
132 |
Document doc = createTaskListDocument(); |
| 125 |
if (doc == null) { |
133 |
if (doc == null) { |
| 126 |
return; |
134 |
return; |
|
Lines 177-183
Link Here
|
| 177 |
} |
185 |
} |
| 178 |
|
186 |
|
| 179 |
// doc.appendChild(root); |
187 |
// doc.appendChild(root); |
| 180 |
writeDOMtoFile(doc, outFile); |
188 |
writeDOMtoFile(doc, outputStream); |
| 181 |
return; |
189 |
return; |
| 182 |
} |
190 |
} |
| 183 |
|
191 |
|
|
Lines 207-215
Link Here
|
| 207 |
* |
215 |
* |
| 208 |
* doc - the document to write file - the file to be written to |
216 |
* doc - the document to write file - the file to be written to |
| 209 |
*/ |
217 |
*/ |
| 210 |
private void writeDOMtoFile(Document doc, File file) { |
218 |
private void writeDOMtoFile(Document doc, OutputStream stream) { |
| 211 |
try { |
219 |
try { |
| 212 |
ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(file)); |
220 |
ZipOutputStream outputStream = new ZipOutputStream(stream); |
| 213 |
writeTaskList(doc, outputStream); |
221 |
writeTaskList(doc, outputStream); |
| 214 |
outputStream.close(); |
222 |
outputStream.close(); |
| 215 |
} catch (Exception e) { |
223 |
} catch (Exception e) { |
|
Lines 661-666
Link Here
|
| 661 |
} |
669 |
} |
| 662 |
|
670 |
|
| 663 |
public void writeTask(AbstractTask task, File outFile) { |
671 |
public void writeTask(AbstractTask task, File outFile) { |
|
|
672 |
try { |
| 673 |
writeTask(task, new FileOutputStream(outFile)); |
| 674 |
} catch (Exception e) { |
| 675 |
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Task data was not written", e)); |
| 676 |
} |
| 677 |
} |
| 678 |
|
| 679 |
public void writeTask(AbstractTask task, OutputStream stream) { |
| 664 |
Set<TaskRepository> repositories = new HashSet<TaskRepository>(); |
680 |
Set<TaskRepository> repositories = new HashSet<TaskRepository>(); |
| 665 |
if (!task.isLocal()) { |
681 |
if (!task.isLocal()) { |
| 666 |
repositories.add(TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryUrl())); |
682 |
repositories.add(TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryUrl())); |
|
Lines 675-681
Link Here
|
| 675 |
|
691 |
|
| 676 |
delagatingExternalizer.createTaskElement(task, doc, root); |
692 |
delagatingExternalizer.createTaskElement(task, doc, root); |
| 677 |
try { |
693 |
try { |
| 678 |
ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(outFile)); |
694 |
ZipOutputStream outputStream = new ZipOutputStream(stream); |
| 679 |
// write task data |
695 |
// write task data |
| 680 |
writeTaskList(doc, outputStream); |
696 |
writeTaskList(doc, outputStream); |