package de.ugoe.cs.swe.exercises.lectureevent;

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

public class LectureEventLabelProvider extends LabelProvider implements
		ITableLabelProvider {
	public String semester;
	public String getColumnText(Object obj, int index) {
		
		LectureEvent lectureEvent = (LectureEvent) obj;

		switch (index) {
		case 0:

			if (lectureEvent.getIsSummerSemester() == true)
				semester = "SS";
			else
				semester = "WS";

			return (String.valueOf(lectureEvent.getLecture().getName()) + ", "
					+ semester + " " + String
					.valueOf(lectureEvent.getSemester()));
		}

		return null;
	}

	public Image getColumnImage(Object obj, int index) {
		return null;
	}

	@Override
	public Image getImage(Object obj) {
		return PlatformUI.getWorkbench().getSharedImages().getImage(
				ISharedImages.IMG_OBJ_ELEMENT);
	}
}
