package info.limpet.rcp.editors;

import info.limpet.ICollection;
import info.limpet.rcp.Activator;
import info.limpet.rcp.data_provider.data.CollectionWrapper;
import info.limpet.rcp.data_provider.data.CommandWrapper;
import info.limpet.rcp.data_provider.data.GroupWrapper;
import info.limpet.rcp.data_provider.data.NamedList;

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

public class LimpetLabelProvider extends LabelProvider
{

	@Override
	public Image getImage(Object obj)
	{
		Image res = null;

		if (obj instanceof GroupWrapper)
		{
			// is it just one, or multiple?
			res = PlatformUI.getWorkbench().getSharedImages()
					.getImage(ISharedImages.IMG_OBJ_FOLDER);
		}
		if (obj instanceof CollectionWrapper)
		{
			// is it just one, or multiple?
			CollectionWrapper cw = (CollectionWrapper) obj;
			ICollection coll = cw.getCollection();
			if (coll.size() > 1)
			{
				res = PlatformUI.getWorkbench().getSharedImages()
						.getImage(ISharedImages.IMG_OBJ_FILE);
			}
			else
			{
				res = Activator.getImageFromRegistry(Activator
						.getImageDescriptor("icons/number_icon.png"));
			}
		}
		else if (obj instanceof CommandWrapper)
		{
			res = Activator.getImageFromRegistry(Activator
					.getImageDescriptor("icons/interpolate.png"));
		}
		else if (obj instanceof NamedList)
		{
			res = PlatformUI.getWorkbench().getSharedImages()
					.getImage(ISharedImages.IMG_OBJ_FOLDER);
		}

		return res;
	}
}

@@ -38,31 +38,266 @@
 ort 
-info.limpet.ICollection
+javax.measure.unit.Dimension;%0A%0Aimport info.limpet.ICollection;%0Aimport info.limpet.IObjectCollection;%0Aimport info.limpet.IQuantityCollection;%0Aimport info.limpet.data.impl.samples.StockTypes.NonTemporal;%0Aimport info.limpet.data.impl.samples.StockTypes.Temporal
 ;%0Aim
@@ -1209,25 +1209,183 @@
 oll.
-size() %3E 1)%0A
+isQuantity())%0A%09%09%09%7B%0A%09%09%09%09IQuantityCollection%3C?%3E q = (IQuantityCollection%3C?%3E) coll;%0A%09%09%09%09Dimension dim = q.getUnits().getDimension();%0A%09%09%09%09if (dim.equals(Dimension.LENGTH))%0A%09
 %09%09%09%7B%0A
+%09
 %09%09%09%09
@@ -1394,216 +1394,762 @@
 s = 
-Pl
+Activ
 at
-f
 or
-mUI.getWorkbench().getSharedImages()%0A%09%09%09%09%09%09.getImage(ISharedImages.IMG_OBJ_FILE);%0A%09%09%09%7D%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09res = Activator.getImageFromRegistry(Activator%0A%09%09%09%09%09%09.getImageDescriptor(%22icons/number_icon.png%22)
+.getImageFromRegistry(Activator%0A%09%09%09%09%09%09%09.getImageDescriptor(%22icons/measure.png%22));%0A%09%09%09%09%7D%0A%09%09%09%09else if (dim.equals(Dimension.TIME))%0A%09%09%09%09%7B%0A%09%09%09%09%09res = Activator.getImageFromRegistry(Activator%0A%09%09%09%09%09%09%09.getImageDescriptor(%22icons/time.png%22));%0A%09%09%09%09%7D%0A%09%09%09%09else if (dim.equals(Dimension.LENGTH.divide(Dimension.TIME)))%0A%09%09%09%09%7B%0A%09%09%09%09%09res = Activator.getImageFromRegistry(Activator%0A%09%09%09%09%09%09%09.getImageDescriptor(%22icons/speed.png%22));%0A%09%09%09%09%7D%09%09%09%09%0A%09%09%09%7D%0A%09%09%09else if(coll instanceof Temporal.Location %7C%7C coll instanceof NonTemporal.Location)%0A%09%09%09%7B%0A%09%09%09%09res = Activator.getImageFromRegistry(Activator%0A%09%09%09%09%09%09.getImageDescriptor(%22icons/location.png%22));%0A%09%09%09%7D%0A%09%09%09if (res == null)%0A%09%09%09%7B%0A%09%09%09%09res = PlatformUI.getWorkbench().getSharedImages()%0A%09%09%09%09%09%09.getImage(ISharedImages.IMG_OBJ_FILE
 );%0A%09

use quantity icons