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(); }
@Override protected void showItem(Item item) { getTree().showItem((TreeItem) item); }
@Override protected void showItem(Item item) { getTree().showItem((TreeItem) item); }
protected void showItem(Item item) { getTree().showItem((TreeItem) item); }
/** * 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 ] ); }
/** * 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]); }
/** * 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]); }
/** * 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]); }
/** * 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); } }
@Override protected boolean scrollCellIntoView(int columnIndex) { item.getParent().showItem(item); if (hasColumns()) { item.getParent() .showColumn(item.getParent().getColumn(columnIndex)); } return true; } }
@Override protected boolean scrollCellIntoView(int columnIndex) { item.getParent().showItem(item); if (hasColumns()) { item.getParent() .showColumn(item.getParent().getColumn(columnIndex)); } return true; } }
protected boolean scrollCellIntoView(int columnIndex) { item.getParent().showItem(item); if( hasColumns() ) { item.getParent().showColumn(item.getParent().getColumn(columnIndex)); } return true; } }
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(); }
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)); } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
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(); }
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); } }