org.eclipse.swt.widgets.Tree.showItem()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.eclipse.swt.widgets.Tree.showItem()方法的一些代码示例,展示了Tree.showItem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.showItem()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:showItem

Tree.showItem介绍

[英]Shows the item. If the item is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled and expanded until the item is visible.
[中]显示项目。如果该项已经显示在接收器中,则该方法只返回。否则,项目将滚动并展开,直到项目可见。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

protected void refreshViewAndLog() {
 String[] selectionPath = null;
 TreeItem selectedItem;
 TreeEntry treeEntry = null;
 if ( wTree.getSelectionCount() == 1 ) {
  selectedItem = wTree.getSelection()[ 0 ];
  treeEntry = new TreeEntry( selectedItem );
  selectionPath = ConstUI.getTreeStrings( selectedItem );
 }
 refreshView();
 if ( treeEntry != null ) { // Select the same one again
  TreeItem treeItem = treeEntry.getTreeItem( wTree );
  if ( treeItem == null ) {
   treeItem = TreeUtil.findTreeItem( wTree, selectionPath );
  }
  if ( treeItem != null ) {
   wTree.setSelection( treeItem );
   if ( treeEntry.length < 3 ) {
    wTree.showItem( treeItem );
    treeItemSelected( treeItem );
    treeItem.setExpanded( true );
   }
  }
 }
 showLog();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
protected void showItem(Item item) {
  getTree().showItem((TreeItem) item);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
protected void showItem(Item item) {
  getTree().showItem((TreeItem) item);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

protected void showItem(Item item) {
  getTree().showItem((TreeItem) item);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Shows the selection. If the selection is already showing in the receiver,
 * this method simply returns. Otherwise, the items are scrolled until the
 * selection is visible.
 *
 * @exception SWTException <ul>
 *              <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *              <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *              thread that created the receiver</li>
 *              </ul>
 * @see Tree#showItem(TreeItem)
 */
public void showSelection() {
 checkWidget();
 if( selection.length == 0 ) {
  return;
 }
 showItem( selection[ 0 ] );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showItem(TreeItem)
 */
public void showSelection () {
  checkWidget();
  TreeItem [] items = getSelection ();
  if (items.length != 0 && items [0] != null) showItem (items [0]);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showItem(TreeItem)
 */
public void showSelection () {
  checkWidget();
  TreeItem [] items = getSelection ();
  if (items.length != 0 && items [0] != null) showItem (items [0]);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showItem(TreeItem)
 */
public void showSelection () {
  checkWidget();
  TreeItem [] items = getSelection ();
  if (items.length != 0 && items [0] != null) showItem (items [0]);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showItem(TreeItem)
 */
public void showSelection () {
  checkWidget ();
  checkItems ();
  //TODO - optimize
  TreeItem [] selection = getSelection ();
  if (selection.length > 0) {
    checkData(selection [0]);
    showItem (selection [0], true);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
  protected boolean scrollCellIntoView(int columnIndex) {
    item.getParent().showItem(item);
    if (hasColumns()) {
      item.getParent()
          .showColumn(item.getParent().getColumn(columnIndex));
    }
    return true;
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
  protected boolean scrollCellIntoView(int columnIndex) {
    item.getParent().showItem(item);
    if (hasColumns()) {
      item.getParent()
          .showColumn(item.getParent().getColumn(columnIndex));
    }
    return true;
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

protected boolean scrollCellIntoView(int columnIndex) {
    item.getParent().showItem(item);
    if( hasColumns() ) {
      item.getParent().showColumn(item.getParent().getColumn(columnIndex));    
    }
    return true;
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

private void swt_show() {
  if (swtItem == null) {
    showonSWTItemSet = true;
    return;
  }
  showonSWTItemSet = false;
  if (!swt_build()) {
    return;
  }
  triggerOpenListeners();
  swtItem.getParent().select(swtItem);
  swtItem.getParent().showItem(swtItem);
  super.show();
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void showItem (TreeItem item, boolean scroll) {
  TreeItem parentItem = item.parentItem;
  if (parentItem != null) {
    showItem (parentItem, false);
    if (!parentItem.getExpanded()) {
      parentItem.setExpanded (true);
      Event event = new Event ();
      event.item = parentItem;
      sendEvent (SWT.Expand, event);
    }
  }
  if (scroll) {
    NSOutlineView outlineView = (NSOutlineView) view;
    outlineView.scrollRowToVisible (outlineView.rowForItem (item.handle));
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Selects the first element in the tree which
 * matches the current filter pattern.
 */
protected void selectFirstMatch() {
  Object selectedElement= fTreeViewer.testFindItem(fInitiallySelectedType);
  TreeItem element;
  final Tree tree= fTreeViewer.getTree();
  if (selectedElement instanceof TreeItem)
    element= findElement(new TreeItem[] { (TreeItem)selectedElement });
  else
    element= findElement(tree.getItems());
  if (element != null) {
    tree.setSelection(element);
    tree.showItem(element);
  } else
    fTreeViewer.setSelection(StructuredSelection.EMPTY);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Shows the item.  If the item is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled
 * and expanded until the item is visible.
 *
 * @param item the item to be shown
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the item is null</li>
 *    <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showSelection()
 */
public void showItem (TreeItem item) {
  checkWidget ();
  if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
  if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
  if (item.parent != this) return;
  int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
  showItem (path, true);
  OS.gtk_tree_path_free (path);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Shows the item.  If the item is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled
 * and expanded until the item is visible.
 *
 * @param item the item to be shown
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the item is null</li>
 *    <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Tree#showSelection()
 */
public void showItem (TreeItem item) {
  checkWidget ();
  if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
  if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
  if (item.parent != this) return;
  int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
  showItem (path, true);
  OS.gtk_tree_path_free (path);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Selects the first element in the tree which
 * matches the current filter pattern.
 */
protected void selectFirstMatch() {
  Object selectedElement= fTreeViewer.testFindItem(fInitiallySelectedType);
  TreeItem element;
  final Tree tree= fTreeViewer.getTree();
  if (selectedElement instanceof TreeItem)
    element= findElement(new TreeItem[] { (TreeItem)selectedElement });
  else
    element= findElement(tree.getItems());
  if (element != null) {
    tree.setSelection(element);
    tree.showItem(element);
  } else
    fTreeViewer.setSelection(StructuredSelection.EMPTY);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void selectItems (TreeItem[] items, boolean ignoreDisposed) {
  NSOutlineView outlineView = (NSOutlineView) view;
  NSMutableIndexSet set = (NSMutableIndexSet) new NSMutableIndexSet ().alloc ().init ();
  int length = items.length;
  for (int i=0; i<length; i++) {
    if (items [i] != null) {
      if (items [i].isDisposed ()) {
        if (ignoreDisposed) continue;
        error (SWT.ERROR_INVALID_ARGUMENT);
      }
      TreeItem item = items [i];
      if (!ignoreDisposed) showItem (items [i], false);
      set.addIndex (outlineView.rowForItem (item.handle));
    }
  }
  ignoreSelect = true;
  outlineView.selectRowIndexes (set, false);
  ignoreSelect = false;
  set.release();
}

代码示例来源:origin: org.xworker/xworker_swt

public static void initItemAtTree(Object parentItem, Item item, ActionContext actionContext, Control control){
  TreeItem treeItem = null;
  if(parentItem instanceof Tree){
    treeItem = new TreeItem((Tree) parentItem, SWT.None);
  }else{
    treeItem = new TreeItem((TreeItem) parentItem, SWT.None);
  }
  
  XWorkerTreeUtil.initItem(treeItem, item.thing, actionContext);
  treeItem.setData(item);
  for(Item childItem : item.child){
    initItemAtTree(treeItem, childItem, actionContext, control);
  }
  
  treeItem.setExpanded(true);
  
  if(item.control == control){
    treeItem.getParent().select(treeItem);
    treeItem.getParent().showItem(treeItem);
    actionContext.getScope(0).put("item", item);
  }
}

相关文章

Tree类方法