Package dk.contix.eclipse.hudson.views

Source Code of dk.contix.eclipse.hudson.views.JobLabelProvider

package dk.contix.eclipse.hudson.views;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import dk.contix.eclipse.hudson.Job;

public class JobLabelProvider extends LabelProvider implements ITableLabelProvider {

  public Image getColumnImage(Object element, int columnIndex) {
    Job j = (Job) element;
    if (columnIndex == 3 && j.getStatus() != null) {
      return j.getStatus().getImage();
    }
    if (columnIndex == 4 && j.getHealth() != null) {
      return j.getHealth().getImage();
    }
    return null;
  }

  public String getColumnText(Object element, int columnIndex) {
    Job j = (Job) element;
    switch (columnIndex) {
      case 0:
        return j.getName();
      case 1:
        if (j.getLastBuild() == null) {
          return "No build";
        }
        return "#" + j.getLastBuild().getNumber();
      case 2:
        if (j.getLastBuild() == null) {
          return "No build";
        }
        return j.getLastBuild().getTimestamp().toLocaleString();
    }
    return null;
  }
}
TOP

Related Classes of dk.contix.eclipse.hudson.views.JobLabelProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.