Added properties implementation
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / model / impl / TraceDomainComponent.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 package org.eclipse.linuxtools.lttng.ui.views.control.model.impl;
13
14 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
15 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
16 import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
17 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
18 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceDomainPropertySource;
19 import org.eclipse.ui.views.properties.IPropertySource;
20
21 /**
22 * <b><u>TraceDomainComponent</u></b>
23 * <p>
24 * Implementation of the trace domain component.
25 * </p>
26 */
27 public class TraceDomainComponent extends TraceControlComponent {
28 // ------------------------------------------------------------------------
29 // Constants
30 // ------------------------------------------------------------------------
31 /**
32 * Path to icon file for this component.
33 */
34 public static final String TRACE_DOMAIN_ICON_FILE = "icons/obj16/domain.gif"; //$NON-NLS-1$
35
36 // ------------------------------------------------------------------------
37 // Attributes
38 // ------------------------------------------------------------------------
39 /**
40 * The domain information.
41 */
42 private IDomainInfo fDomainInfo = null;
43
44 // ------------------------------------------------------------------------
45 // Constructors
46 // ------------------------------------------------------------------------
47 /**
48 * Constructor
49 * @param name - the name of the component.
50 * @param parent - the parent of this component.
51 */
52 public TraceDomainComponent(String name, ITraceControlComponent parent) {
53 super(name, parent);
54 setImage(TRACE_DOMAIN_ICON_FILE);
55 setToolTip(Messages.TraceControl_DomainDisplayName);
56 fDomainInfo = new DomainInfo(name);
57 }
58
59 // ------------------------------------------------------------------------
60 // Accessors
61 // ------------------------------------------------------------------------
62 /**
63 * Sets the domain information.
64 * @param domainInfo - the domain information to set.
65 */
66 public void setDomainInfo(IDomainInfo domainInfo) {
67 fDomainInfo = domainInfo;
68 IChannelInfo[] channels = fDomainInfo.getChannels();
69 for (int i = 0; i < channels.length; i++) {
70 TraceChannelComponent channel = new TraceChannelComponent(channels[i].getName(), this);
71 channel.setChannelInfo(channels[i]);
72 addChild(channel);
73 }
74 }
75
76 /*
77 * (non-Javadoc)
78 * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
79 */
80 @SuppressWarnings("rawtypes")
81 @Override
82 public Object getAdapter(Class adapter) {
83 if (adapter == IPropertySource.class) {
84 return new TraceDomainPropertySource(this);
85 }
86 return null;
87 }
88 // ------------------------------------------------------------------------
89 // Operations
90 // ------------------------------------------------------------------------
91 }
This page took 0.032234 seconds and 5 git commands to generate.