List of usage examples for com.intellij.openapi.actionSystem PlatformDataKeys TOOL_WINDOW
DataKey TOOL_WINDOW
To view the source code for com.intellij.openapi.actionSystem PlatformDataKeys TOOL_WINDOW.
Click Source Link
From source file:com.intellij.ide.actions.CloseActiveTabAction.java
License:Apache License
public void actionPerformed(AnActionEvent e) { ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true); boolean processed = false; if (contentManager != null && contentManager.canCloseContents()) { final Content selectedContent = contentManager.getSelectedContent(); if (selectedContent != null && selectedContent.isCloseable()) { contentManager.removeContent(selectedContent, true); processed = true;/* w w w . j a va 2s . com*/ } } if (!processed && contentManager != null) { final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent()); final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context); if (tw != null) { tw.hide(null); } } }
From source file:com.intellij.ide.actions.CloseActiveTabAction.java
License:Apache License
public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true);//from w w w.j a v a 2 s.com presentation.setEnabled(contentManager != null && contentManager.canCloseContents()); if (!presentation.isEnabled() && contentManager != null) { final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent()); presentation.setEnabled(PlatformDataKeys.TOOL_WINDOW.getData(context) != null); } }
From source file:com.intellij.ui.AutoScrollToSourceHandler.java
License:Apache License
private ActionCallback getReady(DataContext context) { ToolWindow toolWindow = PlatformDataKeys.TOOL_WINDOW.getData(context); return toolWindow != null ? toolWindow.getReady(this) : new ActionCallback.Done(); }
From source file:com.intellij.ui.content.tabs.PinToolwindowTabAction.java
License:Apache License
@Nullable private static Content getContextContent(@NotNull AnActionEvent event) { final ToolWindow window = PlatformDataKeys.TOOL_WINDOW.getData(event.getDataContext()); if (window != null) { final ContentManager contentManager = window.getContentManager(); if (contentManager != null) { return contentManager.getSelectedContent(); }/*w w w .ja va2 s. c om*/ } return null; }