本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getBounds方法的具体用法?Java TreeItem.getBounds怎么用?Java TreeItem.getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dragOver
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
@Override
public void dragOver(DropTargetEvent event) {
event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
IStructuredSelection structuredSelection = (IStructuredSelection) LocalSelectionTransfer
.getTransfer().getSelection();
if (structuredSelection.size() == 1) {
Object element = structuredSelection.getFirstElement();
if (element instanceof AvroNode) {
AvroNode sourceNode = (AvroNode) element;
TreeItem item = (TreeItem) event.item;
if (item != null) {
AvroNode targetNode = nodeConverter.convertToAvroNode(item.getData());
if (targetNode == sourceNode) {
event.detail = DND.DROP_NONE;
} else {
int tolerance = dropPolicy.getTargetPositionTolerance();
Point pt = schemaViewer.getTreeViewer().getTree().toControl(event.x, event.y);
Rectangle bounds = item.getBounds();
if (pt.y < bounds.y + tolerance) {
position = TargetPosition.BEFORE;
event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
}
else if (pt.y > bounds.y + bounds.height - tolerance) {
position = TargetPosition.AFTER;
event.feedback |= DND.FEEDBACK_INSERT_AFTER;
}
else {
position = TargetPosition.UPON;
event.feedback |= DND.FEEDBACK_SELECT;
}
event.detail = dropPolicy.dragOver(sourceNode, targetNode, position);
}
}
} else {
event.detail = DND.DROP_NONE;
}
}
}