本文整理了Java中org.eclipse.swt.widgets.Tree.getTopItem()
方法的一些代码示例,展示了Tree.getTopItem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getTopItem()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getTopItem
[英]Returns the item which is currently at the top of the receiver. This item can change when items are expanded, collapsed, scrolled or new items are added or removed.
[中]返回当前位于接收器顶部的项。当项目展开、折叠、滚动或添加或删除新项目时,此项目可能会更改。
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private static int[] getTreeIndexPath(Tree tree) {
int[] indexPath = null;
if (tree != null) {
TreeItem item = tree.getTopItem();
int count = 1;
while (item != null && (item = item.getParentItem()) != null) {
count++;
}
indexPath = new int[count];
int index = 0;
item = tree.getTopItem();
while (item != null && index < count) {
TreeItem parent = item.getParentItem();
if (parent != null) {
indexPath[index++] = parent.indexOf(item);
} else {
indexPath[index++] = tree.indexOf(item);
}
item = parent;
}
}
return indexPath;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
@Override
public TreePath getTopElementPath() {
TreeItem topItem = ((Tree)getControl()).getTopItem();
if (topItem != null && !topItem.isDisposed() && topItem.getData() != null) {
return getTreePathFromItem(topItem);
}
return null;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
@Override
public void mouseScrolled(MouseEvent e) {
// scroll only when MOD1 is pressed
if ((e.stateMask & SWT.MOD1) == SWT.MOD1 && fTree != null) {
TreeItem item = fTree.getTopItem();
if (item != null) {
TreeItem nextItem = item;
for (int i = 0; i < fSkipLines; i++) {
TreeItem foundItem = null;
if (e.count < 0) // determines scrolling direction
foundItem = NextItem(fTree, nextItem);
else
foundItem = PreviousItem(fTree, nextItem);
if (foundItem == null) {
break;
}
nextItem = foundItem;
}
fTree.setTopItem(nextItem);
}
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
Widget getItem(Tree tree, int x, int y) {
Point point = new Point(x, y);
point = tree.toControl(point);
TreeItem item = tree.getItem(point);
if (item == null) {
Rectangle area = tree.getClientArea();
if (area.contains(point)) {
int treeBottom = area.y + area.height;
item = tree.getTopItem();
while (item != null) {
Rectangle rect = item.getBounds();
int itemBottom = rect.y + rect.height;
if (rect.y <= point.y && point.y < itemBottom) return item;
if (itemBottom > treeBottom) break;
item = nextItem(tree, item);
}
return null;
}
}
return item;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
ViewerCell getInitialFocusCell() {
Tree tree = (Tree) getViewer().getControl();
if (! tree.isDisposed() && tree.getItemCount() > 0 && ! tree.getTopItem().isDisposed()) {
ViewerRow aViewerRow = getViewer().getViewerRowFromItem(tree.getTopItem());
if (tree.getColumnCount() == 0) {
return aViewerRow.getCell(0);
}
Rectangle clientArea = tree.getClientArea();
for (int i = 0; i < tree.getColumnCount(); i++) {
if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i))
return aViewerRow.getCell(i);
}
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
void selectFirstElementInTheArtifactTreeIfNoSelectionHasBeenMade() {
//
// If we have started a new search when focus is passed to the tree viewer we will automatically select
// the first element if no element has been selected from a previous expedition into the tree viewer.
//
if(searchResultViewer.getTree().getItemCount() > 0 && searchResultViewer.getSelection().isEmpty()) {
Object artifact = searchResultViewer.getTree().getTopItem().getData();
searchResultViewer.setSelection(new StructuredSelection(artifact), true);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
ViewerCell getInitialFocusCell() {
Tree tree = (Tree) getViewer().getControl();
if (! tree.isDisposed() && tree.getItemCount() > 0 && ! tree.getTopItem().isDisposed()) {
ViewerRow aViewerRow = getViewer().getViewerRowFromItem(tree.getTopItem());
if (tree.getColumnCount() == 0) {
return aViewerRow.getCell(0);
}
Rectangle clientArea = tree.getClientArea();
for (int i = 0; i < tree.getColumnCount(); i++) {
if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i))
return aViewerRow.getCell(i);
}
}
return null;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
TreeItem item = tree.getItem(pt);
if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
TreeItem currentItem = tree.getTopItem();
TreeItem parentItem = currentItem.getParentItem();
while (parentItem != null) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
TreeItem item = tree.getItem(pt);
if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
TreeItem currentItem = tree.getTopItem();
TreeItem parentItem = currentItem.getParentItem();
while (parentItem != null) {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
TreeItem item = tree.getItem(pt);
if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
TreeItem currentItem = tree.getTopItem();
TreeItem parentItem = currentItem.getParentItem();
while (parentItem != null) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
TreeItem item = tree.getItem(pt);
if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
TreeItem currentItem = tree.getTopItem();
TreeItem parentItem = currentItem.getParentItem();
while (parentItem != null) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
TreeItem item = tree.getItem(pt);
if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
TreeItem currentItem = tree.getTopItem();
TreeItem parentItem = currentItem.getParentItem();
while (parentItem != null) {
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
Rectangle itemRect = tree.getTopItem().getBounds();
TreeItem item = row;
int index = findIndex(tree.getItems(), item);
Rectangle itemRect = tree.getTopItem().getBounds();
TreeItem item = row;
int index = findIndex(tree.getItems(), item);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
Rectangle itemRect = tree.getTopItem().getBounds();
TreeItem item = row;
int index = findIndex(tree.getItems(), item);
Rectangle itemRect = tree.getTopItem().getBounds();
TreeItem item = row;
int index = findIndex(tree.getItems(), item);
代码示例来源:origin: org.codehaus.openxma/xmartclient
if (tree_.getItemCount() > 0) topItem = tree_.getTopItem();
if (topItem != null) {
topKey = item2node(tree_.getTopItem()).key_;
内容来源于网络,如有侵权,请联系作者删除!