Feature request: auto-close build tool window

Answered

I build frequently, and have to manually close the build tool window every time.

I have a kb shortcut assigned to ‘Restore Current Layout’ which closes all windows but project and editor.

It'd be nice if I could configure the build tool window to remain open for ‘n’ seconds after build (1 would be fine for me), then auto-close.

It'd save a lot of keystrokes.

Thanks for listening.

 

 

0
5 comments

Kludge remedy:

I created a macro that runs build and restores layout.

But it immediately closes build window so I can't see what's happening.

 

 

 

0

I can write a simple plugin that does it, but I am not sure that I understood your requirements and scenario correctly. Please share your macro (`File | Manage settings | Export settings`), upload to https://uploads.jetbrains.com/ and post here the upload ID

0

I did the export, and just picked out the Macro that does what I stated above. This is it:

 

    <macro name="BuildAndRestoreLayout">
     <action id="Run" />
     <action id="RestoreDefaultLayout" />
   </macro>
 

I saved my preferred layout (proj panel + editor). 

The macro executes my last run config, then restores default layout.

To be clear, I don't want this duplicated as a plugin. I was requesting an option to hide the build panel as soon as the build completes, with a delay option so I can read the build output and note any errors.

 

0

Hiding a specific tool window cannot be part of the default IDE behavior, and the experience shows that most users never discover additional options in Settings. Therefore, such types or features are implemented via plugins so that users who search for them specifically can fine-tune the IDE.

Here is the code for the plugin that hides build tool window in 5 seconds after display, unless it has errors. Please check, if it does what you want to achieve, and I will publish it on Marketplace.

public class MyProjectTaskListener implements ProjectTaskListener {

    private int duration = 5; // allow tool window button for 5 seconds
    private final Project project;

    public MyProjectTaskListener(Project project) {
        this.project = project;
    }

    @Override
    public void finished(@NotNull ProjectTaskManager.Result result) {
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

        executor.schedule(() -> {
            ApplicationManager.getApplication().invokeLater(() -> {
                ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow("Build");
                if (toolWindow != null && toolWindow.isVisible() && !result.hasErrors()) {
                    toolWindow.hide(null);
                }
            });
        }, duration, TimeUnit.SECONDS);
    }
}

 

0

Nadia Tarashkevich This looks like a great addition to my IntelliJ environment.  Can you publish it and post the name so I can add it as a plugin?

0

Please sign in to leave a comment.