X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fui%2Fproject%2Fmodel%2FTmfExperimentFolder.java;h=6498ef257a946556743fa60aab90aae7df0a7706;hb=080600d9018f188e488a634be6e25bf91d3f692b;hp=82fd2cf7519d210d9fecb8a2f359b965ec5bfe08;hpb=12c155f58b96b570d98927ffcf3e49ac4b0176ec;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentFolder.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentFolder.java index 82fd2cf751..6498ef257a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentFolder.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentFolder.java @@ -1,25 +1,30 @@ /******************************************************************************* - * 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 *******************************************************************************/ 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; /** - * TmfExperimentFolder + * Implementation of the model element for the experiment folder. *
+ * @version 1.0 + * @author Francois Chouinard + * */ public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 { @@ -27,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 @@ -35,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 }; @@ -51,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); @@ -76,7 +91,54 @@ public class TmfExperimentFolder extends TmfProjectModelElement implements IProp project.refresh(); } - // ------------------------------------------------------------------------} - // IPropertySource2 // ------------------------------------------------------------------------ @Override public Object getEditableValue() { return null; } @Override public IPropertyDescriptor[] getPropertyDescriptors() { return sfDescriptors; } @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; } + // ------------------------------------------------------------------------ + // 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; + } -} \ No newline at end of file +}