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
.Arrays
;
17 import org
.eclipse
.core
.resources
.IFolder
;
18 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
19 import org
.eclipse
.ui
.views
.properties
.IPropertySource2
;
20 import org
.eclipse
.ui
.views
.properties
.TextPropertyDescriptor
;
23 * <b><u>TmfExperimentFolder</u></b>
26 public class TmfExperimentFolder
extends TmfProjectModelElement
implements IPropertySource2
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 public static final String EXPER_FOLDER_NAME
= "Experiments"; //$NON-NLS-1$
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
, sfLocation
);
44 private static final IPropertyDescriptor
[] sfDescriptors
= { sfNameDescriptor
, sfPathDescriptor
, sfLocationDescriptor
};
47 sfNameDescriptor
.setCategory(sfInfoCategory
);
48 sfPathDescriptor
.setCategory(sfInfoCategory
);
49 sfLocationDescriptor
.setCategory(sfInfoCategory
);
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 public TmfExperimentFolder(String name
, IFolder folder
, TmfProjectElement parent
) {
57 super(name
, folder
, parent
);
58 parent
.addChild(this);
61 // ------------------------------------------------------------------------
62 // TmfProjectModelElement
63 // ------------------------------------------------------------------------
66 public IFolder
getResource() {
67 return (IFolder
) fResource
;
71 public TmfProjectElement
getProject() {
72 return (TmfProjectElement
) getParent();
76 public void refresh() {
77 TmfProjectElement project
= (TmfProjectElement
) getParent();
81 // ------------------------------------------------------------------------}
82 // IPropertySource2
// ------------------------------------------------------------------------
@Override
public Object getEditableValue() {
return null;
}
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;
}
@Override
public Object getPropertyValue(Object id) {
if (sfName.equals(id))
return getName();
if (sfPath.equals(id))
return getPath().toString();
if (sfLocation.equals(id))
return getLocation().toString();
return null;
}
@Override
public void resetPropertyValue(Object id) {
}
@Override
public void setPropertyValue(Object id, Object value) {
}
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
@Override
public boolean isPropertySet(Object id) {
return false;
}