toolwindow header actions api
authorDennis Ushakov <dennis.ushakov@gmail.com>
Fri, 13 Jan 2012 08:51:20 +0000 (12:51 +0400)
committerDennis Ushakov <dennis.ushakov@gmail.com>
Fri, 13 Jan 2012 08:53:35 +0000 (12:53 +0400)
platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/ex/ToolWindowEx.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java

index 8e6000eb5bbb6d996c174893010ab202ceef3f7c..f926ef0f56e79c029e8ff0ab41535251cf33dbc8 100644 (file)
@@ -68,10 +68,9 @@ import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.*;
+import com.intellij.openapi.wm.ex.ToolWindowEx;
 import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter;
 import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
-import com.intellij.openapi.wm.impl.InternalDecorator;
-import com.intellij.openapi.wm.impl.ToolWindowImpl;
 import com.intellij.openapi.wm.impl.content.ToolWindowContentUi;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.file.PsiDirectoryFactory;
@@ -511,8 +510,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
 
   private void updateTitleActions() {
     final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow("Project");
-    if (!(window instanceof ToolWindowImpl)) return;
-    final InternalDecorator decorator = ((ToolWindowImpl)window).getDecorator();
+    if (!(window instanceof ToolWindowEx)) return;
     ScrollFromSourceAction scrollAction = null;
     CollapseAllToolbarAction collapseAction = null;
     for (AnAction action : myActionGroup.getChildren(null)) {
@@ -526,7 +524,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
         myActionGroup.remove(collapseAction);
       }
     }
-    decorator.setTitleActions(new AnAction[] {scrollAction, collapseAction});
+    ((ToolWindowEx)window).setTitleActions(new AnAction[] {scrollAction, collapseAction});
   }
 
   // public for tests
@@ -544,7 +542,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
       myContentManager = toolWindow.getContentManager();
       toolWindow.setContentUiType(ToolWindowContentUiType.getInstance("combo"), null);
       toolWindow.setIcon(IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getToolWindowIconUrl()));
-      ((ToolWindowImpl)toolWindow).getDecorator().setAdditionalGearActions(myActionGroup);
+      ((ToolWindowEx)toolWindow).setAdditionalGearActions(myActionGroup);
       toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
     } else {
       final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
index 373f09bff621e49911863109040bad12aaca8908..815c83552b4956843ac5c4cc65851d5e7f59d809 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.intellij.openapi.wm.ex;
 
+import com.intellij.openapi.actionSystem.ActionGroup;
+import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowType;
 import com.intellij.openapi.wm.impl.InternalDecorator;
@@ -47,6 +49,10 @@ public interface ToolWindowEx extends ToolWindow {
 
   InternalDecorator getDecorator();
 
+  void setAdditionalGearActions(ActionGroup additionalGearActions);
+
+  void setTitleActions(AnAction[] actions);
+
   void setUseLastFocusedOnActivation(boolean focus);
 
   boolean isUseLastFocusedOnActivation();
index 8dad45b8f6ce60a1200f9a5e07f9eb15a7cf2e1b..f6abd3eb539c9b4dc13bac16574c116ff5f9bdb1 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.ide.UiActivity;
 import com.intellij.ide.UiActivityMonitor;
 import com.intellij.ide.impl.ContentManagerWatcher;
 import com.intellij.openapi.actionSystem.ActionGroup;
+import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.components.ServiceManager;
@@ -281,6 +282,16 @@ public final class ToolWindowImpl implements ToolWindowEx {
     return myDecorator;
   }
 
+  @Override
+  public void setAdditionalGearActions(ActionGroup additionalGearActions) {
+    getDecorator().setAdditionalGearActions(additionalGearActions);
+  }
+
+  @Override
+  public void setTitleActions(AnAction[] actions) {
+    getDecorator().setTitleActions(actions);
+  }
+
   public final void setAvailable(final boolean available, final Runnable runnable) {
     ApplicationManager.getApplication().assertIsDispatchThread();
     final Boolean oldAvailable = myAvailable ? Boolean.TRUE : Boolean.FALSE;