Java Code Examples for org.eclipse.swt.widgets.Tree.setSelection()

The following are Jave code examples for showing how to use setSelection() of the org.eclipse.swt.widgets.Tree class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PDFReporter-Studio   File: JDReportOutlineView.java   View Source Code Vote up 5 votes
public void setTreeSelection(ISelection s) {
	if (s != null && s instanceof StructuredSelection && outline instanceof Tree) {
		StructuredSelection sel = (StructuredSelection) s;
		List<?> sobj = sel.toList();
		List<TreeItem> toSelect = new ArrayList<TreeItem>();
		Tree tree = (Tree) outline;
		tree.getItemCount();
		checkItems(tree.getItems(), toSelect, sobj);
		if (!toSelect.isEmpty())
			tree.setSelection(toSelect.toArray(new TreeItem[toSelect.size()]));
	} else
		setSelection(s);
}
 
Example 2
Project: erflute   File: ERDiagramOutlinePage.java   View Source Code Vote up 5 votes
public void setFilterText(String filterText) {
    editPartFactory.setFilterText(filterText);
    viewer.setContents(diagram);
    final Tree tree = (Tree) viewer.getControl();
    final TreeItem[] items = tree.getItems();
    expand(items);
    final TreeItem[] tableItems = items[0].getItems();
    if (tableItems.length >= 1) {
        tree.setSelection(tableItems[0]);
    }
}
 
Example 3
Project: convertigo-eclipse   File: SourcePickerHelper.java   View Source Code Vote up 4 votes
public void selectItemsInTree(TreeItem[] items) {
	Tree tree = twsDomTree.getTree();
	tree.setSelection(items);
	tree.setFocus();
}