本文整理匯總了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;
}
}
}