void (@NotNull final JComponent dataComponent, @Nullable final JComponent actionListenerComponent, @NotNull final String title, @NotNull Icon icon, @NotNull final Project project, @Nullable final Collection<? extends Runnable> closeListeners, final AnAction @NotNull ... customActions) { final ToolWindowApi api = new ToolWindowApi(project, title, icon); final Collection<Runnable> closeListenersToAdd = new ArrayList<>(Collections.singleton(new MyToolWindowCloser(api))); if (closeListeners != null) { closeListenersToAdd.addAll(closeListeners); } api.add(PanelWithActions.wrap(dataComponent, closeListenersToAdd, actionListenerComponent, customActions)); }