Java Code Examples for org.eclipse.swt.widgets.TreeItem#getItems()
The following examples show how to use
org.eclipse.swt.widgets.TreeItem#getItems() .
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: ConstUi.java From hop with Apache License 2.0 | 6 votes |
private static final TreeItem findTreeItem( TreeItem grandParent, TreeItem parent, String parentName, String name ) { if ( Utils.isEmpty( parentName ) ) { if ( parent.getText().equalsIgnoreCase( name ) ) { return parent; } } else { if ( grandParent != null && grandParent.getText().equalsIgnoreCase( parentName ) && parent.getText().equalsIgnoreCase( name ) ) { return parent; } } TreeItem[] ti = parent.getItems(); for ( int i = 0; i < ti.length; i++ ) { TreeItem child = findTreeItem( parent, ti[ i ], parentName, name ); if ( child != null ) { return child; } } return null; }
Example 2
Source File: XViewerTreeReport.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void addRow(TreeItem item, List<String[]> rowData, IXViewerLabelProvider labelProv, List<XViewerColumn> showCols, int level) throws XViewerException { List<String> cellData = new ArrayList<>(showCols.size()); boolean firstCell = true; for (XViewerColumn xCol : showCols) { StringBuilder str = new StringBuilder(); if (firstCell) { for (int y = 1; y < level; y++) { str.append("__INSERT_TAB_HERE__"); //$NON-NLS-1$ } firstCell = false; } str.append(labelProv.getColumnText(item.getData(), xColToColumnIndex.get(xCol))); String html = HtmlUtil.textToHtml(str.toString()); html = html.replaceAll("__INSERT_TAB_HERE__", " "); //$NON-NLS-1$ //$NON-NLS-2$ cellData.add(html); } rowData.add(cellData.toArray(new String[cellData.size()])); if (item.getExpanded()) { for (TreeItem i : item.getItems()) { addRow(i, rowData, labelProv, showCols, level + 1); } } }
Example 3
Source File: FeedbackInfo.java From Rel with Apache License 2.0 | 6 votes |
private void emitTreeItems(StringBuffer out, int tabCount, TreeItem tree) { if (tree == null || !hasCheckOrCheckedChildren(tree)) return; emitChar(out, tabCount, '\t'); if (tree.getItemCount() == 0) { emitOpenTag(out, "data"); out.append(strXMLEncode(tree.getText()).replace("\n", "\n" + repeatChar(tabCount, '\t'))); emitCloseTag(out, "data"); } else { String tagName = tree.getText().replace(' ', '_'); emitOpenTag(out, tagName); out.append('\n'); for (TreeItem child: tree.getItems()) emitTreeItems(out, tabCount + 1, child); emitChar(out, tabCount, '\t'); emitCloseTag(out, tagName); } out.append('\n'); }
Example 4
Source File: BTEditor.java From jbt with Apache License 2.0 | 5 votes |
/** * Clears the error color from all the nodes of the tree whose root element * is <code>item</code>. */ private void internalClearErrorColors(TreeItem item) { item.setBackground(null); for (TreeItem child : item.getItems()) { internalClearErrorColors(child); } }
Example 5
Source File: RemoveFromViewAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Checks whether the children are being fetched for a node recursively. * * @param item the parent node * @return <code>false</code> when children are currently being fetched for a node, * <code>true</code> otherwise */ private boolean checkForChildren(TreeItem item) { TreeItem[] children= item.getItems(); if (children.length == 1) { Object data= children[0].getData(); if (!(data instanceof MethodWrapper) && data != null) return false; // Do not add action if children are still being fetched for that node or if it's only JFace's dummy node. } for (int i= 0; i < children.length; i++) { if (!checkForChildren(children[i])) return false; } return true; }
Example 6
Source File: GlobalRefreshResourceSelectionPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void collectCheckedItems(TreeItem item, List checked) { if(item.getChecked() && !item.getGrayed()) { checked.add(item.getData()); } else if(item.getGrayed()) { TreeItem[] children = item.getItems(); for (int i = 0; i < children.length; i++) { TreeItem child = children[i]; collectCheckedItems(child, checked); } } }
Example 7
Source File: CapabilitySection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Gets the all feat item. * * @param editItem the edit item * @return the all feat item */ private TreeItem getAllFeatItem(TreeItem editItem) { TreeItem[] subItems = editItem.getItems(); if (null == subItems || subItems.length == 0) return null; TreeItem item = subItems[0]; if (ALL_FEATURES.equals(item.getText(NAME_COL))) return item; return null; }
Example 8
Source File: ExpressionTreeSupport.java From birt with Eclipse Public License 1.0 | 5 votes |
private void clearSubTreeItem( TreeItem treeItem ) { if ( treeItem == null || treeItem.isDisposed( ) ) { return; } TreeItem[] items = treeItem.getItems( ); for ( int i = 0; i < items.length; i++ ) { clearTreeItem( items[i] ); } }
Example 9
Source File: FeedbackDialog.java From Rel with Apache License 2.0 | 5 votes |
protected void checkItems(TreeItem item, boolean checked) { item.setGrayed(false); item.setChecked(checked); TreeItem[] items = item.getItems(); for (int i = 0; i < items.length; i++) { checkItems(items[i], checked); } }
Example 10
Source File: CapabilitySection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Handle add lang. * * @param selItem the sel item * @param itemKind the item kind */ private void handleAddLang(TreeItem selItem, int itemKind) { if (itemKind == CS) selItem = selItem.getItems()[0]; // lang is 1st item in capability set else if (itemKind == LANG_ITEM) selItem = selItem.getParentItem(); else if (itemKind == TYPE || itemKind == SOFA) selItem = selItem.getParentItem().getItems()[0]; else if (itemKind == FEAT || itemKind == SOFA_ITEM) selItem = selItem.getParentItem().getParentItem().getItems()[0]; Capability c = getCapabilityFromTreeItem(selItem.getParentItem()); CommonInputDialog dialog = new CommonInputDialog( this, "Add Language", "Enter a two letter ISO-639 language code, followed optionally by a two-letter ISO-3166 country code (Examples: fr or fr-CA)", CommonInputDialog.LANGUAGE); if (dialogForLanguage(c, dialog) == Window.CANCEL) return; c.setLanguagesSupported(stringArrayAdd(c.getLanguagesSupported(), dialog.getValue())); // update GUI TreeItem lItem = new TreeItem(selItem, SWT.NONE); lItem.setData(LANG_TITLE); lItem.setText(NAME_COL, dialog.getValue()); selItem.setExpanded(true); pack04(); finishAction(); }
Example 11
Source File: SeriesSheetImpl.java From birt with Eclipse Public License 1.0 | 5 votes |
private void switchTo( int index ) { TreeItem currentItem = getParentTask( ).getNavigatorTree( ) .getSelection( )[0]; TreeItem[] children = currentItem.getItems( ); if ( index < children.length ) { // Switch to specified subtask getParentTask( ).switchToTreeItem( children[index] ); } }
Example 12
Source File: CapabilitySection.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override public void refresh() { super.refresh(); sofaMapSection = editor.getCapabilityPage().getSofaMapSection(); tt.getParent().setRedraw(false); tt.removeAll(); Capability[] cs = getCapabilities(); if (null != cs) { for (int i = 0; i < cs.length; i++) { TreeItem item = new TreeItem(tt, SWT.NONE); item.setText(TITLE_COL, CAPABILITY_SET); item.setData(cs[i]); tt.setSelection( item ); // set default selection fillCapability(item, cs[i]); // if (0 == i) { item.setExpanded(true); TreeItem[] types = item.getItems(); if (types != null) for (int j = 0; j < types.length; j++) { types[j].setExpanded(true); } // } } } packTree(tt); enable(); tt.getParent().setRedraw(true); }
Example 13
Source File: IndentGuidePreferencePage.java From IndentGuide with MIT License | 5 votes |
private void checkContentType(final TreeItem item, final String[] types) { for (final TreeItem child : item.getItems()) { checkContentType(child, types); } final String id = (String) item.getData(); for (final String type : types) { if (id.equals(type)) { item.setChecked(true); break; } } }
Example 14
Source File: RelPanel.java From Rel with Apache License 2.0 | 5 votes |
private TreeItem getTreeItemRecursive(TreeItem item, String text) { if (item == null) return null; if (item.getText().equals(text)) return item; for (TreeItem subtreeItem: item.getItems()) { TreeItem result = getTreeItemRecursive(subtreeItem, text); if (result != null) return result; } return null; }
Example 15
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 16
Source File: IndentGuidePreferencePage.java From IndentGuide with MIT License | 5 votes |
private String getContentTypes(final TreeItem item, final String types) { String result = types; if (item.getChecked() && !item.getGrayed()) { if (!"".equals(types)) { result += "|"; } result += item.getData(); } for (final TreeItem child : item.getItems()) { result = getContentTypes(child, result); } return result; }
Example 17
Source File: AbstractSectionParm.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Find matching parm. * * @param group the group * @param name the name * @return the tree item */ private TreeItem findMatchingParm(TreeItem group, String name) { final TreeItem[] items = group.getItems(); for (int i = 0; i < items.length; i++) { if (name.equals(getName(items[i]))) return items[i]; } throw new InternalErrorCDE("invalid state"); }
Example 18
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 19
Source File: TreeViewerNavigator.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
private TreeItem[] getChildren(TreeItem item) { viewer.setExpandedState(item.getData(), true); return item.getItems(); }
Example 20
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( ) ); }