1 /*******************************************************************************
2 * Copyright (c) 2010 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
18 import org
.eclipse
.core
.resources
.IFolder
;
19 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
20 import org
.eclipse
.ui
.views
.properties
.IPropertySource2
;
21 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
24 * <b><u>TmfExperimentElement</u></b>
27 public class TmfExperimentElement
extends TmfProjectModelElement
implements IPropertySource2
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
33 // Property View stuff
34 private static final String sfInfoCategory
= "Info"; //$NON-NLS-1$
35 private static final String sfName
= "name"; //$NON-NLS-1$
36 private static final String sfPath
= "path"; //$NON-NLS-1$
37 private static final String sfLocation
= "location"; //$NON-NLS-1$
39 private static final TextPropertyDescriptor sfNameDescriptor
= new TextPropertyDescriptor(sfName
, sfName
);
40 private static final TextPropertyDescriptor sfPathDescriptor
= new TextPropertyDescriptor(sfPath
, sfPath
);
41 private static final TextPropertyDescriptor sfLocationDescriptor
= new TextPropertyDescriptor(sfLocation
,
44 private static final IPropertyDescriptor
[] sfDescriptors
= { sfNameDescriptor
, sfPathDescriptor
,
45 sfLocationDescriptor
};
48 sfNameDescriptor
.setCategory(sfInfoCategory
);
49 sfPathDescriptor
.setCategory(sfInfoCategory
);
50 sfLocationDescriptor
.setCategory(sfInfoCategory
);
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
57 public TmfExperimentElement(String name
, IFolder folder
, TmfExperimentFolder parent
) {
58 super(name
, folder
, parent
);
59 parent
.addChild(this);
62 // ------------------------------------------------------------------------
63 // TmfProjectModelElement
64 // ------------------------------------------------------------------------
67 public IFolder
getResource() {
68 return (IFolder
) fResource
;
72 public TmfProjectElement
getProject() {
73 return (TmfProjectElement
) getParent().getParent();
76 // ------------------------------------------------------------------------
78 // ------------------------------------------------------------------------
80 public List
<TmfTraceElement
> getTraces() {
81 List
<ITmfProjectModelElement
> children
= getChildren();
82 List
<TmfTraceElement
> traces
= new ArrayList
<TmfTraceElement
>();
83 for (ITmfProjectModelElement child
: children
) {
84 if (child
instanceof TmfTraceElement
) {
85 traces
.add((TmfTraceElement
) child
);
91 // ------------------------------------------------------------------------
93 // ------------------------------------------------------------------------
96 public Object
getEditableValue() {
101 public IPropertyDescriptor
[] getPropertyDescriptors() {
102 return sfDescriptors
;
106 public Object
getPropertyValue(Object id
) {
108 if (sfName
.equals(id
))
111 if (sfPath
.equals(id
))
112 return getPath().toString();
114 if (sfLocation
.equals(id
))
115 return getLocation().toString();
121 public void resetPropertyValue(Object id
) {
125 public void setPropertyValue(Object id
, Object value
) {
129 public boolean isPropertyResettable(Object id
) {
134 public boolean isPropertySet(Object id
) {