Search in sources :

Example 1 with ICellToolTipProvider

use of org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider in project jbosstools-openshift by jbosstools.

the class EventsPropertySection method addColumns.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addColumns(TableViewerBuilder tableViewerBuilder) {
    addCreatedColumn(tableViewerBuilder);
    ICellToolTipProvider toolTipProvider = new ICellToolTipProvider() {

        @Override
        public String getToolTipText(Object object) {
            if (object instanceof IResourceWrapper && ((IResourceWrapper) object).getWrapped() instanceof IEvent) {
                return ((IEvent) ((IResourceWrapper) object).getWrapped()).getMessage();
            }
            return null;
        }

        @Override
        public int getToolTipDisplayDelayTime(Object event) {
            return 0;
        }
    };
    tableViewerBuilder.column(model -> StringUtils.substringBefore(getResource(model).getName(), ".")).name("Name").align(SWT.LEFT).weight(1).minWidth(15).cellToolTipProvider(toolTipProvider).buildColumn().column(model -> ((IEvent) getResource(model)).getInvolvedObject().getKind()).name("Kind").align(SWT.LEFT).weight(1).minWidth(5).cellToolTipProvider(toolTipProvider).buildColumn().column(model -> ((IEvent) getResource(model)).getReason()).name("Reason").align(SWT.LEFT).weight(1).minWidth(5).cellToolTipProvider(toolTipProvider).buildColumn();
}
Also used : ICellToolTipProvider(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider) IResourceWrapper(org.jboss.tools.openshift.internal.ui.models.IResourceWrapper) StringUtils(org.apache.commons.lang.StringUtils) ResourceKind(com.openshift.restclient.ResourceKind) SWT(org.eclipse.swt.SWT) IEvent(com.openshift.restclient.model.IEvent) TableViewerBuilder(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder) IResourceWrapper(org.jboss.tools.openshift.internal.ui.models.IResourceWrapper) IEvent(com.openshift.restclient.model.IEvent) ICellToolTipProvider(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider)

Example 2 with ICellToolTipProvider

use of org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider 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)

Example 3 with ICellToolTipProvider

use of org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider in project jbosstools-openshift by jbosstools.

the class ManageProjectsWizardPage method createTable.

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

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

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

        @Override
        public String getValue(IProject project) {
            return project.getName();
        }
    }).cellToolTipProvider(cellToolTipProvider).name("Name").align(SWT.LEFT).weight(1).minWidth(75).buildColumn().column(new IColumnLabelProvider<IProject>() {

        @Override
        public String getValue(IProject project) {
            return project.getDisplayName();
        }
    }).cellToolTipProvider(cellToolTipProvider).name("Display Name").align(SWT.LEFT).weight(2).minWidth(100).buildColumn().buildViewer();
    return viewer;
}
Also used : 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) IProject(com.openshift.restclient.model.IProject) TableViewerBuilder(org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder)

Aggregations

TableViewerBuilder (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder)3 ICellToolTipProvider (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 Table (org.eclipse.swt.widgets.Table)2 IColumnLabelProvider (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.IColumnLabelProvider)2 ResourceKind (com.openshift.restclient.ResourceKind)1 IEvent (com.openshift.restclient.model.IEvent)1 IProject (com.openshift.restclient.model.IProject)1 IParameter (com.openshift.restclient.model.template.IParameter)1 StringUtils (org.apache.commons.lang.StringUtils)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 SWT (org.eclipse.swt.SWT)1 IResourceWrapper (org.jboss.tools.openshift.internal.ui.models.IResourceWrapper)1 ParameterNameViewerComparator (org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.TemplateParameterViewerUtils.ParameterNameViewerComparator)1