use of com.intellij.ui.awt.RelativePoint in project intellij-community by JetBrains.
the class JBRunnerTabs method processDropOver.
@Override
public void processDropOver(TabInfo over, RelativePoint relativePoint) {
final Point point = relativePoint.getPoint(getComponent());
myShowDropLocation = shouldAddToGlobal(point);
super.processDropOver(over, relativePoint);
for (Map.Entry<TabInfo, TabLabel> entry : myInfo2Label.entrySet()) {
final TabLabel label = entry.getValue();
if (label.getBounds().contains(point) && myDropInfo != entry.getKey()) {
select(entry.getKey(), false);
break;
}
}
}
use of com.intellij.ui.awt.RelativePoint in project intellij-community by JetBrains.
the class RunnerContentUi method detachTo.
@Override
public ActionCallback detachTo(int window, GridCell cell) {
if (myOriginal != null) {
return myOriginal.detachTo(window, cell);
}
RunnerContentUi target = null;
if (window > 0) {
for (RunnerContentUi child : myChildren) {
if (child.myWindow == window) {
target = child;
break;
}
}
}
final GridCellImpl gridCell = (GridCellImpl) cell;
final Content[] contents = gridCell.getContents();
storeDefaultIndices(contents);
for (Content content : contents) {
content.putUserData(RunnerLayout.DROP_INDEX, getStateFor(content).getTab().getIndex());
}
Dimension size = gridCell.getSize();
if (size == null) {
size = JBUI.size(200, 200);
}
final DockableGrid content = new DockableGrid(null, null, size, Arrays.asList(contents), window);
if (target != null) {
target.add(content, null);
} else {
Point location = gridCell.getLocation();
if (location == null) {
location = getComponent().getLocationOnScreen();
}
location.translate(size.width / 2, size.height / 2);
getDockManager().createNewDockContainerFor(content, new RelativePoint(location));
}
return ActionCallback.DONE;
}
use of com.intellij.ui.awt.RelativePoint in project intellij-community by JetBrains.
the class RunnerContentUi method add.
@Override
public void add(@NotNull DockableContent dockable, RelativePoint dropTarget) {
final DockableGrid dockableGrid = (DockableGrid) dockable;
final RunnerContentUi prev = dockableGrid.getRunnerUi();
saveUiState();
final List<Content> contents = dockableGrid.getContents();
final boolean wasRestoring = myOriginal != null && myOriginal.isStateBeingRestored();
setStateIsBeingRestored(true, this);
try {
final Point point = dropTarget != null ? dropTarget.getPoint(myComponent) : null;
boolean hadGrid = !myTabs.shouldAddToGlobal(point);
for (Content content : contents) {
final View view = getStateFor(content);
if (view.isMinimizedInGrid())
continue;
prev.myManager.removeContent(content, false);
myManager.removeContent(content, false);
if (hadGrid && !wasRestoring) {
view.assignTab(getTabFor(getSelectedGrid()));
view.setPlaceInGrid(calcPlaceInGrid(point, myComponent.getSize()));
} else if (contents.size() == 1 && !wasRestoring) {
view.assignTab(null);
view.setPlaceInGrid(myLayoutSettings.getDefaultGridPlace(content));
}
view.setWindow(myWindow);
myManager.addContent(content);
}
} finally {
setStateIsBeingRestored(false, this);
}
saveUiState();
updateTabsUI(true);
}
use of com.intellij.ui.awt.RelativePoint in project intellij-community by JetBrains.
the class VcsCommitInfoBalloon method showCommitDetails.
public void showCommitDetails() {
if (myBalloon == null || !myBalloon.isVisible()) {
createNewCommitInfoBalloon();
myBalloon.show(new RelativePoint(calculateBestPopupLocation()));
}
updateCommitDetails();
}
use of com.intellij.ui.awt.RelativePoint in project intellij-community by JetBrains.
the class AnActionButton method getPreferredPopupPoint.
public final RelativePoint getPreferredPopupPoint() {
Container c = myContextComponent;
ActionToolbar toolbar = null;
while ((c = c.getParent()) != null) {
if (c instanceof JComponent && (toolbar = (ActionToolbar) ((JComponent) c).getClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY)) != null) {
break;
}
}
if (toolbar instanceof JComponent) {
for (Component comp : ((JComponent) toolbar).getComponents()) {
if (comp instanceof ActionButtonComponent) {
if (comp instanceof AnActionHolder) {
if (((AnActionHolder) comp).getAction() == this) {
return new RelativePoint(comp.getParent(), new Point(comp.getX(), comp.getY() + comp.getHeight()));
}
}
}
}
}
return null;
}
Aggregations