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
;
24 * <b><u>UstProviderComponent</u></b>
26 * Implementation of the UST provider component.
29 public class UstProviderComponent
extends TraceControlComponent
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 * Path to icon file for this component.
37 public static final String USTL_PROVIDER_ICON_FILE
= "icons/obj16/targets.gif"; //$NON-NLS-1$
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
43 * The UST provider information.
45 private IUstProviderInfo fProviderInfo
= null;
47 // ------------------------------------------------------------------------
49 // ------------------------------------------------------------------------
52 * @param name - the name of the component.
53 * @param parent - the parent of this component.
55 public UstProviderComponent(String name
, ITraceControlComponent parent
) {
57 setImage(USTL_PROVIDER_ICON_FILE
);
58 setToolTip(Messages
.TraceControl_ProviderDisplayName
);
59 fProviderInfo
= new UstProviderInfo(name
);
62 // ------------------------------------------------------------------------
64 // ------------------------------------------------------------------------
66 * Sets the UST provider information to the given value.
67 * @param providerInfo - the provider information to set
69 public void setUstProvider(IUstProviderInfo providerInfo
) {
70 fProviderInfo
= providerInfo
;
71 IBaseEventInfo
[] events
= providerInfo
.getEvents();
72 for (int i
= 0; i
< events
.length
; i
++) {
73 BaseEventComponent component
= new BaseEventComponent(events
[i
].getName(), this);
74 component
.setEventInfo(events
[i
]);
77 setName(getName() + " [PID=" + fProviderInfo
.getPid() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
81 * @return the process ID of the UST provider.
84 return fProviderInfo
.getPid();
88 * Sets the process ID of the UST provider to the given value.
89 * @param pid - process ID to set
91 public void setPid(int pid
) {
92 fProviderInfo
.setPid(pid
);
97 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
99 @SuppressWarnings("rawtypes")
101 public Object
getAdapter(Class adapter
) {
102 if (adapter
== IPropertySource
.class) {
103 return new UstProviderPropertySource(this);
108 // ------------------------------------------------------------------------
110 // ------------------------------------------------------------------------