1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2006</p>
22 * <p>Company: OntoText Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.ui.views.navigator;
26
27 import org.eclipse.jface.viewers.ILabelProvider;
28 import org.eclipse.jface.viewers.ILabelProviderListener;
29 import org.eclipse.swt.graphics.Image;
30 import org.omwg.ontology.WsmlDataType;
31 import org.wsmo.common.Entity;
32 import org.wsmostudio.runtime.WsmoImageRegistry;
33
34 /***
35 * A label provider implementation which determines the appearance of the
36 * various WSMO-API objects in the GUI environment.
37 *
38 * @author not attributable
39 * @version $Revision: 1.9 $ $Date: 2006/01/09 12:51:14 $
40 */
41
42 public class WSMOLabelProvider implements ILabelProvider {
43
44
45
46
47 public Image getImage(Object element) {
48 return WsmoImageRegistry.getImageForObject(element);
49 }
50
51 public String getText(Object element) {
52 String label = null;
53 if (element instanceof WsmlDataType) {
54 label = ((WsmlDataType)element).getIRI().toString();
55 }
56 else if (element instanceof Entity) {
57 label = ((Entity)element).getIdentifier().toString();
58 }
59 else {
60 return element.toString();
61 }
62 int index = label.lastIndexOf("#");
63 if (index == -1
64 || index == label.length()-1) {
65 return label;
66 }
67 return label.substring(index+1);
68 }
69
70 public void addListener(ILabelProviderListener listener) {
71 }
72
73 public void dispose() {
74 }
75
76 public boolean isLabelProperty(Object element, String property) {
77 return true;
78 }
79
80 public void removeListener(ILabelProviderListener listener) {
81 }
82
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100