1 /**********************************************************************
2 * Copyright (c) 2012 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.impl
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IBaseEventInfo
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.IUstProviderInfo
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.core
.control
.model
.impl
.UstProviderInfo
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.messages
.Messages
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.ITraceControlComponent
;
20 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.property
.UstProviderPropertySource
;
21 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
25 * Implementation of the UST provider component.
28 * @author Bernd Hufmann
30 public class UstProviderComponent
extends TraceControlComponent
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 * Path to icon file for this component.
38 public static final String USTL_PROVIDER_ICON_FILE
= "icons/obj16/targets.gif"; //$NON-NLS-1$
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
44 * The UST provider information.
46 private IUstProviderInfo fProviderInfo
= null;
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 * @param name - the name of the component.
54 * @param parent - the parent of this component.
56 public UstProviderComponent(String name
, ITraceControlComponent parent
) {
58 setImage(USTL_PROVIDER_ICON_FILE
);
59 setToolTip(Messages
.TraceControl_ProviderDisplayName
);
60 fProviderInfo
= new UstProviderInfo(name
);
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
67 * Sets the UST provider information to the given value.
68 * @param providerInfo - the provider information to set
70 public void setUstProvider(IUstProviderInfo providerInfo
) {
71 fProviderInfo
= providerInfo
;
72 IBaseEventInfo
[] events
= providerInfo
.getEvents();
73 for (int i
= 0; i
< events
.length
; i
++) {
74 BaseEventComponent component
= new BaseEventComponent(events
[i
].getName(), this);
75 component
.setEventInfo(events
[i
]);
78 setName(getName() + " [PID=" + fProviderInfo
.getPid() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
82 * @return the process ID of the UST provider.
85 return fProviderInfo
.getPid();
89 * Sets the process ID of the UST provider to the given value.
90 * @param pid - process ID to set
92 public void setPid(int pid
) {
93 fProviderInfo
.setPid(pid
);
98 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
101 public Object
getAdapter(Class adapter
) {
102 if (adapter
== IPropertySource
.class) {
103 return new UstProviderPropertySource(this);
108 // ------------------------------------------------------------------------
110 // ------------------------------------------------------------------------