Search in sources :

Example 1 with ParameterNameViewerComparator

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.TemplateParameterViewerUtils.ParameterNameViewerComparator in project jbosstools-openshift by jbosstools.

the class NewApplicationSummaryFromTemplateDialog method createTable.

public TableViewer createTable(Composite tableContainer) {
    Table table = new Table(tableContainer, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    ICellToolTipProvider<IParameter> cellToolTipProvider = new ICellToolTipProvider<IParameter>() {

        @Override
        public String getToolTipText(IParameter object) {
            return object.getDescription();
        }

        @Override
        public int getToolTipDisplayDelayTime(IParameter object) {
            return 0;
        }
    };
    TableViewer viewer = new TableViewerBuilder(table, tableContainer).contentProvider(new ArrayContentProvider()).column(new IColumnLabelProvider<IParameter>() {

        @Override
        public String getValue(IParameter variable) {
            return variable.getName();
        }
    }).cellToolTipProvider(cellToolTipProvider).name("Name").align(SWT.LEFT).weight(2).minWidth(100).buildColumn().column(new IColumnLabelProvider<IParameter>() {

        @Override
        public String getValue(IParameter parameter) {
            return TemplateParameterViewerUtils.getValueLabel(parameter);
        }
    }).cellToolTipProvider(cellToolTipProvider).name("Value").align(SWT.LEFT).weight(2).minWidth(100).buildColumn().buildViewer();
    viewer.setComparator(new ParameterNameViewerComparator());
    viewer.addDoubleClickListener(onDoubleClick(table));
    return viewer;
}
Also used : IParameter(com.openshift.restclient.model.template.IParameter) IColumnLabelProvider(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.IColumnLabelProvider) Table(org.eclipse.swt.widgets.Table) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ICellToolTipProvider(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerBuilder(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder) ParameterNameViewerComparator(org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.TemplateParameterViewerUtils.ParameterNameViewerComparator)

Aggregations

IParameter (com.openshift.restclient.model.template.IParameter)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 Table (org.eclipse.swt.widgets.Table)1 TableViewerBuilder (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder)1 ICellToolTipProvider (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider)1 IColumnLabelProvider (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.IColumnLabelProvider)1 ParameterNameViewerComparator (org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.TemplateParameterViewerUtils.ParameterNameViewerComparator)1