-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Gradle JDK Automanagement][Intellij plugin] Background tool window #405
Conversation
@@ -90,7 +110,28 @@ public void maybeSetupGradleJdks() { | |||
"Skipping setupGradleJdks because gradle JDK setup is not found %s", gradleSetupScript)); | |||
return; | |||
} | |||
setupGradleJdks(); | |||
TasksKt.withBackgroundProgress( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of: https://github.com/JetBrains/intellij-community/blob/99964dd3c76f6cf9eb24018c002a68848e54dddb/platform/core-api/src/com/intellij/openapi/progress/Task.java#L43C8-L43C12 which has obsolescence notice
TasksKt.withBackgroundProgress( | ||
project, | ||
"Gradle JDK Setup", | ||
(_coroutineScope, continuation) -> { | ||
StepsKt.withProgressText( | ||
"`Gradle JDK Setup` is running. Logs in the `Gradle JDK Setup` window ...", | ||
(_cor, conti) -> { | ||
setupGradleJdks(); | ||
return conti; | ||
}, | ||
continuation); | ||
return continuation; | ||
}, | ||
new Continuation<>() { | ||
@Override | ||
public @NotNull CoroutineContext getContext() { | ||
return EmptyCoroutineContext.INSTANCE; | ||
} | ||
|
||
@Override | ||
public void resumeWith(@NotNull Object _object) {} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -109,6 +151,21 @@ public void processTerminated(@NotNull ProcessEvent _event) { | |||
consoleView.get().attachToProcess(handler); | |||
ProcessTerminatedListener.attach(handler, project, "Gradle JDK setup finished with exit code $EXIT_CODE$"); | |||
handler.waitFor(); | |||
if (handler.getExitCode() != 0) { | |||
Notification notification = NotificationGroupManager.getInstance() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to focus the window on failure. The notification windows are quite quiet. I for some reason barely ever notice the "required plugins" notification lolol and I think it's quite common.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in: aceac47
@@ -72,13 +83,22 @@ private ConsoleView initConsoleView() { | |||
ContentFactory contentFactory = ContentFactory.getInstance(); | |||
Content content = contentFactory.createContent(newConsoleView.getComponent(), "", false); | |||
toolWindow.getContentManager().addContent(content); | |||
// TODO(crogoz): Focus only when error or takes a long time? | |||
toolWindow.activate(null); | |||
Disposer.register(project, newConsoleView); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this fixes: #394 I wasn't able to repro the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
Released 0.47.0 |
Before this PR
After this PR
Fixes: #395
Gradle JDK setup
tool window will be minimized by defaultGradle JDK setup
would look as if it were a background process (similar to theGradle Sync
workflow)Gradle JDK setup
fails, then we will show a pop-up Notification with a link to the logs.==COMMIT_MSG==
[Gradle JDK Automanagement][Intellij plugin] Background tool window
==COMMIT_MSG==
Note: I've tried using the declarative setup for the
Gradle JDK setup
toolWindow (https://plugins.jetbrains.com/docs/intellij/tool-windows.html#declarative-setup) but the workflow had 2 issues:Possible downsides?