Java 类com.intellij.ui.awt.RelativeRectangle 实例源码

项目:intellij-ce-playground    文件:LayoutTreeComponent.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.setDropPossible(false);
  aEvent.hideHighlighter();
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
    if (parent != null) {
      final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
      final PackagingElementNode node = getNode(parent);
      if (node != null && draggingObject.canDropInto(node)) {
        final PackagingElement element = node.getFirstElement();
        if (element instanceof CompositePackagingElement) {
          draggingObject.setTargetNode(node);
          draggingObject.setTargetElement((CompositePackagingElement<?>)element);
          final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
          aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
          aEvent.setDropPossible(true);
        }
      }
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:FavoritesPanel.java   
private void highlight(FavoritesListNode node, DnDEvent event) {
  if (node != null) {
    TreePath pathToList = myTree.getPath(node);
    while (pathToList != null) {
      final Object pathObj = pathToList.getLastPathComponent();
      if (pathObj instanceof DefaultMutableTreeNode) {
        final Object userObject = ((DefaultMutableTreeNode)pathObj).getUserObject();
        if (userObject instanceof FavoritesTreeNodeDescriptor) {
          if (((FavoritesTreeNodeDescriptor)userObject).getElement() == node) {
            break;
          }
        }
      }
      pathToList = pathToList.getParentPath();
    }
    if (pathToList != null) {
      Rectangle bounds = myTree.getPathBounds(pathToList);
      if (bounds != null) {
        event.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
      }
    }
  }
  else {
    event.hideHighlighter();
  }
}
项目:tools-idea    文件:LayoutTreeComponent.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.setDropPossible(false);
  aEvent.hideHighlighter();
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
    if (parent != null) {
      final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
      final PackagingElementNode node = getNode(parent);
      if (node != null && draggingObject.canDropInto(node)) {
        final PackagingElement element = node.getFirstElement();
        if (element instanceof CompositePackagingElement) {
          draggingObject.setTargetNode(node);
          draggingObject.setTargetElement((CompositePackagingElement<?>)element);
          final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
          aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
          aEvent.setDropPossible(true);
        }
      }
    }
  }
  return false;
}
项目:tools-idea    文件:FavoritesPanel.java   
private void highlight(FavoritesListNode node, DnDEvent event) {
  if (node != null) {
    TreePath pathToList = myTree.getPath(node);
    while (pathToList != null) {
      final Object pathObj = pathToList.getLastPathComponent();
      if (pathObj instanceof DefaultMutableTreeNode) {
        final Object userObject = ((DefaultMutableTreeNode)pathObj).getUserObject();
        if (userObject instanceof FavoritesTreeNodeDescriptor) {
          if (((FavoritesTreeNodeDescriptor)userObject).getElement() == node) {
            break;
          }
        }
      }
      pathToList = pathToList.getParentPath();
    }
    if (pathToList != null) {
      Rectangle bounds = myTree.getPathBounds(pathToList);
      if (bounds != null) {
        event.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
      }
    }
  }
  else {
    event.hideHighlighter();
  }
}
项目:consulo    文件:LayoutTreeComponent.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.setDropPossible(false);
  aEvent.hideHighlighter();
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
    if (parent != null) {
      final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
      final PackagingElementNode node = getNode(parent);
      if (node != null && draggingObject.canDropInto(node)) {
        final PackagingElement element = node.getFirstElement();
        if (element instanceof CompositePackagingElement) {
          draggingObject.setTargetNode(node);
          draggingObject.setTargetElement((CompositePackagingElement<?>)element);
          final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
          aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
          aEvent.setDropPossible(true);
        }
      }
    }
  }
  return false;
}
项目:consulo    文件:FavoritesPanel.java   
private void highlight(FavoritesListNode node, DnDEvent event) {
  if (node != null) {
    TreePath pathToList = myTree.getPath(node);
    while (pathToList != null) {
      final Object pathObj = pathToList.getLastPathComponent();
      if (pathObj instanceof DefaultMutableTreeNode) {
        final Object userObject = ((DefaultMutableTreeNode)pathObj).getUserObject();
        if (userObject instanceof FavoritesTreeNodeDescriptor) {
          if (((FavoritesTreeNodeDescriptor)userObject).getElement() == node) {
            break;
          }
        }
      }
      pathToList = pathToList.getParentPath();
    }
    if (pathToList != null) {
      Rectangle bounds = myTree.getPathBounds(pathToList);
      if (bounds != null) {
        event.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
      }
    }
  }
  else {
    event.hideHighlighter();
  }
}
项目:intellij-ce-playground    文件:JBTabsImpl.java   
@Override
public RelativeRectangle getRectangle() {
  TabLabel label = myInfo2Label.get(myInfo);
  if (label.getRootPane() == null) return null;

  Rectangle b = label.getBounds();
  b.x += 2;
  b.width -= 4;
  b.y += 2;
  b.height -= 4;
  return new RelativeRectangle(label.getParent(), b);
}
项目:intellij-ce-playground    文件:DockManagerImpl.java   
@NotNull
@Override
public DockContainer.ContentResponse getResponse(MouseEvent e) {
  RelativePoint point = new RelativePoint(e);
  for (DockContainer each : myContainers) {
    RelativeRectangle rec = each.getAcceptArea();
    if (rec.contains(point)) {
      DockContainer.ContentResponse response = each.getContentResponse(myContent, point);
      if (response.canAccept()) {
        return response;
      }
    }
  }
  return DockContainer.ContentResponse.DENY;
}
项目:intellij-ce-playground    文件:ChangesListView.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.hideHighlighter();
  aEvent.setDropPossible(false, "");

  Object attached = aEvent.getAttachedObject();
  if (!(attached instanceof ChangeListDragBean)) return false;

  final ChangeListDragBean dragBean = (ChangeListDragBean)attached;
  if (dragBean.getSourceComponent() != ChangesListView.this) return false;
  dragBean.setTargetNode(null);

  RelativePoint dropPoint = aEvent.getRelativePoint();
  Point onTree = dropPoint.getPoint(ChangesListView.this);
  final TreePath dropPath = getPathForLocation(onTree.x, onTree.y);

  if (dropPath == null) return false;

  ChangesBrowserNode dropNode = (ChangesBrowserNode)dropPath.getLastPathComponent();
  while(!((ChangesBrowserNode) dropNode.getParent()).isRoot()) {
    dropNode = (ChangesBrowserNode)dropNode.getParent();
  }

  if (!dropNode.canAcceptDrop(dragBean)) {
    return false;
  }

  final Rectangle tableCellRect = getPathBounds(new TreePath(dropNode.getPath()));
  if (fitsInBounds(tableCellRect)) {
    aEvent.setHighlighting(new RelativeRectangle(ChangesListView.this, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  }

  aEvent.setDropPossible(true);
  dragBean.setTargetNode(dropNode);

  return false;
}
项目:tools-idea    文件:JBTabsImpl.java   
@Override
public RelativeRectangle getRectangle() {
  TabLabel label = myInfo2Label.get(myInfo);
  if (label.getRootPane() == null) return null;

  Rectangle b = label.getBounds();
  b.x += 2;
  b.width -= 4;
  b.y += 2;
  b.height -= 4;
  return new RelativeRectangle(label.getParent(), b);
}
项目:tools-idea    文件:DockManagerImpl.java   
@NotNull
@Override
public DockContainer.ContentResponse getResponse(MouseEvent e) {
  RelativePoint point = new RelativePoint(e);
  for (DockContainer each : myContainers) {
    RelativeRectangle rec = each.getAcceptArea();
    if (rec.contains(point)) {
      DockContainer.ContentResponse response = each.getContentResponse(myContent, point);
      if (response.canAccept()) {
        return response;
      }
    }
  }
  return DockContainer.ContentResponse.DENY;
}
项目:tools-idea    文件:DockManagerImpl.java   
@Nullable
private DockContainer findContainerFor(RelativePoint point, @NotNull DockableContent content) {
  for (DockContainer each : myContainers) {
    RelativeRectangle rec = each.getAcceptArea();
    if (rec.contains(point) && each.getContentResponse(content, point).canAccept()) {
      return each;
    }
  }

  return null;
}
项目:tools-idea    文件:ChangesListView.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.hideHighlighter();
  aEvent.setDropPossible(false, "");

  Object attached = aEvent.getAttachedObject();
  if (!(attached instanceof ChangeListDragBean)) return false;

  final ChangeListDragBean dragBean = (ChangeListDragBean)attached;
  if (dragBean.getSourceComponent() != ChangesListView.this) return false;
  dragBean.setTargetNode(null);

  RelativePoint dropPoint = aEvent.getRelativePoint();
  Point onTree = dropPoint.getPoint(ChangesListView.this);
  final TreePath dropPath = getPathForLocation(onTree.x, onTree.y);

  if (dropPath == null) return false;

  ChangesBrowserNode dropNode = (ChangesBrowserNode)dropPath.getLastPathComponent();
  while(!((ChangesBrowserNode) dropNode.getParent()).isRoot()) {
    dropNode = (ChangesBrowserNode)dropNode.getParent();
  }

  if (!dropNode.canAcceptDrop(dragBean)) {
    return false;
  }

  final Rectangle tableCellRect = getPathBounds(new TreePath(dropNode.getPath()));
  if (fitsInBounds(tableCellRect)) {
    aEvent.setHighlighting(new RelativeRectangle(ChangesListView.this, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  }

  aEvent.setDropPossible(true);
  dragBean.setTargetNode(dropNode);

  return false;
}
项目:consulo    文件:JBTabsImpl.java   
@Override
public RelativeRectangle getRectangle() {
  TabLabel label = myInfo2Label.get(myInfo);
  if (label.getRootPane() == null) return null;

  Rectangle b = label.getBounds();
  b.x += 2;
  b.width -= 4;
  b.y += 2;
  b.height -= 4;
  return new RelativeRectangle(label.getParent(), b);
}
项目:consulo    文件:DockManagerImpl.java   
@Nonnull
@Override
public DockContainer.ContentResponse getResponse(MouseEvent e) {
  RelativePoint point = new RelativePoint(e);
  for (DockContainer each : myContainers) {
    RelativeRectangle rec = each.getAcceptArea();
    if (rec.contains(point)) {
      DockContainer.ContentResponse response = each.getContentResponse(myContent, point);
      if (response.canAccept()) {
        return response;
      }
    }
  }
  return DockContainer.ContentResponse.DENY;
}
项目:consulo    文件:ChangesDnDSupport.java   
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.hideHighlighter();
  aEvent.setDropPossible(false, "");

  Object attached = aEvent.getAttachedObject();
  if (!(attached instanceof ChangeListDragBean)) return false;

  final ChangeListDragBean dragBean = (ChangeListDragBean)attached;
  if (dragBean.getSourceComponent() != myTree) return false;
  dragBean.setTargetNode(null);

  RelativePoint dropPoint = aEvent.getRelativePoint();
  Point onTree = dropPoint.getPoint(myTree);
  final TreePath dropPath = myTree.getPathForLocation(onTree.x, onTree.y);

  if (dropPath == null) return false;

  ChangesBrowserNode dropNode = (ChangesBrowserNode)dropPath.getLastPathComponent();
  while (!((ChangesBrowserNode)dropNode.getParent()).isRoot()) {
    dropNode = (ChangesBrowserNode)dropNode.getParent();
  }

  if (!dropNode.canAcceptDrop(dragBean)) {
    return false;
  }

  final Rectangle tableCellRect = myTree.getPathBounds(new TreePath(dropNode.getPath()));
  if (fitsInBounds(tableCellRect)) {
    aEvent.setHighlighting(new RelativeRectangle(myTree, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  }

  aEvent.setDropPossible(true);
  dragBean.setTargetNode(dropNode);

  return false;
}
项目:intellij-ce-playground    文件:ComboContentLayout.java   
@Override
public RelativeRectangle getRectangleFor(Content content) {
  return null;
}
项目:intellij-ce-playground    文件:ToolWindowContentUi.java   
public RelativeRectangle getRectangle() {
  return myTabsLayout.getRectangleFor(myContent);
}
项目:intellij-ce-playground    文件:TabContentLayout.java   
@Override
public RelativeRectangle getRectangleFor(Content content) {
  ContentTabLabel label = myContent2Tabs.get(content);
  return new RelativeRectangle(label.getParent(), label.getBounds());
}
项目:intellij-ce-playground    文件:DockableEditorTabbedContainer.java   
@Override
public RelativeRectangle getAcceptArea() {
  return new RelativeRectangle(mySplitters);
}
项目:intellij-ce-playground    文件:DockableEditorTabbedContainer.java   
public RelativeRectangle getAcceptAreaFallback() {
  JRootPane root = mySplitters.getRootPane();
  return root != null ? new RelativeRectangle(root) : new RelativeRectangle(mySplitters);
}
项目:intellij-ce-playground    文件:ActionToolbarImpl.java   
@Override
public RelativeRectangle getRectangle() {
  return new RelativeRectangle(myButton.getParent(), myButton.getBounds());
}
项目:intellij-ce-playground    文件:DnDEventImpl.java   
public void setHighlighting(RelativeRectangle rectangle, int aType) {
  getHandlerComponent();
  myManager.showHighlighter(rectangle, aType, this);
  myHighlighting = aType;
}
项目:intellij-ce-playground    文件:DnDEventImpl.java   
public void setHighlighting(JLayeredPane layeredPane, RelativeRectangle rectangle, int aType) {
  myManager.showHighlighter(layeredPane, rectangle, aType, this);
}
项目:intellij-ce-playground    文件:DnDManagerImpl.java   
void showHighlighter(final RelativeRectangle rectangle, final int aType, final DnDEvent aEvent) {
  final JLayeredPane layeredPane = getLayeredPane(rectangle.getPoint().getComponent());
  final Rectangle bounds = rectangle.getRectangleOn(layeredPane);

  showHighlighter(layeredPane, aEvent, bounds, aType);
}
项目:intellij-ce-playground    文件:DnDManagerImpl.java   
void showHighlighter(JLayeredPane layeredPane, final RelativeRectangle rectangle, final int aType, final DnDEvent event) {
  final Rectangle bounds = rectangle.getRectangleOn(layeredPane);
  showHighlighter(layeredPane, event, bounds, aType);
}
项目:intellij-ce-playground    文件:RunnerContentUi.java   
@Override
public RelativeRectangle getAcceptArea() {
  return new RelativeRectangle(myTabs.getComponent());
}
项目:intellij-ce-playground    文件:RunnerContentUi.java   
@Override
public RelativeRectangle getAcceptAreaFallback() {
  return getAcceptArea();
}
项目:intellij-ce-playground    文件:FavoritesTreeViewPanel.java   
@Override
public RelativeRectangle getAcceptArea() {
  return new RelativeRectangle(myTree);
}
项目:intellij-ce-playground    文件:FavoritesTreeViewPanel.java   
@Override
public RelativeRectangle getAcceptAreaFallback() {
  return getAcceptArea();
}
项目:intellij-ce-playground    文件:ProjectViewDropTarget.java   
@Override
public boolean update(DnDEvent event) {
  event.setDropPossible(false, "");

  final Object attached = event.getAttachedObject();
  final int dropAction = event.getAction().getActionId();
  final DropHandler dropHandler = getDropHandler(dropAction);
  final TreeNode[] sourceNodes = getSourceNodes(attached);
  final Point point = event.getPoint();
  final TreeNode targetNode = getTargetNode(point);

  if (targetNode == null ||
      (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0 ||
      sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorAvailable(event) ||
      sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1 ||
      sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) {
    return false;
  }

  if (sourceNodes != null) {
    boolean redundant = true;
    for (TreeNode sourceNode : sourceNodes) {
      if (!dropHandler.isDropRedundant(sourceNode, targetNode)) {
        redundant = false;
        break;
      }
    }
    if (redundant) return false;
  }
  else {
    // it seems like it's not possible to obtain dragged items _before_ accepting _drop_ on Macs, so just skip this check
    if (!SystemInfo.isMac) {
      final PsiFileSystemItem[] psiFiles = getPsiFiles(FileCopyPasteUtil.getFileListFromAttachedObject(attached));
      if (psiFiles == null || psiFiles.length == 0) return false;
      if (!MoveHandler.isValidTarget(getPsiElement(targetNode), psiFiles)) return false;
    }
  }

  final Rectangle pathBounds = myTree.getPathBounds(myTree.getClosestPathForLocation(point.x, point.y));
  if (pathBounds != null && pathBounds.y + pathBounds.height < point.y) return false;
  event.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  event.setDropPossible(true);
  return false;
}
项目:intellij-ce-playground    文件:TerminalView.java   
@Override
public RelativeRectangle getAcceptArea() {
  return new RelativeRectangle(myTerminalToolWindow.getComponent());
}
项目:intellij-ce-playground    文件:TerminalView.java   
@Override
public RelativeRectangle getAcceptAreaFallback() {
  return getAcceptArea();
}
项目:tools-idea    文件:ComboContentLayout.java   
@Override
public RelativeRectangle getRectangleFor(Content content) {
  return null;
}
项目:tools-idea    文件:ToolWindowContentUi.java   
public RelativeRectangle getRectangle() {
  return myTabsLayout.getRectangleFor(myContent);
}
项目:tools-idea    文件:TabContentLayout.java   
@Override
public RelativeRectangle getRectangleFor(Content content) {
  ContentTabLabel label = myContent2Tabs.get(content);
  return new RelativeRectangle(label.getParent(), label.getBounds());
}
项目:tools-idea    文件:DockableEditorTabbedContainer.java   
@Override
public RelativeRectangle getAcceptArea() {
  JRootPane root = mySplitters.getRootPane();
  return root != null ? new RelativeRectangle(root) : new RelativeRectangle(mySplitters);
}
项目:tools-idea    文件:ActionToolbarImpl.java   
@Override
public RelativeRectangle getRectangle() {
  return new RelativeRectangle(myButton.getParent(), myButton.getBounds());
}
项目:tools-idea    文件:DnDEventImpl.java   
public void setHighlighting(RelativeRectangle rectangle, int aType) {
  getHandlerComponent();
  myManager.showHighlighter(rectangle, aType, this);
  myHighlighting = aType;
}
项目:tools-idea    文件:DnDEventImpl.java   
public void setHighlighting(JLayeredPane layeredPane, RelativeRectangle rectangle, int aType) {
  myManager.showHighlighter(layeredPane, rectangle, aType, this);
}