void () { if (myFuture == null) { String refText = StringUtil.trim(getText(), CharFilter.NOT_WHITESPACE_FILTER); final Future<?> future = ((mySelectedRef == null || (!mySelectedRef.getName().equals(refText))) ? myOnSelectedHash.fun(refText) : myOnSelectedRef.fun(mySelectedRef)); myFuture = future; showProgress(); ApplicationManager.getApplication().executeOnPooledThread(() -> { try { future.get(); okPopup(); } catch (CancellationException | InterruptedException ex) { cancelPopup(); } catch (ExecutionException ex) { LOG.error(ex); cancelPopup(); } }); } }