List of usage examples for com.intellij.openapi.wm ToolWindowType FLOATING
ToolWindowType FLOATING
To view the source code for com.intellij.openapi.wm ToolWindowType FLOATING.
Click Source Link
From source file:com.android.tools.adtui.workbench.FloatingToolWindow.java
License:Apache License
private ToolWindowEx createToolWindow(@NotNull ToolWindowManager toolWindowManager, @NotNull ToolWindowDefinition<T> definition) { String id = definition.getTitle(); ToolWindowEx window = (ToolWindowEx) toolWindowManager.getToolWindow(id); if (window == null) { ToolWindowAnchor anchor = definition.getSide().isLeft() ? ToolWindowAnchor.LEFT : ToolWindowAnchor.RIGHT; window = (ToolWindowEx) toolWindowManager.registerToolWindow(id, false, anchor, this, true); window.setIcon(definition.getIcon()); window.setType(ToolWindowType.FLOATING, null); window.setAutoHide(false);/*from w w w .j a v a2 s . com*/ setToolWindowContent(window); setAdditionalGearPopupActions(window); setAdditionalActions(window); } return window; }
From source file:com.intellij.codeInsight.documentation.DockablePopupManager.java
License:Apache License
public void createToolWindow(final PsiElement element, PsiElement originalElement) { assert myToolWindow == null; final T component = createComponent(); final ToolWindowManagerEx toolWindowManagerEx = ToolWindowManagerEx.getInstanceEx(myProject); final ToolWindow toolWindow = toolWindowManagerEx.getToolWindow(getToolwindowId()); myToolWindow = toolWindow == null//from w ww.java2 s.co m ? toolWindowManagerEx.registerToolWindow(getToolwindowId(), true, ToolWindowAnchor.RIGHT, myProject) : toolWindow; myToolWindow.setIcon(AllIcons.Toolwindows.Documentation); myToolWindow.setAvailable(true, null); myToolWindow.setToHideOnEmptyContent(false); final Rectangle rectangle = WindowManager.getInstance().getIdeFrame(myProject).suggestChildFrameBounds(); myToolWindow.setDefaultState(ToolWindowAnchor.RIGHT, ToolWindowType.FLOATING, rectangle); final ContentManager contentManager = myToolWindow.getContentManager(); final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final Content content = contentFactory.createContent(component, getTitle(element), false); contentManager.addContent(content); contentManager.addContentManagerListener(new ContentManagerAdapter() { @Override public void contentRemoved(ContentManagerEvent event) { restorePopupBehavior(); } }); new UiNotifyConnector(component, new Activatable() { @Override public void showNotify() { restartAutoUpdate(myAutoUpdateDocumentation); } @Override public void hideNotify() { restartAutoUpdate(false); } }); myToolWindow.show(null); PropertiesComponent.getInstance().setValue(getShowInToolWindowProperty(), Boolean.TRUE.toString()); restartAutoUpdate(PropertiesComponent.getInstance().getBoolean(getAutoUpdateEnabledProperty(), true)); doUpdateComponent(element, originalElement, component); }
From source file:com.intellij.designer.LightToolWindow.java
License:Apache License
private DefaultActionGroup createGearPopupGroup() { DefaultActionGroup group = new DefaultActionGroup(); group.add(myManager.createGearActions()); group.addSeparator();//from w ww. j a v a 2s . c om ToolWindowType type = myManager.getToolWindow().getType(); if (type == ToolWindowType.DOCKED) { group.add(myToggleAutoHideModeAction); group.add(myToggleDockModeAction); group.add(myToggleFloatingModeAction); group.add(myToggleSideModeAction); } else if (type == ToolWindowType.FLOATING) { group.add(myToggleAutoHideModeAction); group.add(myToggleFloatingModeAction); } else if (type == ToolWindowType.SLIDING) { group.add(myToggleDockModeAction); group.add(myToggleFloatingModeAction); } return group; }
From source file:com.intellij.ide.actions.ResizeToolWindowAction.java
License:Apache License
@Override public final void update(AnActionEvent e) { Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); if (project == null) { setDisabled(e);//from w ww . ja v a2s .c o m return; } if (!myListenerInstalled) { myListenerInstalled = true; ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() { @Override public void projectClosed(Project project) { setDisabled(null); } }); } Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (owner == null) { setDisabled(e); return; } final Window windowAncestor = SwingUtilities.getWindowAncestor(owner); if (!(windowAncestor instanceof IdeFrame) || windowAncestor instanceof IdeFrame.Child) { setDisabled(e); return; } ToolWindowManager mgr = ToolWindowManager.getInstance(project); ToolWindow window = myToolWindow; if (window != null || mgr.getActiveToolWindowId() != null) { if (window == null) { window = mgr.getToolWindow(mgr.getActiveToolWindowId()); } if (window == null || !window.isAvailable() || !window.isVisible() || window.getType() == ToolWindowType.FLOATING || !window.isActive()) { setDisabled(e); return; } update(e, window, mgr); if (e.getPresentation().isEnabled()) { myLastWindow = window; myLastManager = mgr; } else { setDisabled(e); } } else { setDisabled(e); } }
From source file:com.intellij.ide.actions.ToggleDockModeAction.java
License:Apache License
public void update(AnActionEvent event) { super.update(event); Presentation presentation = event.getPresentation(); Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); if (project == null) { presentation.setEnabled(false);/* ww w. j ava2 s. c o m*/ 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()); }
From source file:com.intellij.ide.actions.ToggleFloatingModeAction.java
License:Apache License
@Override public boolean isSelected(AnActionEvent event) { Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); if (project == null) { return false; }/*from w ww .j a v a 2 s . c om*/ ToolWindowManager windowManager = ToolWindowManager.getInstance(project); String id = windowManager.getActiveToolWindowId(); if (id == null) { return false; } return ToolWindowType.FLOATING == windowManager.getToolWindow(id).getType(); }
From source file:com.intellij.ide.actions.ToggleFloatingModeAction.java
License:Apache License
@Override public void setSelected(AnActionEvent event, boolean flag) { Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); if (project == null) { return;//from w ww. j a va2 s . c om } String id = ToolWindowManager.getInstance(project).getActiveToolWindowId(); if (id == null) { return; } ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project); ToolWindowEx toolWindow = (ToolWindowEx) mgr.getToolWindow(id); ToolWindowType type = toolWindow.getType(); if (ToolWindowType.FLOATING == type) { toolWindow.setType(toolWindow.getInternalType(), null); } else { toolWindow.setType(ToolWindowType.FLOATING, null); } }