/*******************************************************************************
- * Copyright (c) 2010 Ericsson
- *
+ * Copyright (c) 2010, 2013 Ericsson
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
import java.util.Arrays;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfExperimentFolder</u></b>
+ * Implementation of the model element for the experiment folder.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
+ *
*/
public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 {
// Constants
// ------------------------------------------------------------------------
+ /**
+ * The name of the experiment folder.
+ */
public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
// Property View stuff
private static final String sfPath = "path"; //$NON-NLS-1$
private static final String sfLocation = "location"; //$NON-NLS-1$
- private static final TextPropertyDescriptor sfNameDescriptor = new TextPropertyDescriptor(sfName, sfName);
- private static final TextPropertyDescriptor sfPathDescriptor = new TextPropertyDescriptor(sfPath, sfPath);
- private static final TextPropertyDescriptor sfLocationDescriptor = new TextPropertyDescriptor(sfLocation, sfLocation);
+ private static final ReadOnlyTextPropertyDescriptor sfNameDescriptor = new ReadOnlyTextPropertyDescriptor(sfName, sfName);
+ private static final ReadOnlyTextPropertyDescriptor sfPathDescriptor = new ReadOnlyTextPropertyDescriptor(sfPath, sfPath);
+ private static final ReadOnlyTextPropertyDescriptor sfLocationDescriptor = new ReadOnlyTextPropertyDescriptor(sfLocation, sfLocation);
private static final IPropertyDescriptor[] sfDescriptors = { sfNameDescriptor, sfPathDescriptor, sfLocationDescriptor };
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor.
+ * Creates a TmfExperimentFolder model element.
+ * @param name The name of the folder
+ * @param folder The folder reference
+ * @param parent The parent (project element)
+ */
public TmfExperimentFolder(String name, IFolder folder, TmfProjectElement parent) {
super(name, folder, parent);
parent.addChild(this);
project.refresh();
}
- // ------------------------------------------------------------------------}
- // IPropertySource2\r // ------------------------------------------------------------------------\r\r @Override\r public Object getEditableValue() {\r return null;\r }\r\r @Override\r public IPropertyDescriptor[] getPropertyDescriptors() {\r return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;\r }\r\r @Override\r public Object getPropertyValue(Object id) {\r\r if (sfName.equals(id))\r return getName();\r\r if (sfPath.equals(id))\r return getPath().toString();\r\r if (sfLocation.equals(id))\r return getLocation().toString();\r\r return null;\r }\r\r @Override\r public void resetPropertyValue(Object id) {\r }\r\r @Override\r public void setPropertyValue(Object id, Object value) {\r }\r\r @Override\r public boolean isPropertyResettable(Object id) {\r return false;\r }\r\r @Override\r public boolean isPropertySet(Object id) {\r return false;\r }
+ // ------------------------------------------------------------------------
+ // IPropertySource2
+ // ------------------------------------------------------------------------
+
+ @Override
+ public Object getEditableValue() {
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return Arrays.copyOf(sfDescriptors, sfDescriptors.length);
+ }
+
+ @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;
+ }
-}\r\r
\ No newline at end of file
+}