Java Code Examples for org.eclipse.jface.viewers.CheckboxTreeViewer#reveal()

The following examples show how to use org.eclipse.jface.viewers.CheckboxTreeViewer#reveal() . 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: SourceActionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void create() {
	super.create();

	// select the first checked element, or if none are checked, the first element
	CheckboxTreeViewer treeViewer= getTreeViewer();
	TreeItem[] items= treeViewer.getTree().getItems();
	if (items.length > 0) {
		Object revealedElement= items[0];

		for (int i= 0; i < items.length; i++) {
			if (items[i].getChecked()) {
				revealedElement= items[i].getData();
				break;
			}
		}
		treeViewer.setSelection(new StructuredSelection(revealedElement));
		treeViewer.reveal(revealedElement);
	}
}
 
Example 2
Source File: GenerateConstructorUsingFieldsContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void down(List<?> checked, CheckboxTreeViewer tree) {
	if (checked.size() > 0) {
		setElements(reverse(moveUp(reverse(fFields), checked)), tree);
		tree.reveal(checked.get(checked.size() - 1));
	}
	tree.setSelection(new StructuredSelection(checked));
}
 
Example 3
Source File: GenerateConstructorUsingFieldsContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void up(List<?> checked, CheckboxTreeViewer tree) {
	if (checked.size() > 0) {
		setElements(moveUp(fFields, checked), tree);
		tree.reveal(checked.get(0));
	}
	tree.setSelection(new StructuredSelection(checked));
}
 
Example 4
Source File: MultipleFolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void newFolderButtonPressed() {
	Object createdFolder= createFolder(fSelectedContainer);
	if (createdFolder != null) {
		CheckboxTreeViewer treeViewer= fViewer;
		treeViewer.refresh(fSelectedContainer);
		treeViewer.reveal(createdFolder);
		treeViewer.setChecked(createdFolder, true);
		treeViewer.setSelection(new StructuredSelection(createdFolder));
		updateOKStatus();
	}
}