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

The following examples show how to use org.eclipse.jface.viewers.CheckboxTreeViewer#setFilters() . 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: SGenWizardPage2.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private void createObjectTree(Composite container) {
	lblNewLabel = new Label(container, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());

	resourceTree = new CheckboxTreeViewer(container, SWT.BORDER);
	resourceTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	resourceTree.setContentProvider(new WorkspaceTreeContentProvider());
	resourceTree.setLabelProvider(new SGenWorkspaceLabelProvider());

	TreePropagatingCheckStateListener checkStateListener = new TreePropagatingCheckStateListener(resourceTree) {
		@Override
		public void checkStateChanged(CheckStateChangedEvent event) {
			super.checkStateChanged(event);
		}
	};
	resourceTree.addCheckStateListener(checkStateListener);
	resourceTree.addDoubleClickListener(new TreeExpandingDoubleClickListener(resourceTree, checkStateListener));
	resourceTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
	resourceTree.setFilters(new ViewerFilter[] { new ViewerFilter() {
		@Override
		public boolean select(Viewer viewer, Object parentElement, Object element) {
			// TODO: Filter by common navigator filter instead of supressing
			// '.' prefixed folder
			if (element instanceof IFolder) {
				return !((IFolder) element).getName().startsWith(".");
			}
			return true;
		}
	} });
}
 
Example 2
Source File: FieldToContractInputMappingViewerCheckStateManagerTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private CheckboxTreeViewer aCheckBoxTreeViewer(List<FieldToContractInputMapping> input) {
    CheckboxTreeViewer viewer = new CheckboxTreeViewer(realmWithDisplay.createComposite());
    viewer.setFilters(hidePersistenceIdMapping());
    ObservableListTreeContentProvider provider = new ObservableListTreeContentProvider(
            new FieldToContractInputMappingObservableFactory(),
            new FieldToContractInputMappingTreeStructureAdvisor());
    viewer.setContentProvider(provider);
    viewer.setInput(input);
    return viewer;
}