View Javadoc
1   package org.argeo.connect.ui.util;
2   
3   import javax.jcr.Node;
4   
5   import org.argeo.connect.ui.SystemWorkbenchService;
6   import org.argeo.connect.util.ConnectJcrUtils;
7   import org.eclipse.swt.graphics.Image;
8   
9   /**
10   * Add an icon to the results, using the node type of the node retrieved using
11   * the selector name. It uses a JcrHtmlLabelProvider rather than a
12   * SimpleJcrRowLabelProvider: TO BE VALIDATED
13   */
14  public class TitleIconRowLP extends JcrHtmlLabelProvider {
15  	private static final long serialVersionUID = 6064779874148619776L;
16  
17  	private final SystemWorkbenchService systemWorkbenchService;
18  	private final String selectorName;
19  
20  	public TitleIconRowLP(SystemWorkbenchService systemWorkbenchService, String selectorName, String propertyName) {
21  		super(selectorName, propertyName);
22  		this.systemWorkbenchService = systemWorkbenchService;
23  		this.selectorName = selectorName;
24  	}
25  
26  	@Override
27  	public Image getImage(Object element) {
28  		Node node = ConnectJcrUtils.getNodeFromElement(element, selectorName);
29  		return systemWorkbenchService.getIconForType(node);
30  	}
31  }