Search in sources :

Example 1 with TreeColumnLayout

use of org.eclipse.jface.layout.TreeColumnLayout in project bndtools by bndtools.

the class BundleTree method createBundleTreeViewer.

private void createBundleTreeViewer(Composite container) {
    bundleTreeViewerComposite = new Composite(container, SWT.NONE);
    bundleTreeViewerComposite.setLayoutData(createFillGridData());
    TreeColumnLayout layout = new TreeColumnLayout();
    bundleTreeViewerComposite.setLayout(layout);
    bundleTreeViewer = new TreeViewer(bundleTreeViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    bundleTreeViewer.setUseHashlookup(true);
    bundleTreeViewer.getTree().setHeaderVisible(true);
    TreeViewerColumn treeViewerColumn = new TreeViewerColumn(bundleTreeViewer, SWT.NONE);
    TreeColumn treeColumn = treeViewerColumn.getColumn();
    layout.setColumnData(treeColumn, new ColumnWeightData(100, 340, true));
    treeColumn.setText(Messages.symbNameResources);
    treeViewerColumn.setLabelProvider(new TreeLabelProvider());
    bundleTreeViewer.setContentProvider(bundleTreeViewerProvider);
    bundleTreeViewer.setAutoExpandLevel(3);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Composite(org.eclipse.swt.widgets.Composite) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) TreeViewer(org.eclipse.jface.viewers.TreeViewer) TreeColumn(org.eclipse.swt.widgets.TreeColumn) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn)

Example 2 with TreeColumnLayout

use of org.eclipse.jface.layout.TreeColumnLayout in project bndtools by bndtools.

the class BundleTree method createInfoViewer.

private void createInfoViewer(Composite container) {
    infoViewerComposite = new Composite(container, SWT.NONE);
    infoViewerComposite.setLayoutData(createFillGridData());
    TreeColumnLayout layout = new TreeColumnLayout();
    infoViewerComposite.setLayout(layout);
    infoViewer = new TreeViewer(infoViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    infoViewer.setUseHashlookup(true);
    infoViewer.getTree().setHeaderVisible(true);
    TreeViewerColumn treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
    TreeColumn treeColumn = treeViewerColumn.getColumn();
    layout.setColumnData(treeColumn, new ColumnWeightData(450, 180, true));
    treeColumn.setText(Messages.bundleAndPackageName);
    treeViewerColumn.setLabelProvider(new InfoLabelProvider());
    treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
    treeColumn = treeViewerColumn.getColumn();
    layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true));
    treeColumn.setText(Messages.version2);
    treeViewerColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof Baseline) {
                return ((Baseline) element).getOlderVersion().getWithoutQualifier().toString();
            }
            if (element instanceof Info) {
                return ((Info) element).olderVersion.toString();
            }
            //$NON-NLS-1$
            return "";
        }
    });
    treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
    treeColumn = treeViewerColumn.getColumn();
    layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true));
    treeColumn.setText(Messages.newVersion);
    treeViewerColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof Baseline) {
                return ((Baseline) element).getSuggestedVersion().toString();
            }
            if (element instanceof Info) {
                //$NON-NLS-1$
                return ((Info) element).suggestedVersion != null ? ((Info) element).suggestedVersion.toString() : "";
            }
            //$NON-NLS-1$
            return "";
        }
    });
    treeViewerColumn.setEditingSupport(new InlineComboEditingSupport(infoViewer));
    infoViewer.setContentProvider(infoTreeViewerProvider);
    infoViewer.setAutoExpandLevel(2);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Composite(org.eclipse.swt.widgets.Composite) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Baseline(aQute.bnd.differ.Baseline) Info(aQute.bnd.differ.Baseline.Info) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) TreeColumn(org.eclipse.swt.widgets.TreeColumn)

Aggregations

TreeColumnLayout (org.eclipse.jface.layout.TreeColumnLayout)2 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 TreeViewerColumn (org.eclipse.jface.viewers.TreeViewerColumn)2 Composite (org.eclipse.swt.widgets.Composite)2 TreeColumn (org.eclipse.swt.widgets.TreeColumn)2 Baseline (aQute.bnd.differ.Baseline)1 Info (aQute.bnd.differ.Baseline.Info)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1