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

The following examples show how to use org.eclipse.jface.viewers.CheckboxTreeViewer#setUseHashlookup() . 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: CheckboxTreeAndListGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 *	Creates this group's tree viewer.
 * @param parent parent composite
 * @param width the width
 * @param height the height
 */
protected void createTreeViewer(Composite parent, int width, int height) {
	Tree tree= new Tree(parent, SWT.CHECK | SWT.BORDER);
	GridData data= new GridData(GridData.FILL_BOTH);
	data.widthHint= width;
	data.heightHint= height;
	tree.setLayoutData(data);

	fTreeViewer= new CheckboxTreeViewer(tree);
	fTreeViewer.setUseHashlookup(true);
	fTreeViewer.setContentProvider(fTreeContentProvider);
	fTreeViewer.setLabelProvider(fTreeLabelProvider);
	fTreeViewer.addTreeListener(this);
	fTreeViewer.addCheckStateListener(this);
	fTreeViewer.addSelectionChangedListener(this);
}
 
Example 2
Source File: FilteredCheckboxTree.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected TreeViewer doCreateTreeViewer(Composite parentComposite, int style) {
    fCheckboxTreeViewer = new CheckboxTreeViewer(parentComposite, style);
    fCheckboxTreeViewer.setUseHashlookup(true);
    fCheckboxTreeViewer.addCheckStateListener(event -> {
        if (event.getChecked()) {
            fCheckedObjects.add(event.getElement());
        } else {
            fCheckedObjects.remove(event.getElement());
        }
    });
    return fCheckboxTreeViewer;
}
 
Example 3
Source File: BaseResourceSelectionComposite.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void configureViewer(CheckboxTreeViewer viewer) {
  viewer.setContentProvider(new WorkbenchContentProvider());
  viewer.setLabelProvider(new WorkbenchLabelProvider());
  viewer.setUseHashlookup(true);
  viewer.setSorter(new WorkbenchItemsSorter());
}
 
Example 4
Source File: ContactSelectionComposite.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void configureViewer(CheckboxTreeViewer viewer) {
  viewer.setContentProvider(new RosterContentProvider());
  viewer.setLabelProvider(new TreeLabelProvider());
  viewer.setComparator(new RosterComparator());
  viewer.setUseHashlookup(true);

  checkStateProvider = new RosterCheckStateProvider();
  viewer.setCheckStateProvider(checkStateProvider);
}
 
Example 5
Source File: ExportWizardPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createProcessTree(Composite container) {
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new FillLayout());
	UI.gridData(composite, true, true);
	viewer = new CheckboxTreeViewer(composite, SWT.MULTI | SWT.BORDER);
	viewer.setUseHashlookup(true);
	viewer.setContentProvider(new NavigationContentProvider());
	viewer.setLabelProvider(new NavigationLabelProvider(false));
	viewer.setInput(Navigator.getNavigationRoot());
	viewer.addCheckStateListener(new NavigationTreeCheck(viewer));
	viewer.addCheckStateListener(this);
	viewer.addFilter(new NavigationTreeFilter());
	viewer.setComparator(new NavigationComparator());
}
 
Example 6
Source File: RepositoryImportWizard.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite container = UI.formComposite(parent);
	setControl(container);
	viewer = new CheckboxTreeViewer(container, SWT.BORDER);
	viewer.setLabelProvider(new Label());
	viewer.setContentProvider(new ContentProvider());
	viewer.setUseHashlookup(true);
	viewer.addCheckStateListener(new SelectionState(this));
	UI.gridData(viewer.getTree(), true, true);
}
 
Example 7
Source File: ModelSelectionPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createViewer(Composite composite) {
	viewer = new CheckboxTreeViewer(composite, SWT.VIRTUAL | SWT.MULTI
			| SWT.BORDER);
	viewer.setUseHashlookup(true);
	viewer.getTree().setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, true, true));
	viewer.setContentProvider(new NavigationContentProvider());
	viewer.setLabelProvider(new NavigationLabelProvider(false));
	viewer.setComparator(new NavigationComparator());
	viewer.addFilter(new ModelTypeFilter(types));
	viewer.addCheckStateListener(new ModelSelectionState(this, viewer));
	registerInputHandler(composite);
	ColumnViewerToolTipSupport.enableFor(viewer);
}
 
Example 8
Source File: ModelCheckBoxTree.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public void drawOn(Composite comp, FormToolkit tk) {
	tree = new CheckboxTreeViewer(comp,
			SWT.VIRTUAL | SWT.MULTI | SWT.BORDER);
	tree.setUseHashlookup(true);
	tree.setContentProvider(new NavigationContentProvider());
	tree.setLabelProvider(new NavigationLabelProvider(false));
	tree.setComparator(new NavigationComparator());
	tree.addFilter(new ModelTypeFilter(types));
	tree.addCheckStateListener(this);
	ColumnViewerToolTipSupport.enableFor(tree);
	if (tk != null) {
		tk.adapt(tree.getTree());
	}

	// compute a height hint
	GridData data = UI.gridData(tree.getTree(), true, true);
	data.minimumHeight = 120;
	Point p = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	data.heightHint = p.y < 120 ? 120 : p.y;

	if (types == null || types.length == 0)
		return;
	if (types.length == 1) {
		tree.setInput(Navigator.findElement(types[0]));
	} else {
		List<INavigationElement<?>> elems = Arrays.stream(types)
				.map(type -> Navigator.findElement(type))
				.filter(elem -> !elem.getChildren().isEmpty())
				.collect(Collectors.toList());
		tree.setInput(elems);
	}
	tree.expandToLevel(2);
}