Changeset 32925


Ignore:
Timestamp:
2019-03-25T20:39:09+13:00 (5 years ago)
Author:
ak19
Message:

All methods creating and displaying WarningDialogs in Gatherer are now warpped in an InvokeAndWait(). Note that stackoverflow discussions indicate that even JOptionPane showMessageDialog methods indicate these are not threadsafe (though show() itself is, not sure about setVisible()). The general consensus seems to be that all JOptionPane show dialog methods must be run with InvokeAndWait() too. I've not yet made the modifications for that in Gatherer.java

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r32924 r32925  
    12341234    */
    12351235    static public void missingEXEC() {
     1236        try {
     1237        SwingUtilities.invokeAndWait(new Runnable() {
     1238          public void run() {
    12361239        WarningDialog dialog;
    12371240        String configPropertyName = "general.library_url"+Configuration.gliPropertyNameSuffix();
     
    12911294            }
    12921295        }
     1296          }
     1297        });
     1298      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1299          e.printStackTrace();
     1300      }
    12931301    }
    12941302
     
    12981306    */
    12991307    static private void popupFedoraInfo() {
    1300 
     1308        try {
     1309        SwingUtilities.invokeAndWait(new Runnable() {
     1310          public void run() {
    13011311        FedoraLogin dialog = new FedoraLogin("Fedora Login", false);
    13021312
     
    13641374       
    13651375        // Now we are connected.
     1376          }
     1377        });
     1378      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1379          e.printStackTrace();
     1380      }
    13661381    }
    13671382
     
    13701385    static private void requestGLIServerURL()
    13711386    {
     1387        try {
     1388        SwingUtilities.invokeAndWait(new Runnable() {
     1389          public void run() {
    13721390        WarningDialog dialog;
    13731391        String[] defaultURLs = {
     
    14141432            }
    14151433        }
     1434          }
     1435        });
     1436      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1437          e.printStackTrace();
     1438      }
    14161439    }
    14171440
     
    14201443    */
    14211444    static private void missingGSDL() {
     1445        try {
     1446        SwingUtilities.invokeAndWait(new Runnable() {
     1447          public void run() {
    14221448        WarningDialog dialog = new WarningDialog("warning.MissingGSDL", Dictionary.get("MissingGSDL.Title"), Dictionary.get("MissingGSDL.Message"), null, false);
    14231449        dialog.display();
    14241450        dialog.dispose();
    14251451        dialog = null;
     1452          }
     1453        });
     1454      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1455          e.printStackTrace();
     1456      }
    14261457    }
    14271458
    14281459    /** Prints a warning message about missing a valid ImageMagick path, which although not fatal means building image collections won't work */
    14291460    static private void missingImageMagick() {
     1461        try {
     1462        SwingUtilities.invokeAndWait(new Runnable() {
     1463          public void run() {
    14301464        WarningDialog dialog = new WarningDialog("warning.MissingImageMagick", Dictionary.get("MissingImageMagick.Title"), Dictionary.get("MissingImageMagick.Message"), null, false);
    14311465        dialog.display();
    14321466        dialog.dispose();
    14331467        dialog = null;
     1468          }
     1469        });
     1470      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1471          e.printStackTrace();
     1472      }
    14341473    }
    14351474
    14361475        /** Prints a message informing the user where they can get PDFBox from to process PDF files of v1.5 and greater */
    14371476    static private void missingPDFBox(String zipExtension, String extFolder) {
     1477     try {
     1478      SwingUtilities.invokeAndWait(new Runnable() {
     1479       public void run() {
     1480
    14381481    // point to the correct version of the PDFBox extension for this Greenstone release
    14391482    String releaseTag = "";
     
    14461489        dialog.dispose();
    14471490        dialog = null;
     1491          }
     1492        });
     1493      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1494          e.printStackTrace();
     1495      }     
    14481496    }
    14491497
    14501498    /** Prints a warning message about missing a valid PERL path, which although not fatal pretty much ensures no collection creation/building will work properly in the GLI. */
    14511499    static private void missingPERL() {
     1500        try {
     1501        SwingUtilities.invokeAndWait(new Runnable() {
     1502          public void run() {
    14521503        WarningDialog dialog = new WarningDialog("warning.MissingPERL", Dictionary.get("MissingPERL.Title"), Dictionary.get("MissingPERL.Message"), null, false);
    14531504        dialog.display();
    14541505        dialog.dispose();
    14551506        dialog = null;
     1507          }
     1508        });
     1509      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1510          e.printStackTrace();
     1511      }
    14561512    }
    14571513
    14581514    /** Prints a message informing the user that their collecthome is non-standard (not inside GS installation) */
    14591515    static private void nonStandardCollectHomeMessage(String open_collection_file_path, String defaultColDir) {
     1516     try {
     1517      SwingUtilities.invokeAndWait(new Runnable() {
     1518       public void run() {
    14601519    WarningDialog dialog = new WarningDialog("warning.NonStandardCollectHome", Dictionary.get("NonStandardCollectHome.Title"), Dictionary.get("NonStandardCollectHome.Message", new String[]{open_collection_file_path, defaultColDir}), null, false);
    14611520        dialog.display();
    14621521        dialog.dispose();
    14631522        dialog = null;
     1523          }
     1524        });
     1525      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1526          e.printStackTrace();
     1527      }
    14641528    }
    14651529
    14661530    /** Prints a warning message about the OS not supporting multiple filename encodings.  */
    1467     static private void multipleFilenameEncodingsNotSupported() {   
     1531    static private void multipleFilenameEncodingsNotSupported() {
     1532        try {
     1533        SwingUtilities.invokeAndWait(new Runnable() {
     1534          public void run() {
    14681535        WarningDialog dialog = new WarningDialog("warning.NoEncodingSupport",
    14691536        Dictionary.get("NoEncodingSupport.Title"),
     
    14721539        dialog.dispose();
    14731540        dialog = null;
     1541          }
     1542        });
     1543      } catch(Exception e) { //InterruptedException or InvocationTargetException
     1544          e.printStackTrace();
     1545      }
    14741546    }
    14751547
Note: See TracChangeset for help on using the changeset viewer.