Update icons, component display name and tooltip (LTTng 2.0 control)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / UstProviderComponent.java
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
13 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
14
15 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
16 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IBaseEventInfo;
17 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
18 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IUstProviderInfo;
19 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.UstProviderPropertySource;
20 import org.eclipse.ui.views.properties.IPropertySource;
21
22 /**
23 * <b><u>UstProviderComponent</u></b>
24 * <p>
25 * Implementation of the UST provider component.
26 * </p>
27 */
28 public class UstProviderComponent extends TraceControlComponent {
29
30 // ------------------------------------------------------------------------
31 // Constants
32 // ------------------------------------------------------------------------
33 /**
34 * Path to icon file for this component.
35 */
36 public static final String USTL_PROVIDER_ICON_FILE = "icons/obj16/targets.gif"; //$NON-NLS-1$
37
38 // ------------------------------------------------------------------------
39 // Attributes
40 // ------------------------------------------------------------------------
41 /**
42 * The UST provider information.
43 */
44 private IUstProviderInfo fProviderInfo = null;
45
46 // ------------------------------------------------------------------------
47 // Constructors
48 // ------------------------------------------------------------------------
49 /**
50 * Constructor
51 * @param name - the name of the component.
52 * @param parent - the parent of this component.
53 */
54 public UstProviderComponent(String name, ITraceControlComponent parent) {
55 super(name, parent);
56 setImage(USTL_PROVIDER_ICON_FILE);
57 setToolTip(Messages.TraceControl_ProviderDisplayName);
58 fProviderInfo = new UstProviderInfo(name);
59 }
60
61 // ------------------------------------------------------------------------
62 // Accessors
63 // ------------------------------------------------------------------------
64 /**
65 * Sets the UST provider information to the given value.
66 * @param providerInfo - the provider information to set
67 */
68 public void setUstProvider(IUstProviderInfo providerInfo) {
69 fProviderInfo = providerInfo;
70 IBaseEventInfo[] events = providerInfo.getEvents();
71 for (int i = 0; i < events.length; i++) {
72 BaseEventComponent component = new BaseEventComponent(events[i].getName(), this);
73 component.setEventInfo(events[i]);
74 addChild(component);
75 }
76 setName(getName() + " [PID=" + fProviderInfo.getPid() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
77 }
78
79 /**
80 * @return the process ID of the UST provider.
81 */
82 public int getPid() {
83 return fProviderInfo.getPid();
84 }
85
86 /**
87 * Sets the process ID of the UST provider to the given value.
88 * @param pid - process ID to set
89 */
90 public void setPid(int pid) {
91 fProviderInfo.setPid(pid);
92 }
93
94 /*
95 * (non-Javadoc)
96 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
97 */
98 @SuppressWarnings("rawtypes")
99 @Override
100 public Object getAdapter(Class adapter) {
101 if (adapter == IPropertySource.class) {
102 return new UstProviderPropertySource(this);
103 }
104 return null;
105 }
106
107 // ------------------------------------------------------------------------
108 // Operations
109 // ------------------------------------------------------------------------
110
111 }
112
113
This page took 0.03413 seconds and 6 git commands to generate.