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
.Arrays
;
17 import java
.util
.List
;
19 import org
.eclipse
.core
.resources
.IFolder
;
20 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
21 import org
.eclipse
.ui
.views
.properties
.IPropertySource2
;
22 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
25 * <b><u>TmfExperimentElement</u></b>
28 public class TmfExperimentElement
extends TmfProjectModelElement
implements IPropertySource2
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 // Property View stuff
35 private static final String sfInfoCategory
= "Info"; //$NON-NLS-1$
36 private static final String sfName
= "name"; //$NON-NLS-1$
37 private static final String sfPath
= "path"; //$NON-NLS-1$
38 private static final String sfLocation
= "location"; //$NON-NLS-1$
40 private static final TextPropertyDescriptor sfNameDescriptor
= new TextPropertyDescriptor(sfName
, sfName
);
41 private static final TextPropertyDescriptor sfPathDescriptor
= new TextPropertyDescriptor(sfPath
, sfPath
);
42 private static final TextPropertyDescriptor sfLocationDescriptor
= new TextPropertyDescriptor(sfLocation
,
45 private static final IPropertyDescriptor
[] sfDescriptors
= { sfNameDescriptor
, sfPathDescriptor
,
46 sfLocationDescriptor
};
49 sfNameDescriptor
.setCategory(sfInfoCategory
);
50 sfPathDescriptor
.setCategory(sfInfoCategory
);
51 sfLocationDescriptor
.setCategory(sfInfoCategory
);
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 public TmfExperimentElement(String name
, IFolder folder
, TmfExperimentFolder parent
) {
59 super(name
, folder
, parent
);
60 parent
.addChild(this);
63 // ------------------------------------------------------------------------
64 // TmfProjectModelElement
65 // ------------------------------------------------------------------------
68 public IFolder
getResource() {
69 return (IFolder
) fResource
;
73 public TmfProjectElement
getProject() {
74 return (TmfProjectElement
) getParent().getParent();
77 // ------------------------------------------------------------------------
79 // ------------------------------------------------------------------------
81 public List
<TmfTraceElement
> getTraces() {
82 List
<ITmfProjectModelElement
> children
= getChildren();
83 List
<TmfTraceElement
> traces
= new ArrayList
<TmfTraceElement
>();
84 for (ITmfProjectModelElement child
: children
) {
85 if (child
instanceof TmfTraceElement
) {
86 traces
.add((TmfTraceElement
) child
);
92 // ------------------------------------------------------------------------
94 // ------------------------------------------------------------------------
97 public Object
getEditableValue() {
102 public IPropertyDescriptor
[] getPropertyDescriptors() {
103 return (sfDescriptors
!= null) ? Arrays
.copyOf(sfDescriptors
, sfDescriptors
.length
) : null;
107 public Object
getPropertyValue(Object id
) {
109 if (sfName
.equals(id
))
112 if (sfPath
.equals(id
))
113 return getPath().toString();
115 if (sfLocation
.equals(id
))
116 return getLocation().toString();
122 public void resetPropertyValue(Object id
) {
126 public void setPropertyValue(Object id
, Object value
) {
130 public boolean isPropertyResettable(Object id
) {
135 public boolean isPropertySet(Object id
) {