(Job job, Tool noReply)
| 274 | * Displays the export dialog with a given XML file. |
| 275 | */ |
| 276 | @Override |
| 277 | public void send(Job job, Tool noReply) { |
| 278 | if (OSPRuntime.isJS) { |
| 279 | exportJS(job); |
| 280 | return; |
| 281 | } |
| 282 | XMLControlElement control = new XMLControlElement(); |
| 283 | control.readXML(job.getXML()); |
| 284 | //OSPLog.finest(control.toXML()); |
| 285 | // Load all data objects into 'data' |
| 286 | List<Object> data = getDataObjects(control); |
| 287 | // Set export dialog to list appropriate data objects |
| 288 | buildAccessory(data); |
| 289 | // Set selected file in home directory |
| 290 | fc.setSelectedFile(new File(exportName + '.' + exportExtension)); |
| 291 | // Show the export dialog, and wait for user input |
| 292 | int returnVal = fc.showSaveDialog(null); |
| 293 | // If user clicked export, write the file |
| 294 | if (returnVal == JFileChooser.APPROVE_OPTION) { |
| 295 | File file = fc.getSelectedFile(); |
| 296 | // Check to see if file already exists |
| 297 | if (file.exists()) { |
| 298 | int selected = JOptionPane.showConfirmDialog(null, |
| 299 | ToolsRes.getString("Tool.Dialog.ReplaceFile.Message") + " " + file.getName() + "?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 300 | ToolsRes.getString("Tool.Dialog.ReplaceFile.Title"), //$NON-NLS-1$ |
| 301 | JOptionPane.YES_NO_CANCEL_OPTION); |
| 302 | if (selected != JOptionPane.YES_OPTION) { |
| 303 | return; |
| 304 | } |
| 305 | } |
| 306 | String description = fc.getFileFilter().getDescription(); |
| 307 | if (!description.trim().equals("not implemented")) |
| 308 | formats.get(description).export(file, filterDataObjects(data)); |
| 309 | if (file.getName().endsWith(exportExtension)) { |
| 310 | exportName = file.getName().substring(0, file.getName().length() - 1 - exportExtension.length()); |
| 311 | // System.out.println("new name="+exportName); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Gets the shared Tool. |
nothing calls this directly
no test coverage detected