1 /*******************************************************************************
2 * Copyright (c) 2010, 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
;
15 import java
.util
.Arrays
;
17 import org
.eclipse
.core
.resources
.IFolder
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.properties
.ReadOnlyTextPropertyDescriptor
;
19 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
20 import org
.eclipse
.ui
.views
.properties
.IPropertySource2
;
23 * Implementation of the model element for the experiment folder.
26 * @author Francois Chouinard
29 public class TmfExperimentFolder
extends TmfProjectModelElement
implements IPropertySource2
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
36 * The name of the experiment folder.
38 public static final String EXPER_FOLDER_NAME
= "Experiments"; //$NON-NLS-1$
40 // Property View stuff
41 private static final String sfInfoCategory
= "Info"; //$NON-NLS-1$
42 private static final String sfName
= "name"; //$NON-NLS-1$
43 private static final String sfPath
= "path"; //$NON-NLS-1$
44 private static final String sfLocation
= "location"; //$NON-NLS-1$
46 private static final ReadOnlyTextPropertyDescriptor sfNameDescriptor
= new ReadOnlyTextPropertyDescriptor(sfName
, sfName
);
47 private static final ReadOnlyTextPropertyDescriptor sfPathDescriptor
= new ReadOnlyTextPropertyDescriptor(sfPath
, sfPath
);
48 private static final ReadOnlyTextPropertyDescriptor sfLocationDescriptor
= new ReadOnlyTextPropertyDescriptor(sfLocation
, sfLocation
);
50 private static final IPropertyDescriptor
[] sfDescriptors
= { sfNameDescriptor
, sfPathDescriptor
, sfLocationDescriptor
};
53 sfNameDescriptor
.setCategory(sfInfoCategory
);
54 sfPathDescriptor
.setCategory(sfInfoCategory
);
55 sfLocationDescriptor
.setCategory(sfInfoCategory
);
58 // ------------------------------------------------------------------------
60 // ------------------------------------------------------------------------
64 * Creates a TmfExperimentFolder model element.
65 * @param name The name of the folder
66 * @param folder The folder reference
67 * @param parent The parent (project element)
69 public TmfExperimentFolder(String name
, IFolder folder
, TmfProjectElement parent
) {
70 super(name
, folder
, parent
);
71 parent
.addChild(this);
74 // ------------------------------------------------------------------------
75 // TmfProjectModelElement
76 // ------------------------------------------------------------------------
79 public IFolder
getResource() {
80 return (IFolder
) fResource
;
84 public TmfProjectElement
getProject() {
85 return (TmfProjectElement
) getParent();
89 public void refresh() {
90 TmfProjectElement project
= (TmfProjectElement
) getParent();
94 // ------------------------------------------------------------------------
96 // ------------------------------------------------------------------------
99 public Object
getEditableValue() {
104 public IPropertyDescriptor
[] getPropertyDescriptors() {
105 return Arrays
.copyOf(sfDescriptors
, sfDescriptors
.length
);
109 public Object
getPropertyValue(Object id
) {
111 if (sfName
.equals(id
)) {
115 if (sfPath
.equals(id
)) {
116 return getPath().toString();
119 if (sfLocation
.equals(id
)) {
120 return getLocation().toString();
127 public void resetPropertyValue(Object id
) {
131 public void setPropertyValue(Object id
, Object value
) {
135 public boolean isPropertyResettable(Object id
) {
140 public boolean isPropertySet(Object id
) {