run contentSelected only on add to selection (not remove)
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 21 Jul 2015 08:49:12 +0000 (11:49 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 21 Jul 2015 08:50:56 +0000 (11:50 +0300)
platform/lang-impl/src/com/intellij/execution/ui/RunContentManagerImpl.java

index 9f93d4d13e9661a023b61b84931f93f89ce055c3..4844342399f5516feaa282bde578a16bb82ebca4 100644 (file)
@@ -155,8 +155,10 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
     contentManager.addContentManagerListener(new ContentManagerAdapter() {
       @Override
       public void selectionChanged(final ContentManagerEvent event) {
-        Content content = event.getContent();
-        getSyncPublisher().contentSelected(content == null ? null : getRunContentDescriptorByContent(content), executor);
+        if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
+          Content content = event.getContent();
+          getSyncPublisher().contentSelected(content == null ? null : getRunContentDescriptorByContent(content), executor);
+        }
       }
     });
     myToolwindowIdToContentManagerMap.put(toolWindowId, contentManager);