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

The following examples show how to use org.eclipse.swt.widgets.Tree#showSelection() . 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: ColumnChooserDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private void selectAllChildren(Tree tree, TreeItem treeItem) {
	Collection<TreeItem> selectedLeaves = ArrayUtil.asCollection(tree.getSelection());
	if(isColumnGroupLeaf(treeItem)){
		selectedLeaves.addAll(ArrayUtil.asCollection(treeItem.getItems()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[]{}));
	tree.showSelection();
}
 
Example 2
Source File: ColumnChooserDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private void unSelectAllChildren(Tree tree, TreeItem treeItem) {
	Collection<TreeItem> selectedLeaves = ArrayUtil.asCollection(tree.getSelection());
	if(isColumnGroupLeaf(treeItem)){
		selectedLeaves.removeAll(ArrayUtil.asCollection(treeItem.getItems()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[]{}));
	tree.showSelection();
}
 
Example 3
Source File: ColumnChooserDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marks the leaves in the tree as selected
 * @param tree containing the leaves
 * @param indexes index of the leaf in the tree
 */
protected void setSelection(Tree tree, List<Integer> indexes) {
	List<TreeItem> selectedLeaves = new ArrayList<TreeItem>();

	for (Integer leafIndex : indexes) {
		selectedLeaves.add(tree.getItem(leafIndex.intValue()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[] {}));
	tree.showSelection();
}
 
Example 4
Source File: ColumnChooserDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void selectAllChildren(Tree tree, TreeItem treeItem) {
	Collection<TreeItem> selectedLeaves = ArrayUtil.asCollection(tree.getSelection());
	if(isColumnGroupLeaf(treeItem)){
		selectedLeaves.addAll(ArrayUtil.asCollection(treeItem.getItems()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[]{}));
	tree.showSelection();
}
 
Example 5
Source File: ColumnChooserDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void unSelectAllChildren(Tree tree, TreeItem treeItem) {
	Collection<TreeItem> selectedLeaves = ArrayUtil.asCollection(tree.getSelection());
	if(isColumnGroupLeaf(treeItem)){
		selectedLeaves.removeAll(ArrayUtil.asCollection(treeItem.getItems()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[]{}));
	tree.showSelection();
}
 
Example 6
Source File: ColumnChooserDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marks the leaves in the tree as selected
 * @param tree containing the leaves
 * @param indexes index of the leaf in the tree
 */
protected void setSelection(Tree tree, List<Integer> indexes) {
	List<TreeItem> selectedLeaves = new ArrayList<TreeItem>();

	for (Integer leafIndex : indexes) {
		selectedLeaves.add(tree.getItem(leafIndex.intValue()));
	}
	tree.setSelection(selectedLeaves.toArray(new TreeItem[] {}));
	tree.showSelection();
}