本文整理汇总了Java中com.intellij.uiDesigner.FormEditingUtil.isDropOnChild方法的典型用法代码示例。如果您正苦于以下问题:Java FormEditingUtil.isDropOnChild方法的具体用法?Java FormEditingUtil.isDropOnChild怎么用?Java FormEditingUtil.isDropOnChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.FormEditingUtil
的用法示例。
在下文中一共展示了FormEditingUtil.isDropOnChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dragOver
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
public void dragOver(DropTargetDragEvent dtde) {
try {
if (myComponentDragObject == null) {
dtde.rejectDrag();
return;
}
final int dx = dtde.getLocation().x - myLastPoint.x;
final int dy = dtde.getLocation().y - myLastPoint.y;
if (myDraggedComponentsCopy != null && myDraggedComponentList != null) {
for (RadComponent aMySelection : myDraggedComponentsCopy) {
aMySelection.shift(dx, dy);
}
}
myLastPoint = dtde.getLocation();
myEditor.getDragLayer().repaint();
ComponentDropLocation location = myGridInsertProcessor.processDragEvent(dtde.getLocation(), myComponentDragObject);
ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
if (!location.canDrop(myComponentDragObject) ||
(myDraggedComponentList != null && FormEditingUtil.isDropOnChild(myDraggedComponentList, location))) {
if (componentTree != null) {
componentTree.setDropTargetComponent(null);
}
dtde.rejectDrag();
}
else {
if (componentTree != null) {
componentTree.setDropTargetComponent(location.getContainer());
}
dtde.acceptDrag(dtde.getDropAction());
}
}
catch (Exception e) {
LOG.error(e);
}
}
示例2: processDrop
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private boolean processDrop(final DraggedComponentList dcl, final Point dropPoint, final int dropAction) {
myEditor.getActiveDecorationLayer().removeFeedback();
final ArrayList<RadComponent> dclComponents = dcl.getComponents();
final int componentCount = dclComponents.size();
ComponentDropLocation location = GridInsertProcessor.getDropLocation(myEditor.getRootContainer(), dropPoint);
if (FormEditingUtil.isDropOnChild(dcl, location)) {
setDraggingState(dcl, false);
return false;
}
if (!location.canDrop(dcl)) {
setDraggingState(dcl, false);
return false;
}
if (!myEditor.ensureEditable()) {
setDraggingState(dcl, false);
return false;
}
List<RadComponent> droppedComponents;
RadContainer[] originalParents = dcl.getOriginalParents();
cancelDrag();
if (dropAction == DnDConstants.ACTION_COPY) {
setDraggingState(dcl, false);
droppedComponents = myDraggedComponentsCopy;
if (droppedComponents == null) {
return false;
}
}
else {
for(int i=0; i<dclComponents.size(); i++) {
LOG.info("Removing component " + dclComponents.get(i).getId() + " with constraints " + dcl.getOriginalConstraints() [i]);
originalParents [i].removeComponent(dclComponents.get(i));
}
droppedComponents = dclComponents;
}
final RadComponent[] components = droppedComponents.toArray(new RadComponent[componentCount]);
final GridConstraints[] originalConstraints = dcl.getOriginalConstraints();
location.processDrop(myEditor, components, originalConstraints, dcl);
if (dropAction == DnDConstants.ACTION_COPY) {
for (RadComponent component : droppedComponents) {
InsertComponentProcessor.createBindingWhenDrop(myEditor, component, false);
}
FormEditingUtil.selectComponents(myEditor, droppedComponents);
}
else {
setDraggingState(dcl, false);
}
for (int i = 0; i < originalConstraints.length; i++) {
if (originalParents[i].getLayoutManager().isGrid()) {
FormEditingUtil.deleteEmptyGridCells(originalParents[i], originalConstraints[i]);
}
}
return true;
}