1 /*******************************************************************************
2 * Copyright (c) 2013 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 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.wizards
.tracepkg
;
17 import org
.eclipse
.core
.resources
.IResource
;
18 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
19 import org
.eclipse
.swt
.graphics
.Image
;
22 * An ExportTraceElement representing the trace files of a trace.
24 * @author Marc-Andre Laperle
26 public class TracePackageFilesElement
extends TracePackageElement
{
28 private static final String TRACE_ICON_PATH
= "icons/elcl16/trace.gif"; //$NON-NLS-1$
29 private final String fFileName
;
30 private final IResource fResource
;
31 private long fSize
= -1;
34 * Constructs an instance of ExportTraceFilesElement when exporting
37 * the parent of this element, can be set to null
39 * the resource representing the trace file or folder in the
42 public TracePackageFilesElement(TracePackageElement parent
, IResource resource
) {
49 * Constructs an instance of ExportTraceFilesElement when importing
52 * the parent of this element, can be set to null
54 * the name of the file to be imported
56 public TracePackageFilesElement(TracePackageElement parent
, String fileName
) {
62 private long getSize(File file
) {
63 if (file
.isDirectory()) {
65 for (File f
: file
.listFiles()) {
75 public long getSize(boolean checkedOnly
) {
76 if (checkedOnly
&& !isChecked()) {
80 if (fSize
== -1 && fResource
.exists()) {
81 File file
= fResource
.getLocation().toFile();
82 fSize
= getSize(file
);
89 public String
getText() {
90 return Messages
.TracePackage_TraceElement
;
94 public Image
getImage() {
95 return Activator
.getDefault().getImageFromImageRegistry(TRACE_ICON_PATH
);
99 * Get the file name for this trace file or folder
101 * @return the file name for this trace file or folder
103 public String
getFileName() {