Java Code Examples for org.eclipse.swt.widgets.TreeItem#getItemCount()
The following examples show how to use
org.eclipse.swt.widgets.TreeItem#getItemCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdvancePropertyDescriptor.java From birt with Eclipse Public License 1.0 | 6 votes |
private void restoreExpandedMemento( TreeItem root, MementoElement memento ) { if ( memento.getKey( ).equals( root.getText( ) ) ) { if ( !root.getExpanded( ) ) viewer.createChildren( root ); if ( root.getItemCount( ) > 0 ) { if ( !root.getExpanded( ) ) root.setExpanded( true ); MementoElement[] children = memento.getChildren( ); for ( int i = 0; i < children.length; i++ ) { MementoElement child = children[i]; int index = ( (Integer) child.getValue( ) ).intValue( ); if ( index >= 0 && index < root.getItemCount( ) ) { TreeItem item = root.getItem( index ); restoreExpandedMemento( item, child ); } } } } }
Example 2
Source File: AdvancePropertyDescriptor.java From birt with Eclipse Public License 1.0 | 6 votes |
private void restoreSelectedMemento( TreeItem root, MementoElement[] selectedPath ) { if ( selectedPath.length <= 1 ) return; for ( int i = 1; i < selectedPath.length; i++ ) { MementoElement element = selectedPath[i]; if ( !root.getExpanded( ) ) { viewer.createChildren( root ); root.setExpanded( true ); } if ( root.getItemCount( ) > ( (Integer) element.getValue( ) ).intValue( ) ) { root = root.getItem( ( (Integer) element.getValue( ) ).intValue( ) ); } else return; } viewer.getTree( ).setSelection( root ); }
Example 3
Source File: ReportPropertySheetPage.java From birt with Eclipse Public License 1.0 | 6 votes |
private void restoreExpandedMemento( TreeItem root, MementoElement memento ) { if ( memento.getKey( ).equals( root.getText( ) ) ) { if ( !root.getExpanded( ) ) viewer.createChildren( root ); if ( root.getItemCount( ) > 0 ) { if ( !root.getExpanded( ) ) root.setExpanded( true ); MementoElement[] children = memento.getChildren( ); for ( int i = 0; i < children.length; i++ ) { MementoElement child = children[i]; int index = ( (Integer) child.getValue( ) ).intValue( ); if ( index >= 0 && index < root.getItemCount( ) ) { TreeItem item = root.getItem( index ); restoreExpandedMemento( item, child ); } } } } }
Example 4
Source File: ReportPropertySheetPage.java From birt with Eclipse Public License 1.0 | 6 votes |
private void restoreSelectedMemento( TreeItem root, MementoElement[] selectedPath ) { if ( selectedPath.length <= 1 ) return; for ( int i = 1; i < selectedPath.length; i++ ) { MementoElement element = selectedPath[i]; if ( !root.getExpanded( ) ) { viewer.createChildren( root ); root.setExpanded( true ); } if ( root.getItemCount( ) > ( (Integer) element.getValue( ) ).intValue( ) ) { root = root.getItem( ( (Integer) element.getValue( ) ).intValue( ) ); } else return; } viewer.getTree( ).setSelection( root ); }
Example 5
Source File: SelectObjectDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void removeEmptyFolders( TreeItem[] treeitems ) { for ( TreeItem item : treeitems ) { if ( item.getImage().equals( GUIResource.getInstance().getImageArrow() ) && item.getItemCount() == 0 ) { item.dispose(); } else { removeEmptyFolders( item.getItems() ); } } }
Example 6
Source File: RobotTreeUtil.java From AndroidRobot with Apache License 2.0 | 5 votes |
public static Vector<IDevice> getDevicesByProject(TreeItem tiProject){ Vector<IDevice> vecDevices = new Vector(); TreeItem tiDevices = getNodeByName(tiProject,"Devices"); for(int j=0;j<tiDevices.getItemCount();j++){ IDevice device = (IDevice)tiDevices.getItem(j).getData("device"); if(null != device) vecDevices.add(device); } return vecDevices; }
Example 7
Source File: TreeThemer.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
protected TreeItem getLastItemRecursively(TreeItem lastItem) { if (lastItem == null) { return null; } int itemCount = lastItem.getItemCount(); if (itemCount == 0 || !lastItem.getExpanded()) { return lastItem; } return getLastItemRecursively(lastItem.getItem(itemCount - 1)); }
Example 8
Source File: ScriptValuesModDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean TreeItemExist( TreeItem itemToCheck, String strItemName ) { boolean bRC = false; if ( itemToCheck.getItemCount() > 0 ) { TreeItem[] items = itemToCheck.getItems(); for ( int i = 0; i < items.length; i++ ) { if ( items[i].getText().equals( strItemName ) ) { return true; } } } return bRC; }
Example 9
Source File: BibtexEntryView.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
private List<TreeItem> getAllItems(TreeItem[] treeItems) { List<TreeItem> ret = new ArrayList<TreeItem>(); for(TreeItem item : treeItems) { ret.add(item); if(item.getItemCount() > 0) ret.addAll(Arrays.asList(item.getItems())); } return ret; }
Example 10
Source File: UserDefinedJavaClassDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public boolean TreeItemExist( TreeItem itemToCheck, String strItemName ) { boolean bRC = false; if ( itemToCheck.getItemCount() > 0 ) { TreeItem[] items = itemToCheck.getItems(); for ( int i = 0; i < items.length; i++ ) { if ( items[i].getText().equals( strItemName ) ) { return true; } } } return bRC; }
Example 11
Source File: SelectObjectDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private int getNrEmptyFolders( TreeItem[] treeitems ) { int retval = 0; for ( TreeItem item : treeitems ) { if ( item.getImage().equals( GUIResource.getInstance().getImageArrow() ) && item.getItemCount() == 0 ) { retval++; } else { retval += getNrEmptyFolders( item.getItems() ); } } return retval; }
Example 12
Source File: SelectObjectDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void expandAllItems( TreeItem[] treeitems, boolean expand ) { for ( TreeItem item : treeitems ) { item.setExpanded( expand ); if ( item.getItemCount() > 0 ) { expandAllItems( item.getItems(), expand ); } } }
Example 13
Source File: GroupDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
private TreeItem getItem( String text ) { TreeItem topNode = levelViewer.getTree( ).getItem( 0 ); do { if ( text.equals( topNode.getData( ) ) ) return topNode; topNode = topNode.getItem( 0 ); } while ( topNode.getItemCount( ) > 0 ); if ( text.equals( topNode.getData( ) ) ) return topNode; else return null; }
Example 14
Source File: ExpressionTreeSupport.java From birt with Eclipse Public License 1.0 | 5 votes |
private void restoreSelectedMemento( TreeItem root, MementoElement[] selectedPath ) { if ( selectedPath.length <= 0 ) return; for ( int i = 0; i < selectedPath.length; i++ ) { MementoElement element = selectedPath[i]; if ( root.getText( ).equals( element.getValue( ) ) ) { continue; } boolean flag = false; for ( int j = 0; j < root.getItemCount( ); j++ ) { if ( root.getItem( j ).getText( ).equals( element.getValue( ) ) ) { root = root.getItem( j ); flag = true; break; } } if ( !flag ) return; } tree.setSelection( root ); }
Example 15
Source File: ExpressionTreeSupport.java From birt with Eclipse Public License 1.0 | 5 votes |
private void restoreExpandedMemento( TreeItem root, MementoElement memento ) { if ( memento.getKey( ).equals( root.getText( ) ) ) { if ( root.getItemCount( ) > 0 ) { if ( !root.getExpanded( ) ) root.setExpanded( true ); MementoElement[] children = memento.getChildren( ); for ( int i = 0; i < children.length; i++ ) { MementoElement child = children[i]; String key = child.getValue( ).toString( ); for ( int j = 0; j < root.getItemCount( ); j++ ) { TreeItem item = root.getItem( j ); if ( item.getText( ).equals( key ) ) { restoreExpandedMemento( item, child ); break; } } } } } }
Example 16
Source File: UserDefinedJavaClassDialog.java From hop with Apache License 2.0 | 5 votes |
public boolean TreeItemExist( TreeItem itemToCheck, String strItemName ) { boolean bRC = false; if ( itemToCheck.getItemCount() > 0 ) { TreeItem[] items = itemToCheck.getItems(); for ( int i = 0; i < items.length; i++ ) { if ( items[ i ].getText().equals( strItemName ) ) { return true; } } } return bRC; }
Example 17
Source File: ScriptValuesModDialog.java From hop with Apache License 2.0 | 5 votes |
public boolean TreeItemExist( TreeItem itemToCheck, String strItemName ) { boolean bRC = false; if ( itemToCheck.getItemCount() > 0 ) { TreeItem[] items = itemToCheck.getItems(); for ( int i = 0; i < items.length; i++ ) { if ( items[ i ].getText().equals( strItemName ) ) { return true; } } } return bRC; }
Example 18
Source File: DatabaseExplorerDialog.java From hop with Apache License 2.0 | 5 votes |
private void expandAllItems( TreeItem[] treeitems, boolean expand ) { for ( TreeItem item : treeitems ) { item.setExpanded( expand ); if ( item.getItemCount() > 0 ) { expandAllItems( item.getItems(), expand ); } } }
Example 19
Source File: ViewerUnti.java From birt with Eclipse Public License 1.0 | 4 votes |
private static void viewTree( TreeItem item, TreeItem root ) { if ( item.getItemCount( ) != 0 ) { if ( item == root ) { System.err.println( ); } if ( item.getExpanded( ) ) { TreeItem[] ti = item.getItems( ); System.err.println( "-" //$NON-NLS-1$ + item.getText( ) + "(" + ti.length + ")" ); //$NON-NLS-1$ //$NON-NLS-2$ for ( int i = 0; i < ti.length; i++ ) { String out = ""; //$NON-NLS-1$ TreeItem parent = item; while ( parent != root ) { TreeItem[] tp = parent.getParentItem( ).getItems( ); if ( parent != tp[tp.length - 1] ) { out = " \u2502" + out; //$NON-NLS-1$ } else { out = " " + out; //$NON-NLS-1$ } parent = parent.getParentItem( ); } if ( i == item.getItemCount( ) - 1 ) { out += " \u2514"; //$NON-NLS-1$ } else { out += " \u251C"; //$NON-NLS-1$ } System.err.print( out ); viewTree( ti[i], root ); } } else System.err.println( "+" + item.getText( ) + "(?)" ); //$NON-NLS-1$ //$NON-NLS-2$ } else System.err.println( item.getText( ) ); }
Example 20
Source File: GroupDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void initDialog( ) { if ( hierarchy != null ) { nameText.setText( hierarchy.getContainer( ).getName( ) ); } else { DimensionHandle dimension = DesignElementFactory.getInstance( ) .newTabularDimension( null ); nameText.setText( dimension.getName( ) ); } if ( dimension != null ) { if ( isTimeType( dimension ) ) { dateButton.setSelection( true ); handleButtonSelection( dateButton ); } else { regularButton.setSelection( true ); handleButtonSelection( regularButton ); } } else { dateButton.setSelection( true ); handleButtonSelection( dateButton ); } if ( dimension != null ) { WidgetUtil.setExcludeGridData( regularButton, true ); WidgetUtil.setExcludeGridData( dateButton, true ); } if ( dimension != null && !isTimeType( dimension ) ) levelViewer.getTree( ).setVisible( false ); levelViewer.setInput( getDateTypeNames( getLevelTypesByDateType( ) ) ); levelViewer.expandAll( ); if ( levelViewer.getTree( ).getItemCount( ) > 0 ) { TreeItem topNode = levelViewer.getTree( ).getItem( 0 ); do { if ( levelList.contains( topNode.getData( ) ) ) topNode.setChecked( true ); topNode = topNode.getItem( 0 ); } while ( topNode.getItemCount( ) > 0 ); if ( levelList.contains( topNode.getData( ) ) ) topNode.setChecked( true ); } checkOKButtonStatus( ); }