|
a/tool/run/plugins/spdx/create.java |
|
b/tool/run/plugins/spdx/create.java |
|
... |
|
... |
11 |
*/
|
11 |
*/
|
12 |
|
12 |
|
13 |
package spdx;
|
13 |
package spdx;
|
14 |
|
14 |
|
15 |
import GUI.swingUtils;
|
15 |
import GUI.swingUtils;
|
16 |
import spdxlib.DocumentCreate;
|
|
|
17 |
import definitions.Messages;
|
16 |
import definitions.Messages;
|
18 |
import definitions.is;
|
17 |
import definitions.is;
|
19 |
import java.io.File;
|
18 |
import java.io.File;
|
20 |
import java.io.IOException;
|
19 |
import java.io.IOException;
|
21 |
import java.util.logging.Level;
|
20 |
import java.util.logging.Level;
|
22 |
import java.util.logging.Logger;
|
21 |
import java.util.logging.Logger;
|
23 |
import script.Plugin;
|
|
|
24 |
import script.log;
|
|
|
25 |
import main.core;
|
22 |
import main.core;
|
26 |
import main.param;
|
23 |
import main.param;
|
27 |
import org.rauschig.jarchivelib.ArchiveFormat;
|
24 |
import org.rauschig.jarchivelib.ArchiveFormat;
|
28 |
import org.rauschig.jarchivelib.Archiver;
|
25 |
import org.rauschig.jarchivelib.Archiver;
|
29 |
import org.rauschig.jarchivelib.ArchiverFactory;
|
26 |
import org.rauschig.jarchivelib.ArchiverFactory;
|
30 |
import org.rauschig.jarchivelib.CompressionType;
|
27 |
import org.rauschig.jarchivelib.CompressionType;
|
31 |
import script.DownloadBigFile;
|
28 |
import script.DownloadBigFile;
|
|
|
29 |
import script.Plugin;
|
32 |
import script.RunningTask;
|
30 |
import script.RunningTask;
|
|
|
31 |
import script.log;
|
|
|
32 |
import spdxlib.DocumentCreate;
|
33 |
import utils.html;
|
33 |
import utils.html;
|
34 |
import www.RequestOrigin;
|
34 |
import www.RequestOrigin;
|
35 |
import www.WebRequest;
|
35 |
import www.WebRequest;
|
36 |
|
36 |
|
37 |
|
37 |
|
|
... |
|
... |
252 |
String selectedFolder = settings.read(LastFolderNewSPDX);
|
252 |
String selectedFolder = settings.read(LastFolderNewSPDX);
|
253 |
|
253 |
|
254 |
|
254 |
|
255 |
// show the dialog
|
255 |
// show the dialog
|
256 |
File result = swingUtils.chooseFolder(new File(selectedFolder));
|
256 |
File result = swingUtils.chooseFolder(new File(selectedFolder));
|
|
|
257 |
log.write(is.ACCEPTED, "Chose folder %1 as source for the SPDX "
|
|
|
258 |
+ "document", result.getAbsolutePath());
|
257 |
|
259 |
|
258 |
// place the result in our settings
|
260 |
// place the result in our settings
|
259 |
if(result != null){
|
261 |
if(result != null){
|
260 |
settings.write(LastFolderNewSPDX, result.getAbsolutePath());
|
262 |
settings.write(LastFolderNewSPDX, result.getAbsolutePath());
|
261 |
}
|
263 |
}
|
|
... |
|
... |
316 |
*/
|
318 |
*/
|
317 |
private String createDocument(File extractedFolder, RunningTask task,
|
319 |
private String createDocument(File extractedFolder, RunningTask task,
|
318 |
DocumentCreate newSPDX){
|
320 |
DocumentCreate newSPDX){
|
319 |
task.setStatus("Creating the SPDX document");
|
321 |
task.setStatus("Creating the SPDX document");
|
320 |
|
322 |
|
|
|
323 |
String result = "";
|
|
|
324 |
|
321 |
|
325 |
try{
|
322 |
// do all the heavy work
|
326 |
// do all the heavy work
|
323 |
String result = newSPDX.create(extractedFolder);
|
327 |
result = newSPDX.create(extractedFolder);
|
|
|
328 |
}catch (Exception e){
|
|
|
329 |
log.write(is.ERROR, "CR01- Exception occurred when creating SPDX");
|
|
|
330 |
}
|
324 |
// count the time it took to run this task
|
331 |
// count the time it took to run this task
|
325 |
long time = System.currentTimeMillis() - task.getUID();
|
332 |
long time = System.currentTimeMillis() - task.getUID();
|
326 |
String timeCount = utils.time.timeNumberToHumanReadable(time) + " were "
|
333 |
String timeCount = utils.time.timeNumberToHumanReadable(time) + " were "
|
327 |
+ "necessary to complete this task";
|
334 |
+ "necessary to complete this task";
|
328 |
task.setStatus(timeCount);
|
335 |
task.setStatus(timeCount);
|
|
|
336 |
|
|
|
337 |
// something went wrong, raise a flag
|
|
|
338 |
if(result.isEmpty()){
|
|
|
339 |
task.setStatus("Exception occurred when creating SPDX!");
|
|
|
340 |
task.setPercentageComplete(100);
|
|
|
341 |
return "";
|
|
|
342 |
}
|
|
|
343 |
|
329 |
// all done
|
344 |
// all done
|
330 |
task.setStatus("All done!");
|
345 |
task.setStatus("All done!");
|
331 |
task.setPercentageComplete(100);
|
346 |
task.setPercentageComplete(100);
|
332 |
|
347 |
|
333 |
|
348 |
|
|
... |
|
... |
460 |
/**
|
475 |
/**
|
461 |
* Do the things that are necessary after creating a new SPDX document, such as
|
476 |
* Do the things that are necessary after creating a new SPDX document, such as
|
462 |
* updating the tree view
|
477 |
* updating the tree view
|
463 |
*/
|
478 |
*/
|
464 |
private void concludeCreation(DocumentCreate newSPDX){
|
479 |
private void concludeCreation(DocumentCreate newSPDX){
|
465 |
String UID = newSPDX.UID;
|
480 |
// String UID = newSPDX.UID;
|
466 |
// refresh the tree
|
481 |
// // refresh the tree
|
467 |
swingUtils.refreshAll(core.studio.getTree(), UID);
|
482 |
// swingUtils.refreshAll(core.studio.getTree(), UID);
|
468 |
}
|
483 |
}
|
469 |
|
484 |
|
470 |
}
|
485 |
}
|
471 |
|
486 |
|
472 |
|
487 |
|