void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); ContentManager contentManager=ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true); presentation.setEnabled(contentManager != null && contentManager.canCloseContents()); if (!presentation.isEnabled() && contentManager != null) { final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent()); presentation.setEnabled(PlatformDataKeys.TOOL_WINDOW.getData(context) != null); } }