ctf: Handle traces with unknown event attributes
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TmfExperimentFolder.java
CommitLineData
12c155f5
FC
1/*******************************************************************************
2 * Copyright (c) 2010 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.ui.project.model;
14
5a5c2fc7
FC
15import java.util.Arrays;
16
12c155f5
FC
17import org.eclipse.core.resources.IFolder;
18import org.eclipse.ui.views.properties.IPropertyDescriptor;
19import org.eclipse.ui.views.properties.IPropertySource2;
20import org.eclipse.ui.views.properties.TextPropertyDescriptor;
21
22/**
b544077e 23 * Implementation of the model element for the experiment folder.
12c155f5 24 * <p>
b544077e
BH
25 * @version 1.0
26 * @author Francois Chouinard
27 *
12c155f5
FC
28 */
29public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 {
30
31 // ------------------------------------------------------------------------
32 // Constants
33 // ------------------------------------------------------------------------
b544077e
BH
34 /**
35 * The name of the experiment folder.
36 */
12c155f5
FC
37 public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
38
39 // Property View stuff
40 private static final String sfInfoCategory = "Info"; //$NON-NLS-1$
41 private static final String sfName = "name"; //$NON-NLS-1$
42 private static final String sfPath = "path"; //$NON-NLS-1$
43 private static final String sfLocation = "location"; //$NON-NLS-1$
44
45 private static final TextPropertyDescriptor sfNameDescriptor = new TextPropertyDescriptor(sfName, sfName);
46 private static final TextPropertyDescriptor sfPathDescriptor = new TextPropertyDescriptor(sfPath, sfPath);
47 private static final TextPropertyDescriptor sfLocationDescriptor = new TextPropertyDescriptor(sfLocation, sfLocation);
48
49 private static final IPropertyDescriptor[] sfDescriptors = { sfNameDescriptor, sfPathDescriptor, sfLocationDescriptor };
50
51 static {
52 sfNameDescriptor.setCategory(sfInfoCategory);
53 sfPathDescriptor.setCategory(sfInfoCategory);
54 sfLocationDescriptor.setCategory(sfInfoCategory);
55 }
56
57 // ------------------------------------------------------------------------
58 // Constructors
59 // ------------------------------------------------------------------------
60
b544077e
BH
61 /**
62 * Constructor.
63 * Creates a TmfExperimentFolder model element.
64 * @param name The name of the folder
65 * @param folder The folder reference
66 * @param parent The parent (project element)
67 */
12c155f5
FC
68 public TmfExperimentFolder(String name, IFolder folder, TmfProjectElement parent) {
69 super(name, folder, parent);
70 parent.addChild(this);
71 }
72
73 // ------------------------------------------------------------------------
74 // TmfProjectModelElement
75 // ------------------------------------------------------------------------
b544077e
BH
76 /*
77 * (non-Javadoc)
78 * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
79 */
12c155f5
FC
80 @Override
81 public IFolder getResource() {
82 return (IFolder) fResource;
83 }
b544077e
BH
84
85 /*
86 * (non-Javadoc)
87 * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
88 */
12c155f5
FC
89 @Override
90 public TmfProjectElement getProject() {
91 return (TmfProjectElement) getParent();
92 }
b544077e
BH
93
94 /*
95 * (non-Javadoc)
96 * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
97 */
12c155f5
FC
98 @Override
99 public void refresh() {
100 TmfProjectElement project = (TmfProjectElement) getParent();
101 project.refresh();
102 }
103
b544077e
BH
104 // ------------------------------------------------------------------------
105 // IPropertySource2\r // ------------------------------------------------------------------------\r
106 /*
107 * (non-Javadoc)
108 * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
109 */\r @Override\r public Object getEditableValue() {\r return null;\r }\r
110 /*
111 * (non-Javadoc)
112 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
113 */\r @Override\r public IPropertyDescriptor[] getPropertyDescriptors() {\r return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;\r }\r
114 /*
115 * (non-Javadoc)
116 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
117 */\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 /*
118 * (non-Javadoc)
119 * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
120 */\r @Override\r public void resetPropertyValue(Object id) {\r }\r
121 /*
122 * (non-Javadoc)
123 * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
124 */\r @Override\r public void setPropertyValue(Object id, Object value) {\r }\r
125 /*
126 * (non-Javadoc)
127 * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
128 */\r @Override\r public boolean isPropertyResettable(Object id) {\r return false;\r }\r
129 /*
130 * (non-Javadoc)
131 * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
132 */\r @Override\r public boolean isPropertySet(Object id) {\r return false;\r }
12c155f5
FC
133
134}\r\r
This page took 0.0393 seconds and 5 git commands to generate.