Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.views.control; | |
13 | ||
14 | import org.eclipse.jface.viewers.ColumnLabelProvider; | |
15 | import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent; | |
16 | import org.eclipse.swt.graphics.Image; | |
17 | ||
18 | /** | |
19 | * <b><u>TraceControlLabelProvider</u></b> | |
20 | * <p> | |
21 | * Label provider for trace control tree viewer. | |
22 | * </p> | |
23 | */ | |
24 | public class TraceControlLabelProvider extends ColumnLabelProvider { | |
25 | ||
26 | // ------------------------------------------------------------------------ | |
27 | // Operations | |
28 | // ------------------------------------------------------------------------ | |
29 | /* (non-Javadoc) | |
30 | * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) | |
31 | */ | |
32 | @Override | |
33 | public Image getImage(Object element) { | |
34 | if ((element != null) && (element instanceof ITraceControlComponent)) { | |
35 | return ((ITraceControlComponent) element).getImage(); | |
36 | } | |
37 | return null; | |
38 | } | |
39 | ||
40 | /* (non-Javadoc) | |
41 | * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) | |
42 | */ | |
43 | @Override | |
44 | public String getText(Object element) { | |
45 | if ((element != null) && (element instanceof ITraceControlComponent)) { | |
46 | return ((ITraceControlComponent) element).getName(); | |
47 | } | |
48 | return "";//$NON-NLS-1$ | |
49 | } | |
50 | ||
51 | /* | |
52 | * (non-Javadoc) | |
53 | * @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object) | |
54 | */ | |
55 | @Override | |
56 | public String getToolTipText(Object element) { | |
57 | if ((element != null) && (element instanceof ITraceControlComponent)) { | |
58 | return ((ITraceControlComponent) element).getToolTip(); | |
59 | } | |
60 | return null; | |
61 | } | |
62 | } |