/*******************************************************************************
- * 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;
/**
* 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.
*/
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 };
// ------------------------------------------------------------------------
/**
- * Constructor.
+ * Constructor.
* Creates a TmfExperimentFolder model element.
* @param name The name of the folder
* @param folder The folder reference
// ------------------------------------------------------------------------
// TmfProjectModelElement
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
- */
+
@Override
public IFolder getResource() {
return (IFolder) fResource;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
- */
+
@Override
public TmfProjectElement getProject() {
return (TmfProjectElement) getParent();
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
- */
+
@Override
public void refresh() {
TmfProjectElement project = (TmfProjectElement) getParent();
}
// ------------------------------------------------------------------------
- // IPropertySource2\r // ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */\r @Override\r public Object getEditableValue() {\r return null;\r }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */\r @Override\r public IPropertyDescriptor[] getPropertyDescriptors() {\r return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;\r }\r
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */\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 /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */\r @Override\r public void resetPropertyValue(Object id) {\r }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */\r @Override\r public void setPropertyValue(Object id, Object value) {\r }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
- */\r @Override\r public boolean isPropertyResettable(Object id) {\r return false;\r }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
- */\r @Override\r public boolean isPropertySet(Object id) {\r return false;\r }
-
-}\r\r
\ No newline at end of file
+ // 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;
+ }
+
+}