MCPcopy Create free account
hub / github.com/GateNLP/gate-core / run

Method run

src/main/java/gate/gui/DocumentExportMenu.java:250–455  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

resourceLoadedMethod · 0.45

Calls 15

getInstanceMethod · 0.95
lockGUIMethod · 0.95
isDocumentLoadedMethod · 0.95
getLastPathComponentMethod · 0.95
unlockGUIMethod · 0.95
getPrintWriterMethod · 0.95
unloadDocumentMethod · 0.95
deleteResourceMethod · 0.95
addExporterMethod · 0.95
getFileTypeMethod · 0.80
getDefaultExtensionMethod · 0.80
getItemCountMethod · 0.80

Tested by

no test coverage detected