tmf: Import and Export trace package
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / wizards / tracepkg / TracePackageTraceElement.java
1 /*******************************************************************************
2 * Copyright (c) 2013 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 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg;
14
15 import org.eclipse.linuxtools.tmf.ui.project.model.TmfNavigatorLabelProvider;
16 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
17 import org.eclipse.swt.graphics.Image;
18
19 /**
20 * An ExportTraceElement associated to a TmfTraceElement. This will be the
21 * parent of other elements (events, supplementary files, bookmarks, etc).
22 *
23 * @author Marc-Andre Laperle
24 */
25 public class TracePackageTraceElement extends TracePackageElement {
26
27 private final TmfTraceElement fTraceElement;
28 private final String fImportName;
29 private final String fTraceType;
30
31 /**
32 * Construct an instance associated to a TmfTraceElement. For exporting.
33 *
34 * @param parent
35 * the parent of this element, can be set to null
36 * @param traceElement
37 * the associated TmfTraceElement
38 */
39 public TracePackageTraceElement(TracePackageElement parent, TmfTraceElement traceElement) {
40 super(parent);
41 fTraceElement = traceElement;
42 fImportName = null;
43 fTraceType = null;
44 }
45
46 /**
47 * Construct an instance associated to a TmfTraceElement. For importing.
48 *
49 * @param parent
50 * the parent of this element, can be set to null
51 * @param importName
52 * the name to use to identify this trace
53 * @param traceType
54 * the trace type to set for this trace
55 */
56 public TracePackageTraceElement(TracePackageElement parent, String importName, String traceType) {
57 super(parent);
58 fImportName = importName;
59 fTraceElement = null;
60 fTraceType = traceType;
61 }
62
63 @Override
64 public String getText() {
65 return fTraceElement != null ? fTraceElement.getName() : fImportName;
66 }
67
68 /**
69 * @return the associated TmfTraceElement
70 */
71 public TmfTraceElement getTraceElement() {
72 return fTraceElement;
73 }
74
75 /**
76 * @return the trace type of this trace
77 */
78 public String getTraceType() {
79 return fTraceType;
80 }
81
82 @Override
83 public Image getImage() {
84 TmfNavigatorLabelProvider tmfNavigatorLabelProvider = new TmfNavigatorLabelProvider();
85 return tmfNavigatorLabelProvider.getImage(fTraceElement);
86 }
87 }
This page took 0.033247 seconds and 5 git commands to generate.