1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 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
.tracecompass
.internal
.tmf
.ui
.project
.wizards
.tracepkg
;
15 import org
.eclipse
.core
.resources
.IResource
;
16 import org
.eclipse
.swt
.graphics
.Image
;
17 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Activator
;
20 * A trace package element representing a single supplementary file
22 * @author Marc-Andre Laperle
24 public class TracePackageSupplFileElement
extends TracePackageElement
{
26 private static final String SUPPL_FILE_ICON_PATH
= "icons/obj16/thread_obj.gif"; //$NON-NLS-1$
28 private final IResource fResource
;
29 private final String fSuppFileName
;
32 * Constructor used when exporting
35 * the resource representing this supplementary file in the
40 public TracePackageSupplFileElement(IResource resource
, TracePackageElement parent
) {
47 * Constructor used when importing
50 * the name to be used for the supplementary file in the
55 public TracePackageSupplFileElement(String suppFileName
, TracePackageElement parent
) {
57 this.fSuppFileName
= suppFileName
;
62 * Get the resource corresponding to this supplementary file
64 * @return the resource corresponding to this supplementary file
66 public IResource
getResource() {
71 public String
getText() {
72 return fResource
!= null ? fResource
.getName() : fSuppFileName
;
76 public long getSize(boolean checkedOnly
) {
77 if (checkedOnly
&& !isChecked()) {
81 return fResource
.getLocation().toFile().length();
85 public Image
getImage() {
86 return Activator
.getDefault().getImageFromImageRegistry(SUPPL_FILE_ICON_PATH
);