1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.sensorframework.dialogs.dataset; |
5 | |
6 | import org.eclipse.jface.viewers.LabelProvider; |
7 | import org.eclipse.swt.graphics.Image; |
8 | |
9 | import de.uka.ipd.sdq.sensorframework.dialogs.DialogsImages; |
10 | import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory; |
11 | |
12 | public class DatasourceListLabelProvider extends LabelProvider { |
13 | |
14 | /* (non-Javadoc) |
15 | * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) |
16 | */ |
17 | @Override |
18 | public String getText(Object element) { |
19 | if (element instanceof IDAOFactory) { |
20 | IDAOFactory factory = (IDAOFactory) element; |
21 | return factory.getName() + " - " + factory.getDescription() + " [" + factory.getID()+ "]"; |
22 | } |
23 | return super.getText(element); |
24 | } |
25 | |
26 | @Override |
27 | public Image getImage(Object element) { |
28 | if (element instanceof IDAOFactory) |
29 | return DialogsImages.imageRegistry.get(DialogsImages.TREEROOT); |
30 | return super.getImage(element); |
31 | } |
32 | |
33 | public static String dataSetRepresentation(IDAOFactory dataSet){ |
34 | return dataSet.getName() + " [" + dataSet.getID()+ "] - " + dataSet.getPersistendInfo(); |
35 | } |
36 | } |