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;
}
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));
}
}
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);
}
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;
}
}
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;
}
Aggregations