/** * Removes all of the items from the receiver. * <p> * @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> * * @since 3.1 */ public void removeAll () { checkWidget (); parent.setItemCount (this, 0); }
/** * Sets the number of root-level items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); setItemCount (0, count); }
/** * Sets the number of child items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); parent.setItemCount (this, count); }
/** * Sets the number of child items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); parent.setItemCount (handle, count); }
/** * Sets the number of root-level items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); setItemCount (0, count); }
/** * Sets the number of child items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); parent.setItemCount (handle, count); }
/** * Sets the number of child items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); parent.setItemCount (handle, count); }
/** * Sets the number of root-level items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); setItemCount (0, count); }
/** * Sets the number of child items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); int /*long*/ hwnd = parent.handle; int /*long*/ hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle); parent.setItemCount (count, handle, hItem); }
/** * Sets the number of root-level items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); count = Math.max (0, count); int /*long*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); setItemCount (count, OS.TVGN_ROOT, hItem); }
/** * Sets the number of root-level items contained in the receiver. * * @param count the number of items * * @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> * * @since 3.2 */ public void setItemCount (int count) { checkWidget (); checkItems (); count = Math.max (0, count); setItemCount (null, count); }
public void run() { if (internalIsInputOrEmptyPath(elementOrTreePath)) { getTree().setItemCount(count); return; } Widget[] items = internalFindItems(elementOrTreePath); for (int i = 0; i < items.length; i++) { TreeItem treeItem = (TreeItem) items[i]; treeItem.setItemCount(count); } } });
@Override public void run() { treeViewer.getTree().setRedraw( false ); treeViewer.getTree().setItemCount( repositories.size() ); treeViewer.refresh(); if ( unitMatcher != null ) { treeViewer.expandAll(); } treeViewer.getTree().setRedraw( true ); } } );
protected void internalAdd(Widget widget, Object parentElement, Object[] childElements) { if (contentProviderIsLazy) { if (widget instanceof TreeItem) { TreeItem ti = (TreeItem) widget; int count = ti.getItemCount() + childElements.length; ti.setItemCount(count); ti.clearAll(false); } else { Tree t = (Tree) widget; t.setItemCount(t.getItemCount() + childElements.length); t.clearAll(false); } return; } super.internalAdd(widget, parentElement, childElements); }
@Override protected void internalAdd(Widget widget, Object parentElement, Object[] childElements) { if (contentProviderIsLazy) { if (widget instanceof TreeItem) { TreeItem ti = (TreeItem) widget; int count = ti.getItemCount() + childElements.length; ti.setItemCount(count); ti.clearAll(false); } else { Tree t = (Tree) widget; t.setItemCount(t.getItemCount() + childElements.length); t.clearAll(false); } return; } super.internalAdd(widget, parentElement, childElements); }
@Override protected void internalAdd(Widget widget, Object parentElement, Object[] childElements) { if (contentProviderIsLazy) { if (widget instanceof TreeItem) { TreeItem ti = (TreeItem) widget; int count = ti.getItemCount() + childElements.length; ti.setItemCount(count); ti.clearAll(false); } else { Tree t = (Tree) widget; t.setItemCount(t.getItemCount() + childElements.length); t.clearAll(false); } return; } super.internalAdd(widget, parentElement, childElements); }
void setDependencyTree( InstallableUnitDependencyTree dependencyTree ) { hierarchyTreeViewer.getTree().setRedraw( false ); hierarchyTreeViewer.setInput( dependencyTree ); hierarchyTreeViewer.getTree().setItemCount( dependencyTree.getRootIncludedInstallableUnits().size() ); hierarchyTreeViewer.refresh(); if ( dependencyTree.size() < 100 ) { hierarchyTreeViewer.expandAll(); } else { hierarchyTreeViewer.expandToLevel( 2 ); } hierarchyTreeViewer.getTree().setRedraw( true ); }
/** * For a TreeViewer with a tree with the VIRTUAL style bit set, set the * number of children of the given element or tree path. To set the number * of children of the invisible root of the tree, you can pass the input * object or an empty tree path. * * @param elementOrTreePath * the element, or tree path * @param count * * @since 3.2 */ public void setChildCount(final Object elementOrTreePath, final int count) { if (checkBusy()) return; preservingSelection(() -> { if (internalIsInputOrEmptyPath(elementOrTreePath)) { getTree().setItemCount(count); return; } Widget[] items = internalFindItems(elementOrTreePath); for (Widget item : items) { TreeItem treeItem = (TreeItem) item; treeItem.setItemCount(count); } }); }
/** * For a TreeViewer with a tree with the VIRTUAL style bit set, set the * number of children of the given element or tree path. To set the number * of children of the invisible root of the tree, you can pass the input * object or an empty tree path. * * @param elementOrTreePath * the element, or tree path * @param count * * @since 3.2 */ public void setChildCount(final Object elementOrTreePath, final int count) { if (checkBusy()) return; preservingSelection(() -> { if (internalIsInputOrEmptyPath(elementOrTreePath)) { getTree().setItemCount(count); return; } Widget[] items = internalFindItems(elementOrTreePath); for (Widget item : items) { TreeItem treeItem = (TreeItem) item; treeItem.setItemCount(count); } }); }
/** * Traverses the visible (expanded) part of the tree and updates child * counts. * * @param parent the parent of the widget, or <code>null</code> if the widget is the tree * @param widget * @param element * @param index the index of the widget in the children array of its parent, or 0 if the widget is the tree */ private void virtualRefreshExpandedItems(Widget parent, Widget widget, Object element, int index) { if (widget instanceof Tree) { if (element == null) { ((Tree) widget).setItemCount(0); return; } virtualLazyUpdateChildCount(widget, getChildren(widget).length); } else if (((TreeItem) widget).getExpanded()) { // prevent SetData callback ((TreeItem)widget).setText(" "); //$NON-NLS-1$ virtualLazyUpdateWidget(parent, index); } else { return; } Item[] items = getChildren(widget); for (int i = 0; i < items.length; i++) { Item item = items[i]; Object data = item.getData(); virtualRefreshExpandedItems(widget, item, data, i); } }