com.intellij.openapi.wm.ToolWindowAnchor Java Examples
The following examples show how to use
com.intellij.openapi.wm.ToolWindowAnchor.
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: FreelineUtil.java From freeline with BSD 3-Clause "New" or "Revised" License | 7 votes |
private static void processConsole(Project project, ProcessHandler processHandler) { ConsoleView consoleView = FreeUIManager.getInstance(project).getConsoleView(project); consoleView.clear(); consoleView.attachToProcess(processHandler); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow toolWindow; toolWindow = toolWindowManager.getToolWindow(TOOL_ID); // if already exist tool window then show it if (toolWindow != null) { toolWindow.show(null); return; } toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM); toolWindow.setTitle("free...."); toolWindow.setStripeTitle("Free Console"); toolWindow.setShowStripeButton(true); toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW); toolWindow.getContentManager().addContent(new ContentImpl(consoleView.getComponent(), "Build", true)); toolWindow.show(null); }
Example #2
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.addButton(myButton, myComparator); } else { LOG.error("unknown anchor: " + anchor); } validate(); repaint(); } finally { finish(); } }
Example #3
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private void setComponent(@Nullable ToolWindowInternalDecorator d, @Nonnull ToolWindowAnchor anchor, final float weight) { WebToolWindowInternalDecorator decorator = (WebToolWindowInternalDecorator)d; consulo.ui.Component component = decorator == null ? null : decorator.getComponent(); if (ToolWindowAnchor.TOP == anchor) { //myVerticalSplitter.setFirstComponent(component); //myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.LEFT == anchor) { myHorizontalSplitter.setFirstComponent(component); //myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight)); } else if (ToolWindowAnchor.BOTTOM == anchor) { //myVerticalSplitter.setLastComponent(component); //myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.RIGHT == anchor) { myHorizontalSplitter.setSecondComponent(component); //myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight)); } else { //LOG.error("unknown anchor: " + anchor); } }
Example #4
Source File: FindCyclicDependenciesAction.java From needsmoredojo with Apache License 2.0 | 6 votes |
private void updateToolWindow(int count, final Project project, final CyclicDependencyDetector detector) { final int finalCount = count; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ToolWindowManager.getInstance(project).unregisterToolWindow("Find Cyclic AMD Dependencies"); ToolWindow window = ToolWindowManager.getInstance(project).registerToolWindow("Find Cyclic AMD Dependencies", true, ToolWindowAnchor.BOTTOM); window.setTitle("Find Cyclic AMD Dependencies"); window.setDefaultState(ToolWindowAnchor.BOTTOM, ToolWindowType.DOCKED, null); window.show(null); window.activate(null); Map<String, List<String>> incriminatingModules = detector.getIncriminatingModules(); new FindCyclicDependenciesToolWindow().createContent(project, window, incriminatingModules, finalCount); } }); }
Example #5
Source File: DesktopStripePanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public Insets getBorderInsets(Component c) { DesktopStripePanelImpl stripe = (DesktopStripePanelImpl)c; ToolWindowAnchor anchor = stripe.getAnchor(); Insets result = new Insets(0, 0, 0, 0); final int off = UIUtil.isUnderDarcula() ? 1 : 0; if (anchor == ToolWindowAnchor.LEFT) { result.top = 1; result.right = 1 + off; } else if (anchor == ToolWindowAnchor.RIGHT) { result.left = 1 + off; result.top = 1; } else if (anchor == ToolWindowAnchor.TOP) { result.bottom = 0; //result.bottom = 1; result.top = 1; } else { result.top = 1 + off; } return result; }
Example #6
Source File: DesktopStripePanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void paintComponent(final Graphics g) { super.paintComponent(g); if (!myFinishingDrop && isDroppingButton() && myDragButton.getParent() != this) { g.setColor(getBackground().brighter()); g.fillRect(0, 0, getWidth(), getHeight()); } if (UIUtil.isUnderDarcula()) return; ToolWindowAnchor anchor = getAnchor(); g.setColor(new Color(255, 255, 255, 40)); Rectangle r = getBounds(); if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) { g.drawLine(0, 0, 0, r.height); g.drawLine(r.width - 2, 0, r.width - 2, r.height); } else { g.drawLine(0, 1, r.width, 1); g.drawLine(0, r.height - 1, r.width, r.height - 1); } }
Example #7
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
/** * Sets (docks) specified component to the specified anchor. */ private void setComponent(final JComponent component, @Nonnull ToolWindowAnchor anchor, final float weight) { if (ToolWindowAnchor.TOP == anchor) { myVerticalSplitter.setFirstComponent(component); myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.LEFT == anchor) { myHorizontalSplitter.setFirstComponent(component); myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight)); } else if (ToolWindowAnchor.BOTTOM == anchor) { myVerticalSplitter.setLastComponent(component); myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.RIGHT == anchor) { myHorizontalSplitter.setLastComponent(component); myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight)); } else { LOG.error("unknown anchor: " + anchor); } }
Example #8
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private JComponent getComponentAt(@Nonnull ToolWindowAnchor anchor) { if (ToolWindowAnchor.TOP == anchor) { return myVerticalSplitter.getFirstComponent(); } else if (ToolWindowAnchor.LEFT == anchor) { return myHorizontalSplitter.getFirstComponent(); } else if (ToolWindowAnchor.BOTTOM == anchor) { return myVerticalSplitter.getLastComponent(); } else if (ToolWindowAnchor.RIGHT == anchor) { return myHorizontalSplitter.getLastComponent(); } else { LOG.error("unknown anchor: " + anchor); return null; } }
Example #9
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void run() { try { ToolWindowAnchor anchor = myInfo.getAnchor(); JComponent c = getComponentAt(anchor); if (c instanceof Splitter) { Splitter splitter = (Splitter)c; final DesktopInternalDecorator component = myInfo.isSplit() ? (DesktopInternalDecorator)splitter.getFirstComponent() : (DesktopInternalDecorator)splitter.getSecondComponent(); if (myInfo.isSplit() && component != null) { myId2SplitProportion.put(component.getWindowInfo().getId(), splitter.getProportion()); } setComponent(component, anchor, component != null ? component.getWindowInfo().getWeight() : 0); } else { setComponent(null, anchor, 0); } if (!myDirtyMode) { myLayeredPane.validate(); myLayeredPane.repaint(); } } finally { finish(); } }
Example #10
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.addButton(myButton, myComparator); } else { LOGGER.error("unknown anchor: " + anchor); } getVaadinComponent().markAsDirtyRecursive(); } finally { finish(); } }
Example #11
Source File: StripeTabPanel.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @RequiredUIAccess public TabInfo addTab(@Nonnull String tabName, @Nonnull JComponent component, @Nullable JComponent preferredFocusableComponent) { StaticAnchoredButton button = new StaticAnchoredButton(tabName, ToolWindowAnchor.LEFT); button.addItemListener(myItemListener); button.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); button.setBackground(new Color(247, 243, 239)); button.setUI((ButtonUI)DesktopStripeButtonUI.createUI(button)); myTabPanel.add(button); TabInfo tabInfo = new TabInfo(button, component, preferredFocusableComponent); button.putClientProperty(TabInfo.class, tabInfo); myButtonGroup.add(button); myContentPanel.add(component, tabName); if(myButtonGroup.getSelection() == null) { tabInfo.select(); } return tabInfo; }
Example #12
Source File: DependenciesAnalyzeManager.java From consulo with Apache License 2.0 | 6 votes |
@Inject public DependenciesAnalyzeManager(final Project project, StartupManager startupManager) { myProject = project; startupManager.runWhenProjectIsInitialized(new Runnable() { @Override public void run() { ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.MODULES_DEPENDENCIES, true, ToolWindowAnchor.RIGHT, project); myContentManager = toolWindow.getContentManager(); toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowModuleDependencies); new ContentManagerWatcher(toolWindow, myContentManager); } }); }
Example #13
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.removeButton(myButton); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.removeButton(myButton); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.removeButton(myButton); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.removeButton(myButton); } else { LOG.error("unknown anchor: " + anchor); } validate(); repaint(); } finally { finish(); } }
Example #14
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 6 votes |
/** * Copies itself from the passed * * @param layout to be copied. */ public final void copyFrom(@Nonnull ToolWindowLayout layout) { for (WindowInfoImpl info1 : layout.getAllInfos()) { WindowInfoImpl info = myRegisteredId2Info.get(info1.getId()); if (info != null) { info.copyFrom(info1); continue; } info = myUnregisteredId2Info.get(info1.getId()); if (info != null) { info.copyFrom(info1); } else { myUnregisteredId2Info.put(info1.getId(), info1.copy()); } } // invalidate caches myRegisteredInfos = null; myUnregisteredInfos = null; myAllInfos = null; // normalize orders normalizeOrder(getAllInfos(ToolWindowAnchor.TOP)); normalizeOrder(getAllInfos(ToolWindowAnchor.LEFT)); normalizeOrder(getAllInfos(ToolWindowAnchor.BOTTOM)); normalizeOrder(getAllInfos(ToolWindowAnchor.RIGHT)); }
Example #15
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 6 votes |
/** * Creates or gets <code>WindowInfo</code> for the specified <code>id</code>. If tool * window is being registered first time the method uses <code>anchor</code>. * * @param id <code>id</code> of tool window to be registered. * @param anchor the default tool window anchor. */ public final WindowInfoImpl register(@Nonnull String id, @Nonnull ToolWindowAnchor anchor, final boolean splitMode) { WindowInfoImpl info = myUnregisteredId2Info.get(id); if (info != null) { // tool window has been already registered some time myUnregisteredId2Info.remove(id); } else { // tool window is being registered first time info = new WindowInfoImpl(id); info.setAnchor(anchor); info.setSplit(splitMode); } myRegisteredId2Info.put(id, info); // invalidate caches myRegisteredInfos = null; myUnregisteredInfos = null; myAllInfos = null; // return info; }
Example #16
Source File: DesktopStripeButtonUI.java From consulo with Apache License 2.0 | 6 votes |
@Override public Dimension getPreferredSize(final JComponent c) { final AnchoredButton button = (AnchoredButton)c; final Dimension dim = super.getPreferredSize(button); dim.width = (int)(JBUI.scale(4) + dim.width * 1.1f); dim.height += JBUI.scale(2); final ToolWindowAnchor anchor = button.getAnchor(); if (ToolWindowAnchor.LEFT == anchor || ToolWindowAnchor.RIGHT == anchor) { return new Dimension(dim.height, dim.width); } else { return dim; } }
Example #17
Source File: MessageViewImpl.java From consulo with Apache License 2.0 | 6 votes |
@Inject public MessageViewImpl(final Project project, final StartupManager startupManager, final ToolWindowManager toolWindowManager) { final Runnable runnable = new Runnable() { @Override public void run() { myToolWindow = toolWindowManager.registerToolWindow(ToolWindowId.MESSAGES_WINDOW, true, ToolWindowAnchor.BOTTOM, project, true); myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowMessages); new ContentManagerWatcher(myToolWindow, getContentManager()); for (Runnable postponedRunnable : myPostponedRunnables) { postponedRunnable.run(); } myPostponedRunnables.clear(); } }; if (project.isInitialized()) { runnable.run(); } else { startupManager.registerPostStartupActivity(runnable::run); } }
Example #18
Source File: LightToolWindowManager.java From consulo with Apache License 2.0 | 6 votes |
final void setEditorMode(@Nullable ToolWindowAnchor newState) { ToolWindowAnchor oldState = getEditorMode(); myPropertiesComponent.setValue(myEditorModeKey, newState == null ? "ToolWindow" : newState.toString()); if (oldState != null && newState != null) { runUpdateContent(myUpdateAnchorAction); } else if (newState != null) { removeListeners(); updateToolWindow(null); runUpdateContent(myCreateAction); } else { runUpdateContent(myDisposeAction); initListeners(); bindToDesigner(getActiveDesigner()); } }
Example #19
Source File: DependenciesToolWindow.java From consulo with Apache License 2.0 | 6 votes |
@Inject public DependenciesToolWindow(final Project project, StartupManager startupManager) { myProject = project; startupManager.runWhenProjectIsInitialized(new Runnable() { @Override public void run() { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); if (toolWindowManager == null) return; ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.DEPENDENCIES, true, ToolWindowAnchor.BOTTOM, project); myContentManager = toolWindow.getContentManager(); toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowInspection); new ContentManagerWatcher(toolWindow, myContentManager); } }); }
Example #20
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 5 votes |
/** * @return all (registered and not unregistered) <code>WindowInfos</code> for the specified <code>anchor</code>. * Returned infos are sorted by order. */ @Nonnull private WindowInfoImpl[] getAllInfos(@Nonnull ToolWindowAnchor anchor) { WindowInfoImpl[] infos = getAllInfos(); final ArrayList<WindowInfoImpl> list = new ArrayList<>(infos.length); for (WindowInfoImpl info : infos) { if (anchor == info.getAnchor()) { list.add(info); } } infos = list.toArray(new WindowInfoImpl[list.size()]); Arrays.sort(infos, ourWindowInfoComparator); return infos; }
Example #21
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); setComponent(myComponent, anchor, WindowInfoImpl.normalizeWeigh(myInfo.getWeight())); if (!myDirtyMode) { myLayeredPane.validate(); myLayeredPane.repaint(); } } finally { finish(); } }
Example #22
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
private WindowInfoImpl getDockedInfoAt(@Nonnull ToolWindowAnchor anchor, boolean side) { for (WindowInfoImpl info : myDecorator2Info.values()) { if (info.isVisible() && info.isDocked() && info.getAnchor() == anchor && side == info.isSplit()) { return info; } } return null; }
Example #23
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 5 votes |
/** * @param anchor anchor of the stripe. * @return maximum ordinal number in the specified stripe. Returns <code>-1</code> * if there is no any tool window with the specified anchor. */ private int getMaxOrder(@Nonnull ToolWindowAnchor anchor) { int res = -1; final WindowInfoImpl[] infos = getAllInfos(); for (final WindowInfoImpl info : infos) { if (anchor == info.getAnchor() && res < info.getOrder()) { res = info.getOrder(); } } return res; }
Example #24
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
private void stretch(@Nonnull ToolWindow wnd, int value) { Pair<Resizer, Component> pair = findResizerAndComponent(wnd); if (pair == null) return; boolean vertical = wnd.getAnchor() == ToolWindowAnchor.TOP || wnd.getAnchor() == ToolWindowAnchor.BOTTOM; int actualSize = (vertical ? pair.second.getHeight() : pair.second.getWidth()) + value; boolean first = wnd.getAnchor() == ToolWindowAnchor.LEFT || wnd.getAnchor() == ToolWindowAnchor.TOP; int maxValue = vertical ? myVerticalSplitter.getMaxSize(first) : myHorizontalSplitter.getMaxSize(first); int minValue = vertical ? myVerticalSplitter.getMinSize(first) : myHorizontalSplitter.getMinSize(first); pair.first.setSize(Math.max(minValue, Math.min(maxValue, actualSize))); }
Example #25
Source File: ToggleEditorModeAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void setSelected(AnActionEvent e, boolean state) { if (state) { myManager.setEditorMode(myAnchor); LightToolWindowManager manager = getOppositeManager(); if (manager.getEditorMode() == myAnchor) { manager.setEditorMode(myAnchor == ToolWindowAnchor.LEFT ? ToolWindowAnchor.RIGHT : ToolWindowAnchor.LEFT); } } else { myManager.setEditorMode(null); } }
Example #26
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public List<String> getVisibleIdsOn(@Nonnull ToolWindowAnchor anchor, @Nonnull ToolWindowManager manager) { List<String> ids = new ArrayList<>(); for (WindowInfoImpl each : getAllInfos(anchor)) { final ToolWindow window = manager.getToolWindow(each.getId()); if (window == null) continue; if (window.isAvailable() || UISettings.getInstance().ALWAYS_SHOW_WINDOW_BUTTONS) { ids.add(each.getId()); } } return ids; }
Example #27
Source File: HierarchyBrowserManager.java From consulo with Apache License 2.0 | 5 votes |
@Inject public HierarchyBrowserManager(final Project project) { final ToolWindowManager toolWindowManager=ToolWindowManager.getInstance(project); final ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.HIERARCHY, true, ToolWindowAnchor.RIGHT, project); myContentManager = toolWindow.getContentManager(); toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowHierarchy); new ContentManagerWatcher(toolWindow,myContentManager); }
Example #28
Source File: DesktopStripeButton.java From consulo with Apache License 2.0 | 5 votes |
private boolean is(boolean first) { Container parent = getParent(); if (parent == null) return false; int max = first ? Integer.MAX_VALUE : 0; ToolWindowAnchor anchor = getAnchor(); Component c = null; int count = parent.getComponentCount(); for (int i = 0; i < count; i++) { Component component = parent.getComponent(i); if (!component.isVisible()) continue; Rectangle r = component.getBounds(); if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) { if (first && max > r.y || !first && max < r.y) { max = r.y; c = component; } } else { if (first && max > r.x || !first && max < r.x) { max = r.x; c = component; } } } return c == this; }
Example #29
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); setComponent(myDecorator, anchor, WindowInfoImpl.normalizeWeigh(myInfo.getWeight())); } finally { finish(); } }
Example #30
Source File: BPMNPaletteToolWindowManager.java From intellij-bpmn-editor with GNU General Public License v3.0 | 5 votes |
protected void initToolWindow() { toolWindow = ToolWindowManager.getInstance(myProject) .registerToolWindow("BPMN Palette", false, ToolWindowAnchor.RIGHT, myProject, true); toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette); ContentManager contentManager = toolWindow.getContentManager(); Content content = contentManager.getFactory().createContent(palette, null, false); content.setCloseable(false); content.setPreferredFocusableComponent(palette); contentManager.addContent(content); contentManager.setSelectedContent(content, true); toolWindow.setAvailable(false, null); }