Search in sources :

Example 31 with ColumnWeightData

use of org.eclipse.jface.viewers.ColumnWeightData 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

ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)31 TableLayout (org.eclipse.jface.viewers.TableLayout)22 GridData (org.eclipse.swt.layout.GridData)15 TableColumn (org.eclipse.swt.widgets.TableColumn)14 Composite (org.eclipse.swt.widgets.Composite)11 Table (org.eclipse.swt.widgets.Table)11 TableViewer (org.eclipse.jface.viewers.TableViewer)9 GridLayout (org.eclipse.swt.layout.GridLayout)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 Label (org.eclipse.swt.widgets.Label)5 TableItem (org.eclipse.swt.widgets.TableItem)5 BrokerEnvStatusColumn (com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerEnvStatusColumn)4 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)4 ColumnPixelData (org.eclipse.jface.viewers.ColumnPixelData)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4 Viewer (org.eclipse.jface.viewers.Viewer)4 CellEditor (org.eclipse.jface.viewers.CellEditor)3