mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
use proper thread to show url dialog
This commit is contained in:
+25
-20
@@ -124,27 +124,32 @@ public final class IpnbConnectionManager implements ProjectComponent {
|
||||
|
||||
@Nullable
|
||||
public static String showDialogUrl(@NotNull final String initialUrl) {
|
||||
final String url = Messages.showInputDialog("Jupyter Notebook URL:", "Start Jupyter Notebook", null, initialUrl,
|
||||
new InputValidator() {
|
||||
@Override
|
||||
public boolean checkInput(String inputString) {
|
||||
try {
|
||||
final URI uri = new URI(inputString);
|
||||
if (uri.getPort() == -1 || StringUtil.isEmptyOrSpaces(uri.getHost())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
return !inputString.isEmpty();
|
||||
}
|
||||
final String url = UIUtil.invokeAndWaitIfNeeded(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
return Messages.showInputDialog("Jupyter Notebook URL:", "Start Jupyter Notebook", null, initialUrl,
|
||||
new InputValidator() {
|
||||
@Override
|
||||
public boolean checkInput(String inputString) {
|
||||
try {
|
||||
final URI uri = new URI(inputString);
|
||||
if (uri.getPort() == -1 || StringUtil.isEmptyOrSpaces(uri.getHost())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
return !inputString.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canClose(String inputString) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public boolean canClose(String inputString) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return url == null ? null : StringUtil.trimEnd(url, "/");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user