()
| 248 | |
| 249 | Runnable runnable = new Runnable() { |
| 250 | public void run() { |
| 251 | |
| 252 | if(handle.getTarget() instanceof Document) { |
| 253 | |
| 254 | long start = System.currentTimeMillis(); |
| 255 | listener.statusChanged("Saving as " + de.getFileType() |
| 256 | + " to " + selectedFile.toString() + "..."); |
| 257 | try { |
| 258 | de.export((Document)handle.getTarget(), selectedFile, |
| 259 | options); |
| 260 | } catch(IOException e) { |
| 261 | e.printStackTrace(); |
| 262 | } |
| 263 | |
| 264 | long time = System.currentTimeMillis() - start; |
| 265 | listener.statusChanged("Finished saving as " |
| 266 | + de.getFileType() + " into " + " the file: " |
| 267 | + selectedFile.toString() + " in " |
| 268 | + ((double)time) / 1000 + "s"); |
| 269 | } else { // corpus |
| 270 | if(de instanceof CorpusExporter) { |
| 271 | |
| 272 | long start = System.currentTimeMillis(); |
| 273 | listener.statusChanged("Saving as " + de.getFileType() |
| 274 | + " to " + selectedFile.toString() + "..."); |
| 275 | try { |
| 276 | ((CorpusExporter)de).export((Corpus)handle.getTarget(), selectedFile, |
| 277 | options); |
| 278 | } catch(IOException e) { |
| 279 | e.printStackTrace(); |
| 280 | } |
| 281 | |
| 282 | long time = System.currentTimeMillis() - start; |
| 283 | listener.statusChanged("Finished saving as " |
| 284 | + de.getFileType() + " into " + " the file: " |
| 285 | + selectedFile.toString() + " in " |
| 286 | + ((double)time) / 1000 + "s"); |
| 287 | } else { // not a CorpusExporter |
| 288 | try { |
| 289 | File dir = selectedFile; |
| 290 | // create the top directory if needed |
| 291 | if(!dir.exists()) { |
| 292 | if(!dir.mkdirs()) { |
| 293 | JOptionPane.showMessageDialog( |
| 294 | MainFrame.getInstance(), |
| 295 | "Could not create top directory!", "GATE", |
| 296 | JOptionPane.ERROR_MESSAGE); |
| 297 | return; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | MainFrame.lockGUI("Saving..."); |
| 302 | Corpus corpus = (Corpus)handle.getTarget(); |
| 303 | |
| 304 | long startTime = System.currentTimeMillis(); |
| 305 | // iterate through all the docs and save |
| 306 | // each of |
| 307 | // them |
no test coverage detected