Remove UI dependencies in tmf.core.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TmfExperimentFolder.java
CommitLineData
12c155f5 1/*******************************************************************************
c8422608 2 * Copyright (c) 2010, 2013 Ericsson
9a47bdf1 3 *
12c155f5
FC
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
9a47bdf1 8 *
12c155f5
FC
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 17import org.eclipse.core.resources.IFolder;
080600d9 18import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
12c155f5
FC
19import org.eclipse.ui.views.properties.IPropertyDescriptor;
20import org.eclipse.ui.views.properties.IPropertySource2;
12c155f5
FC
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
9a47bdf1 27 *
12c155f5
FC
28 */
29public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 {
30
31 // ------------------------------------------------------------------------
32 // Constants
33 // ------------------------------------------------------------------------
11252342 34
b544077e
BH
35 /**
36 * The name of the experiment folder.
37 */
12c155f5
FC
38 public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
39
40 // Property View stuff
41 private static final String sfInfoCategory = "Info"; //$NON-NLS-1$
42 private static final String sfName = "name"; //$NON-NLS-1$
43 private static final String sfPath = "path"; //$NON-NLS-1$
44 private static final String sfLocation = "location"; //$NON-NLS-1$
45
253d5be1
BH
46 private static final ReadOnlyTextPropertyDescriptor sfNameDescriptor = new ReadOnlyTextPropertyDescriptor(sfName, sfName);
47 private static final ReadOnlyTextPropertyDescriptor sfPathDescriptor = new ReadOnlyTextPropertyDescriptor(sfPath, sfPath);
48 private static final ReadOnlyTextPropertyDescriptor sfLocationDescriptor = new ReadOnlyTextPropertyDescriptor(sfLocation, sfLocation);
12c155f5
FC
49
50 private static final IPropertyDescriptor[] sfDescriptors = { sfNameDescriptor, sfPathDescriptor, sfLocationDescriptor };
51
52 static {
53 sfNameDescriptor.setCategory(sfInfoCategory);
54 sfPathDescriptor.setCategory(sfInfoCategory);
55 sfLocationDescriptor.setCategory(sfInfoCategory);
56 }
57
58 // ------------------------------------------------------------------------
59 // Constructors
60 // ------------------------------------------------------------------------
61
b544077e 62 /**
9a47bdf1 63 * Constructor.
b544077e
BH
64 * Creates a TmfExperimentFolder model element.
65 * @param name The name of the folder
66 * @param folder The folder reference
67 * @param parent The parent (project element)
68 */
12c155f5
FC
69 public TmfExperimentFolder(String name, IFolder folder, TmfProjectElement parent) {
70 super(name, folder, parent);
71 parent.addChild(this);
72 }
73
74 // ------------------------------------------------------------------------
75 // TmfProjectModelElement
76 // ------------------------------------------------------------------------
11252342 77
12c155f5
FC
78 @Override
79 public IFolder getResource() {
80 return (IFolder) fResource;
81 }
9a47bdf1 82
12c155f5
FC
83 @Override
84 public TmfProjectElement getProject() {
85 return (TmfProjectElement) getParent();
86 }
9a47bdf1 87
12c155f5
FC
88 @Override
89 public void refresh() {
90 TmfProjectElement project = (TmfProjectElement) getParent();
91 project.refresh();
92 }
93
b544077e 94 // ------------------------------------------------------------------------
be222f56
PT
95 // IPropertySource2
96 // ------------------------------------------------------------------------
11252342 97
be222f56
PT
98 @Override
99 public Object getEditableValue() {
100 return null;
101 }
11252342 102
be222f56
PT
103 @Override
104 public IPropertyDescriptor[] getPropertyDescriptors() {
77fdc5df 105 return Arrays.copyOf(sfDescriptors, sfDescriptors.length);
be222f56 106 }
9a47bdf1 107
be222f56
PT
108 @Override
109 public Object getPropertyValue(Object id) {
110
9a47bdf1 111 if (sfName.equals(id)) {
be222f56 112 return getName();
9a47bdf1 113 }
be222f56 114
9a47bdf1 115 if (sfPath.equals(id)) {
be222f56 116 return getPath().toString();
9a47bdf1 117 }
be222f56 118
9a47bdf1 119 if (sfLocation.equals(id)) {
be222f56 120 return getLocation().toString();
9a47bdf1 121 }
be222f56
PT
122
123 return null;
124 }
11252342 125
be222f56
PT
126 @Override
127 public void resetPropertyValue(Object id) {
128 }
11252342 129
be222f56
PT
130 @Override
131 public void setPropertyValue(Object id, Object value) {
132 }
11252342 133
be222f56
PT
134 @Override
135 public boolean isPropertyResettable(Object id) {
136 return false;
137 }
11252342 138
be222f56
PT
139 @Override
140 public boolean isPropertySet(Object id) {
141 return false;
142 }
143
144}
This page took 0.044858 seconds and 5 git commands to generate.