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
.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
;
23 * <b><u>UstProviderComponent</u></b>
25 * Implementation of the UST provider component.
28 public class UstProviderComponent
extends TraceControlComponent
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 * Path to icon file for this component.
36 public static final String USTL_PROVIDER_ICON_FILE
= "icons/obj16/targets.gif"; //$NON-NLS-1$
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
42 * The UST provider information.
44 private IUstProviderInfo fProviderInfo
= null;
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
51 * @param name - the name of the component.
52 * @param parent - the parent of this component.
54 public UstProviderComponent(String name
, ITraceControlComponent parent
) {
56 setImage(USTL_PROVIDER_ICON_FILE
);
57 setToolTip(Messages
.TraceControl_ProviderDisplayName
);
58 fProviderInfo
= new UstProviderInfo(name
);
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
65 * Sets the UST provider information to the given value.
66 * @param providerInfo - the provider information to set
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
]);
76 setName(getName() + " [PID=" + fProviderInfo
.getPid() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
80 * @return the process ID of the UST provider.
83 return fProviderInfo
.getPid();
87 * Sets the process ID of the UST provider to the given value.
88 * @param pid - process ID to set
90 public void setPid(int pid
) {
91 fProviderInfo
.setPid(pid
);
96 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
98 @SuppressWarnings("rawtypes")
100 public Object
getAdapter(Class adapter
) {
101 if (adapter
== IPropertySource
.class) {
102 return new UstProviderPropertySource(this);
107 // ------------------------------------------------------------------------
109 // ------------------------------------------------------------------------