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
.ui
.views
.control
.model
.IBaseEventInfo
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.ITraceControlComponent
;
17 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.model
.IUstProviderInfo
;
18 import org
.eclipse
.linuxtools
.internal
.lttng2
.ui
.views
.control
.property
.UstProviderPropertySource
;
19 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
22 * <b><u>UstProviderComponent</u></b>
24 * Implementation of the UST provider component.
27 public class UstProviderComponent
extends TraceControlComponent
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
33 * Path to icon file for this component.
35 public static final String USTL_PROVIDER_ICON_FILE
= "icons/obj16/targets.gif"; //$NON-NLS-1$
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
41 * The UST provider information.
43 private IUstProviderInfo fProviderInfo
= null;
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
50 * @param name - the name of the component.
51 * @param parent - the parent of this component.
53 public UstProviderComponent(String name
, ITraceControlComponent parent
) {
55 setImage(USTL_PROVIDER_ICON_FILE
);
56 fProviderInfo
= new UstProviderInfo(name
);
59 // ------------------------------------------------------------------------
61 // ------------------------------------------------------------------------
63 * Sets the UST provider information to the given value.
64 * @param providerInfo - the provider information to set
66 public void setUstProvider(IUstProviderInfo providerInfo
) {
67 fProviderInfo
= providerInfo
;
68 IBaseEventInfo
[] events
= providerInfo
.getEvents();
69 for (int i
= 0; i
< events
.length
; i
++) {
70 BaseEventComponent component
= new BaseEventComponent(events
[i
].getName(), this);
71 component
.setEventInfo(events
[i
]);
74 setToolTip("PID=" + fProviderInfo
.getPid()); //$NON-NLS-1$
78 * @return the process ID of the UST provider.
81 return fProviderInfo
.getPid();
85 * Sets the process ID of the UST provider to the given value.
86 * @param pid - process ID to set
88 public void setPid(int pid
) {
89 fProviderInfo
.setPid(pid
);
94 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
96 @SuppressWarnings("rawtypes")
98 public Object
getAdapter(Class adapter
) {
99 if (adapter
== IPropertySource
.class) {
100 return new UstProviderPropertySource(this);
105 // ------------------------------------------------------------------------
107 // ------------------------------------------------------------------------