void () { if (isDisposedOrNotOpen()) return; assert myProject != null; Project project = myProject; for (Iterator<Notification> iterator = myNotifications.iterator(); iterator.hasNext(); ) { Notification notification = iterator.next(); if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); iterator.remove(); } } List<Key> toRemove = new SmartList<>(); myUniqueNotifications.forEach((key, notification) -> { if (groupName == null || groupName.equals(notification.getGroupId())) { notification.expire(); toRemove.add(key); } }); toRemove.forEach(myUniqueNotifications::remove); final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow == null) return; final MessageView messageView = MessageView.getInstance(project); UIUtil.invokeLaterIfNeeded(() -> { if (project.isDisposed()) return; for (Content content: messageView.getContentManager().getContents()) { if (!content.isPinned() && contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))) { if (groupName == null) { messageView.getContentManager().removeContent(content, true); } else { assert content.getComponent() instanceof NewEditableErrorTreeViewPanel; NewEditableErrorTreeViewPanel errorTreeView = (NewEditableErrorTreeViewPanel)content.getComponent(); ErrorViewStructure errorViewStructure = errorTreeView.getErrorViewStructure(); errorViewStructure.removeGroup(groupName); } } } }); }