Search in sources :

Example 1 with IEvent

use of com.openshift.restclient.model.IEvent 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)

Aggregations

ResourceKind (com.openshift.restclient.ResourceKind)1 IEvent (com.openshift.restclient.model.IEvent)1 StringUtils (org.apache.commons.lang.StringUtils)1 SWT (org.eclipse.swt.SWT)1 TableViewerBuilder (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder)1 ICellToolTipProvider (org.jboss.tools.openshift.internal.common.ui.utils.TableViewerBuilder.ICellToolTipProvider)1 IResourceWrapper (org.jboss.tools.openshift.internal.ui.models.IResourceWrapper)1