use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ActivateToolWindowAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
Project project = getEventProject(e);
if (project == null)
return;
ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
final ToolWindow window = windowManager.getToolWindow(myToolWindowId);
InputEvent event = e.getInputEvent();
Runnable run = null;
if (event instanceof KeyEvent && event.isShiftDown()) {
final Content[] contents = window.getContentManager().getContents();
if (contents.length > 0 && window.getContentManager().getSelectedContent() != contents[0]) {
run = () -> window.getContentManager().setSelectedContent(contents[0], true, true);
}
}
if (windowManager.isEditorComponentActive() || !myToolWindowId.equals(windowManager.getActiveToolWindowId()) || run != null) {
if (run != null && window.isActive()) {
run.run();
} else {
window.activate(run);
}
} else {
windowManager.getToolWindow(myToolWindowId).hide(null);
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ActivateToolWindowAction method update.
public void update(AnActionEvent e) {
Project project = getEventProject(e);
Presentation presentation = e.getPresentation();
if (project == null || project.isDisposed()) {
presentation.setEnabledAndVisible(false);
return;
}
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(myToolWindowId);
if (toolWindow == null) {
presentation.setEnabledAndVisible(false);
} else {
presentation.setVisible(true);
presentation.setEnabled(toolWindow.isAvailable());
updatePresentation(presentation, toolWindow);
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class RemoteServersViewImpl method showDeployment.
@Override
public void showDeployment(@NotNull final ServerConnection<?> connection, @NotNull final String deploymentName) {
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
final ToolWindow toolWindow = toolWindowManager.getToolWindow(getToolWindowId(connection));
if (toolWindow != null) {
toolWindowManager.invokeLater(() -> {
ServersToolWindowContent component = getServersViewComponent(toolWindow);
if (component != null) {
component.select(connection, deploymentName);
}
});
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class PinActiveTabAction method getToolWindowContent.
@Nullable
private static Content getToolWindowContent(@NotNull AnActionEvent e) {
// note to future readers: TW tab "pinned" icon is shown when content.getUserData(TW.SHOW_CONTENT_ICON) is true
ToolWindow window = PlatformDataKeys.TOOL_WINDOW.getData(e.getDataContext());
Content result = window != null ? window.getContentManager().getSelectedContent() : null;
return result != null && result.isPinnable() ? result : null;
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ShowContentAction method update.
@Override
public void update(AnActionEvent e) {
final ToolWindow window = getWindow(e);
e.getPresentation().setEnabledAndVisible(window != null && window.getContentManager().getContentCount() > 1);
e.getPresentation().setText(window == null || window.getContentUiType() == ToolWindowContentUiType.TABBED ? "Show List of Tabs" : "Show List of Views");
}
Aggregations