View Javadoc
1   package org.argeo.eclipse.ui.jcr;
2   
3   import javax.jcr.Node;
4   import javax.jcr.RepositoryException;
5   
6   import org.eclipse.jface.viewers.ColumnLabelProvider;
7   import org.eclipse.swt.graphics.Image;
8   
9   /** Simplifies writing JCR-based column label provider. */
10  public class NodeColumnLabelProvider extends ColumnLabelProvider {
11  	private static final long serialVersionUID = -6586692836928505358L;
12  
13  	protected String getNodeText(Node node) throws RepositoryException {
14  		return super.getText(node);
15  	}
16  
17  	protected String getNodeToolTipText(Node node) throws RepositoryException {
18  		return super.getToolTipText(node);
19  	}
20  
21  	protected Image getNodeImage(Node node) throws RepositoryException {
22  		return super.getImage(node);
23  	}
24  
25  	@Override
26  	public String getText(Object element) {
27  		try {
28  			return getNodeText((Node) element);
29  		} catch (RepositoryException e) {
30  			throw new RuntimeException("Runtime repository exception when accessing " + element, e);
31  		}
32  	}
33  
34  	@Override
35  	public Image getImage(Object element) {
36  		try {
37  			return getNodeImage((Node) element);
38  		} catch (RepositoryException e) {
39  			throw new RuntimeException("Runtime repository exception when accessing " + element, e);
40  		}
41  	}
42  
43  	@Override
44  	public String getToolTipText(Object element) {
45  		try {
46  			return getNodeToolTipText((Node) element);
47  		} catch (RepositoryException e) {
48  			throw new RuntimeException("Runtime repository exception when accessing " + element, e);
49  		}
50  	}
51  
52  }