Skip to content

Commit

Permalink
Intellij plugin doesn't need IDE restart anymore (#416)
Browse files Browse the repository at this point in the history
Intellij plugin doesn't need IDE restart anymore
  • Loading branch information
crogoz authored Oct 9, 2024
1 parent 13e11c3 commit b2221b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationGroupManager;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.platform.ide.progress.TaskCancellation;
import com.intellij.platform.ide.progress.TasksKt;
import com.intellij.platform.util.progress.StepsKt;
import com.intellij.ui.content.Content;
Expand All @@ -56,7 +57,7 @@
import org.jetbrains.plugins.gradle.settings.GradleSettings;

@Service(Service.Level.PROJECT)
public final class GradleJdksProjectService {
public final class GradleJdksProjectService implements Disposable {

private final Logger logger = Logger.getInstance(GradleJdksProjectService.class);
private static final String TOOL_WINDOW_NAME = "Gradle JDK Setup";
Expand All @@ -81,7 +82,6 @@ private ConsoleView initConsoleView() {
ContentFactory contentFactory = ContentFactory.getInstance();
Content content = contentFactory.createContent(newConsoleView.getComponent(), "", false);
toolWindow.getContentManager().addContent(content);
Disposer.register(project, newConsoleView);
});

return newConsoleView;
Expand Down Expand Up @@ -111,6 +111,7 @@ public void maybeSetupGradleJdks() {
TasksKt.withBackgroundProgress(
project,
"Gradle JDK Setup",
TaskCancellation.nonCancellable(),
(_coroutineScope, continuation) -> {
StepsKt.withProgressText(
"`Gradle JDK Setup` is running. Logs in the `Gradle JDK Setup` window ...",
Expand Down Expand Up @@ -191,4 +192,12 @@ private void updateGradleJvm() {
}
}
}

@Override
public void dispose() {
ConsoleView view = consoleView.get();
if (view != null) {
view.dispose();
}
}
}
2 changes: 1 addition & 1 deletion idea-plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<idea-plugin url="https://github.com/palantir/gradle-jdks">
<idea-plugin url="https://github.com/palantir/gradle-jdks" require-restart="false">
<id>palantir-gradle-jdks</id>
<name>palantir-gradle-jdks</name>
<vendor url="https://github.com/palantir/gradle-jdks">
Expand Down

0 comments on commit b2221b0

Please sign in to comment.