Search in sources :

Example 1 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class TestResultsPanel method splitVertically.

private boolean splitVertically() {
    final String windowId = myProperties.getExecutor().getToolWindowId();
    final ToolWindow toolWindow = ToolWindowManager.getInstance(myProperties.getProject()).getToolWindow(windowId);
    boolean splitVertically = false;
    if (toolWindow != null) {
        final ToolWindowAnchor anchor = toolWindow.getAnchor();
        splitVertically = anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT;
    }
    return splitVertically;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor)

Example 2 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class DesktopLayout method setAnchor.

/**
   * Sets new <code>anchor</code> and <code>id</code> for the specified tool window.
   * Also the method properly updates order of all other tool windows.
   *
   * @param newAnchor new anchor
   * @param newOrder  new order
   */
final void setAnchor(@NotNull String id, @NotNull ToolWindowAnchor newAnchor, int newOrder) {
    if (newOrder == -1) {
        // if order isn't defined then the window will the last in the stripe
        newOrder = getMaxOrder(newAnchor) + 1;
    }
    final WindowInfoImpl info = getInfo(id, true);
    final ToolWindowAnchor oldAnchor = info.getAnchor();
    // Shift order to the right in the target stripe.
    final WindowInfoImpl[] infos = getAllInfos(newAnchor);
    for (int i = infos.length - 1; i > -1; i--) {
        final WindowInfoImpl info2 = infos[i];
        if (newOrder <= info2.getOrder()) {
            info2.setOrder(info2.getOrder() + 1);
        }
    }
    // "move" window into the target position
    info.setAnchor(newAnchor);
    info.setOrder(newOrder);
    // Normalize orders in the source and target stripes
    normalizeOrder(getAllInfos(oldAnchor));
    if (oldAnchor != newAnchor) {
        normalizeOrder(getAllInfos(newAnchor));
    }
}
Also used : ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor)

Example 3 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class ToolWindowsPane method getStripeFor.

@Nullable
Stripe getStripeFor(String id) {
    ToolWindow window = myManager.getToolWindow(id);
    if (window == null) {
        return null;
    }
    final ToolWindowAnchor anchor = myManager.getToolWindow(id).getAnchor();
    if (ToolWindowAnchor.TOP == anchor) {
        return myTopStripe;
    }
    if (ToolWindowAnchor.BOTTOM == anchor) {
        return myBottomStripe;
    }
    if (ToolWindowAnchor.LEFT == anchor) {
        return myLeftStripe;
    }
    if (ToolWindowAnchor.RIGHT == anchor) {
        return myRightStripe;
    }
    throw new IllegalArgumentException("Anchor=" + anchor);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class StripeButtonUI method getPreferredSize.

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) {
        //noinspection SuspiciousNameCombination
        return new Dimension(dim.height, dim.width);
    } else {
        return dim;
    }
}
Also used : ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor)

Example 5 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class Stripe method getCachedImage.

private BufferedImage getCachedImage() {
    if (myCachedBg == null) {
        ToolWindowAnchor anchor = getAnchor();
        Rectangle bounds = getBounds();
        BufferedImage bg;
        if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) {
            bg = (BufferedImage) createImage(bounds.width, 50);
            Graphics2D graphics = bg.createGraphics();
            graphics.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 10), bounds.width, 0, new Color(0, 0, 0, 0)));
            graphics.fillRect(0, 0, bounds.width, 50);
            graphics.dispose();
        } else {
            bg = (BufferedImage) createImage(50, bounds.height);
            Graphics2D graphics = bg.createGraphics();
            graphics.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 0), 0, bounds.height, new Color(0, 0, 0, 10)));
            graphics.fillRect(0, 0, 50, bounds.height);
            graphics.dispose();
        }
        myCachedBg = bg;
    }
    return myCachedBg;
}
Also used : ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) BufferedImage(java.awt.image.BufferedImage)

Aggregations

ToolWindowAnchor (com.intellij.openapi.wm.ToolWindowAnchor)13 ToolWindow (com.intellij.openapi.wm.ToolWindow)3 LightToolWindow (com.intellij.designer.LightToolWindow)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 ThreeComponentsSplitter (com.intellij.openapi.ui.ThreeComponentsSplitter)1 ToolWindowType (com.intellij.openapi.wm.ToolWindowType)1 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)1 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)1 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)1 AffineTransform (java.awt.geom.AffineTransform)1 BufferedImage (java.awt.image.BufferedImage)1 Nullable (org.jetbrains.annotations.Nullable)1