From c5fc6f81bb87ee53a081ed9d0ec452c051da2e70 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 20 Jun 2018 16:47:19 +0100 Subject: [PATCH] JAL-3032 simplified _LoadFileWaitTillLoaded with no thread --- src/jalview/io/FileLoader.java | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 60db4c8..9dd740b 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -176,40 +176,20 @@ public class FileLoader implements Runnable } /** - * start thread and wait until finished, then return the alignFrame that's - * (hopefully) been read. + * runs the 'run' method (in this thread), then return the alignFrame that's + * (hopefully) been read * * @return */ protected AlignFrame _LoadFileWaitTillLoaded() { - - /** - * @j2sNative - * - * this.run(); - * - */ - { - Thread loader = new Thread(this); - loader.start(); - - while (loader.isAlive()) - { - try - { - Thread.sleep(500); - } catch (Exception ex) - { - } - } - } + this.run(); return alignFrame; } public void updateRecentlyOpened() { - Vector recent = new Vector(); + Vector recent = new Vector<>(); if (protocol == DataSourceType.PASTE) { // do nothing if the file was pasted in as text... there is no filename to @@ -225,7 +205,7 @@ public class FileLoader implements Runnable String type = protocol == DataSourceType.FILE ? "RECENT_FILE" : "RECENT_URL"; - String historyItems = jalview.bin.Cache.getProperty(type); + String historyItems = Cache.getProperty(type); StringTokenizer st; @@ -235,7 +215,7 @@ public class FileLoader implements Runnable while (st.hasMoreTokens()) { - recent.addElement(st.nextElement().toString().trim()); + recent.addElement(st.nextToken().trim()); } } -- 1.7.10.2