/**
 * Created on Jun 18, 2005
 * $id:  $
 */
package org.jvnet.lookout.ui.core.tree.label;

import org.eclipse.swt.graphics.Image;
import org.jvnet.lookout.core.model.SearchResultProperty;
import org.jvnet.lookout.core.model.SearchResultType;
import org.jvnet.lookout.ui.core.tree.SearchResultDetail;
import org.jvnet.lookout.ui.core.tree.SearchResultItem;

public class DefaultLabelProvider extends AbstractTreeLabelProvider {
	
	public DefaultLabelProvider() {         
	}
	
	public Image getImage(SearchResultDetail detail) {
		
		SearchResultProperty property 
		= (SearchResultProperty)detail.getProperty();
		
		Image image = null;
		
		if(SearchResultProperty.SNIPPET.equals(property)) {
			image = snippetImage;
		} else if (SearchResultProperty.URL.equals(property)) {
			image = urlDetailImage;                
		} else {
			image = defaultResultImage;
		}
		
		return image;
	}
	
	public Image getImage(SearchResultItem item) {
		
		SearchResultType itemType 
		= (SearchResultType)item.getPropertyValue(SearchResultProperty.TYPE);
		
		return getTypeBasedImage(itemType);
	}    
}
