private void close() { MessageView messageView = MessageView.SERVICE.getInstance(myProject); Content[] contents = messageView.getContentManager().getContents(); for (Content content : contents) { if (content.getComponent() == this) { messageView.getContentManager().removeContent(content, true); return; } } }
public void actionPerformed(AnActionEvent e) { if (myContentManager != null) { Content content = myContentManager.getContent(PanelWithActionsAndCloseButton.this); if (content != null) { ContentsUtil.closeContentTab(myContentManager, content); if (content instanceof TabbedContent && ((TabbedContent) content).getTabs().size() > 1) { final TabbedContent tabbedContent = (TabbedContent) content; final JComponent component = content.getComponent(); tabbedContent.removeContent(component); myContentManager.setSelectedContent( content, true, true); // we should request focus here } else { myContentManager.removeContent(content, true); } } } }