Issue #431: Canceling background threads (after timeout, or after user action, e.g new treeitem selected) fixed + small fixes

This commit is contained in:
Honfika
2013-12-03 00:26:21 +01:00
parent 3aa09fdf2b
commit 06b95ac6e1
42 changed files with 1083 additions and 773 deletions
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.CancellableWorker;
import com.jpexs.helpers.Helper;
import java.io.File;
import java.io.FileOutputStream;
@@ -143,7 +144,7 @@ public class ScriptPack {
public void toSource(GraphTextWriter writer, final List<ABCContainerTag> abcList, final Trait[] traits, final ExportMode exportMode, final boolean parallel) throws InterruptedException {
writer.suspendMeasure();
try {
Helper.timedCall(new Callable<Void>() {
CancellableWorker.call(new Callable<Void>() {
@Override
public Void call() throws Exception {
convert(new NulWriter(), abcList, traits, exportMode, parallel);
@@ -159,7 +160,7 @@ public class ScriptPack {
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to timeout\");").newLine();
return;
} catch (InterruptedException | ExecutionException ex) {
} catch (ExecutionException ex) {
writer.continueMeasure();
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
writer.appendNoHilight("/*").newLine();