void (final Project project, Object sessionId, final Content notRemove) { if (project.isDisposed()) { return; } final ContentManager contentManager = MessageView.getInstance(project).getContentManager(); for (Content content : contentManager.getContents()) { if (content.isPinned() || content == notRemove) { continue; } boolean toRemove = CONTENT_ID_KEY.get(content) == myContentId; if (!toRemove) { final Object contentSessionId = SESSION_ID_KEY.get(content); toRemove = contentSessionId != null && contentSessionId != sessionId; // the content was added by previous compilation } if (toRemove) { contentManager.removeContent(content, true); } } }