org.eclipse.jface.viewers.TreeNodeContentProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.TreeNodeContentProvider. 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: SourceContentOutlinePage.java    From textuml with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    super.createControl(parent);
    viewer = getTreeViewer();
    contentProvider = new TreeNodeContentProvider();
    viewer.setContentProvider(contentProvider);
    labelProvider = new TextUMLLabelProvider();
    viewer.setLabelProvider(labelProvider);
    // disabled: used to make elements to show sorted by type
    // viewer.setComparator(new UIModelObjectViewerComparator());
    viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);

    // tracks selections in the outline and reflects them in the editor
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            TreeSelection selection = (TreeSelection) event.getSelection();
            if (!selection.isEmpty()) {
                TreeNode treeNode = (TreeNode) selection.getFirstElement();
                UIModelObject model = (UIModelObject) treeNode.getValue();
                selectInEditor(model.getToken());
            }
        }
    });

    refresh();
}
 
Example #2
Source File: OutlinePage.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.8
 */
protected void showBusyStatus() {
	TreeViewer treeViewer = getTreeViewer();
	treeViewer.setLabelProvider(busyLabelProvider);
	treeViewer.setContentProvider(new TreeNodeContentProvider());
	treeViewer.setInput(new TreeNode[] { new TreeNode("Loading...") });
}
 
Example #3
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static ContainerCheckedTreeViewer createCheckedTreeViewer(final AbstractDialog dialog, final Composite parent, final int height, final int span) {
    final GridData gridData = new GridData();
    gridData.heightHint = height;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = span;

    final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    final Tree tree = viewer.getTree();
    tree.setLayoutData(gridData);

    viewer.setContentProvider(new TreeNodeContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());

    if (dialog != null) {
        viewer.addCheckStateListener(new ICheckStateListener() {

            @Override
            public void checkStateChanged(final CheckStateChangedEvent event) {
                dialog.validate();
            }

        });
    }

    return viewer;
}
 
Example #4
Source File: AbstractSelectImportedObjectDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void createAllObjectGroup(Composite composite) {
    final GridData gridData = new GridData();
    gridData.heightHint = 300;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    final Tree tree = viewer.getTree();
    tree.setLayoutData(gridData);

    viewer.setContentProvider(new TreeNodeContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
}
 
Example #5
Source File: SelectImportedSchemaDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void createAllSchemaGroup(Composite composite) {
    final GridData gridData = new GridData();
    gridData.heightHint = 300;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    final Tree tree = viewer.getTree();
    tree.setLayoutData(gridData);

    viewer.setContentProvider(new TreeNodeContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
}
 
Example #6
Source File: AbstractSelectImportedObjectDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void createAllObjectGroup(Composite composite) {
	GridData gridData = new GridData();
	gridData.heightHint = 300;
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI
			| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	Tree tree = this.viewer.getTree();
	tree.setLayoutData(gridData);

	this.viewer.setContentProvider(new TreeNodeContentProvider());
	this.viewer.setLabelProvider(new ViewLabelProvider());
}
 
Example #7
Source File: SelectImportedSchemaDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void createAllSchemaGroup(Composite composite) {
	GridData gridData = new GridData();
	gridData.heightHint = 300;
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI
			| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	Tree tree = this.viewer.getTree();
	tree.setLayoutData(gridData);

	this.viewer.setContentProvider(new TreeNodeContentProvider());
	this.viewer.setLabelProvider(new ViewLabelProvider());
}