Remove UI dependencies in tmf.core.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TmfExperimentFolder.java
index 115f4d16b2dc7ab23046ea97189976d525e0140e..6498ef257a946556743fa60aab90aae7df0a7706 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
- * 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
  *******************************************************************************/
@@ -15,13 +15,16 @@ package org.eclipse.linuxtools.tmf.ui.project.model;
 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 {
 
@@ -29,6 +32,9 @@ public class TmfExperimentFolder extends TmfProjectModelElement implements IProp
     // Constants
     // ------------------------------------------------------------------------
 
+    /**
+     * The name of the experiment folder.
+     */
     public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
 
     // Property View stuff
@@ -37,9 +43,9 @@ public class TmfExperimentFolder extends TmfProjectModelElement implements IProp
     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 };
 
@@ -53,6 +59,13 @@ public class TmfExperimentFolder extends TmfProjectModelElement implements IProp
     // 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);
@@ -78,7 +91,54 @@ public class TmfExperimentFolder extends TmfProjectModelElement implements IProp
         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
+}
This page took 0.039359 seconds and 5 git commands to generate.