mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Don't show notifications capturing a project instance in the headless mode
Otherwise, notifications triggered by exceptions and not shown lead to a project leakage in tests. GitOrigin-RevId: b0a6672ef4dc6ad9fd92eb15a08042afe17ea99d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4582894569
commit
cd7d80855a
@@ -200,16 +200,26 @@ public class PythonSdkUpdater implements StartupActivity.Background {
|
||||
updateSdkPaths(sdk, getRemoteSdkMappedPaths(sdk), getProject());
|
||||
}
|
||||
}
|
||||
catch (UnsupportedPythonSdkTypeException e) {
|
||||
catch (UnsupportedPythonSdkTypeException | InvalidSdkException e) {
|
||||
notifyOfGenerationFailure(e, sdk);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyOfGenerationFailure(@NotNull Exception exception, @NotNull Sdk sdk) {
|
||||
if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
|
||||
LOG.warn(exception);
|
||||
return;
|
||||
}
|
||||
if (exception instanceof UnsupportedPythonSdkTypeException) {
|
||||
NOTIFICATION_GROUP
|
||||
.createNotification(PyBundle.message("sdk.gen.failed.notification.title"),
|
||||
PyBundle.message("remote.interpreter.support.is.not.available", sdk.getName()),
|
||||
NotificationType.WARNING)
|
||||
.notify(myProject);
|
||||
}
|
||||
catch (InvalidSdkException e) {
|
||||
else if (exception instanceof InvalidSdkException) {
|
||||
if (PythonSdkUtil.isRemote(PythonSdkUtil.findSdkByKey(mySdkKey))) {
|
||||
PythonSdkType.notifyRemoteSdkSkeletonsFail(e, () -> {
|
||||
PythonSdkType.notifyRemoteSdkSkeletonsFail((InvalidSdkException)exception, () -> {
|
||||
Sdk revalidatedSdk = PythonSdkUtil.findSdkByKey(mySdkKey);
|
||||
if (revalidatedSdk != null) {
|
||||
update(revalidatedSdk, myProject, null);
|
||||
@@ -217,7 +227,7 @@ public class PythonSdkUpdater implements StartupActivity.Background {
|
||||
});
|
||||
}
|
||||
else if (!PythonSdkUtil.isInvalid(sdk)) {
|
||||
LOG.error(e);
|
||||
LOG.error(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,7 +250,7 @@ public class PythonSdkUpdater implements StartupActivity.Background {
|
||||
}
|
||||
}
|
||||
|
||||
if (requestData != null) {
|
||||
if ( requestData != null) {
|
||||
ProgressManager.getInstance().run(new PyUpdateSdkTask(myProject, mySdkKey, requestData));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user