chiark / gitweb /
thread fixes: set cancellation message when cancelled
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Apr 2011 18:07:36 +0000 (19:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Apr 2011 18:07:36 +0000 (19:07 +0100)
src/net/chiark/yarrg/MarketUploader.java

index 7df37f4..c7f8942 100644 (file)
@@ -327,7 +327,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       // already got it
       return;
     String name = w.getAccessibleContext().getAccessibleName();
-    debuglog("MarketUploader new toplevel "+name);
+    debuglog("MarketUploader checking toplevel "+name);
     if (!name.equals("Puzzle Pirates"))
       return;
     debuglog("MarketUploader found toplevel, creating gui");
@@ -490,10 +490,12 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       progmon.setProgress(nv);
     }}.exec("setProgress "+nv);
   }
-  private boolean isCanceled() throws Exception {
+  private boolean checkCancelled() throws Exception {
     return new UIXR<Boolean>() { public Boolean bodyr() {
-      return new Boolean(progmon.isCanceled());
-    }}.exec("isCanceled").booleanValue();
+      boolean can = progmon.isCanceled();
+      if (can) resultSummary.setText("cancelled");
+      return new Boolean(can);
+    }}.exec("checkCancelled").booleanValue();
   }
        
   /*
@@ -745,7 +747,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       debuglog("pctb prepare...");
       progressNote("PCTB: Getting stall names");
       setProgress(20);
-      if(isCanceled()) {
+      if(checkCancelled()) {
        return;
       }
       TreeSet<Offer> buys = new TreeSet<Offer>();
@@ -753,7 +755,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       LinkedHashMap<String,Integer> stallMap = getStallMap(data);
       setProgress(40);
       progressNote("PCTB: Sorting offers");
-      if(isCanceled()) {
+      if(checkCancelled()) {
        return;
       }
       // get commod map
@@ -771,7 +773,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       ByteArrayOutputStream outStream = new ByteArrayOutputStream();
       setProgress(60);
       progressNote("PCTB: Sending data");
-      if(isCanceled()) {
+      if(checkCancelled()) {
        return;
       }
       GZIPOutputStream out = new GZIPOutputStream(outStream);
@@ -790,7 +792,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener {
       debuglog("pctb sent.");
       if (in == null) return;
       setProgress(80);
-      if(isCanceled()) {
+      if(checkCancelled()) {
        return;
       }
       progressNote("PCTB: Waiting ...");