Java Code Examples for com.intellij.openapi.wm.ToolWindowManager#getActiveToolWindowId()

The following examples show how to use com.intellij.openapi.wm.ToolWindowManager#getActiveToolWindowId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseToolWindowToggleAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public final void update(AnActionEvent e) {
  super.update(e);
  Presentation presentation = e.getPresentation();
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();

  if (id == null) {
    presentation.setEnabled(false);
    return;
  }

  ToolWindow window = mgr.getToolWindow(id);

  if (window == null) {
    presentation.setEnabled(false);
    return;
  }

  update(window, presentation);
}
 
Example 2
Source File: ToggleWindowedModeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  super.update(event);
  Presentation presentation = event.getPresentation();
  if (SystemInfo.isMac) {
    presentation.setEnabledAndVisible(false);
    return;
  }
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();
  presentation.setEnabled(id != null && mgr.getToolWindow(id).isAvailable());
}
 
Example 3
Source File: ToggleDockModeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void setSelected(AnActionEvent event, boolean flag) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id = windowManager.getActiveToolWindowId();
  if (id == null) {
    return;
  }
  ToolWindow toolWindow = windowManager.getToolWindow(id);
  ToolWindowType type = toolWindow.getType();
  if (ToolWindowType.DOCKED == type) {
    toolWindow.setType(ToolWindowType.SLIDING, null);
  }
  else if (ToolWindowType.SLIDING == type) {
    toolWindow.setType(ToolWindowType.DOCKED, null);
  }
}
 
Example 4
Source File: ToggleDockModeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void update(AnActionEvent event) {
  super.update(event);
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();
  if (id == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindow toolWindow = mgr.getToolWindow(id);
  presentation.setEnabled(toolWindow.isAvailable() && ToolWindowType.FLOATING != toolWindow.getType());
}
 
Example 5
Source File: ToggleFloatingModeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSelected(AnActionEvent event) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return false;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id = windowManager.getActiveToolWindowId();
  if (id == null) {
    return false;
  }
  return ToolWindowType.FLOATING == windowManager.getToolWindow(id).getType();
}
 
Example 6
Source File: ToggleFloatingModeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  super.update(event);
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();
  presentation.setEnabled(id != null && mgr.getToolWindow(id).isAvailable());
}
 
Example 7
Source File: BaseToolWindowToggleAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final boolean isSelected(AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null || project.isDisposed()) {
    return false;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();
  if (id == null) {
    return false;
  }
  return isSelected(mgr.getToolWindow(id));
}
 
Example 8
Source File: ToggleWindowedModeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSelected(AnActionEvent event) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return false;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id = windowManager.getActiveToolWindowId();
  if (id == null) {
    return false;
  }
  return ToolWindowType.WINDOWED == windowManager.getToolWindow(id).getType();
}
 
Example 9
Source File: ToggleDockModeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isSelected(AnActionEvent event) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return false;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id = windowManager.getActiveToolWindowId();
  if (id == null) {
    return false;
  }
  return ToolWindowType.DOCKED == windowManager.getToolWindow(id).getType();
}