115f4d16b2dc7ab23046ea97189976d525e0140e
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TmfExperimentFolder.java
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
13 package org.eclipse.linuxtools.tmf.ui.project.model;
14
15 import java.util.Arrays;
16
17 import org.eclipse.core.resources.IFolder;
18 import org.eclipse.ui.views.properties.IPropertyDescriptor;
19 import org.eclipse.ui.views.properties.IPropertySource2;
20 import org.eclipse.ui.views.properties.TextPropertyDescriptor;
21
22 /**
23 * <b><u>TmfExperimentFolder</u></b>
24 * <p>
25 */
26 public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 {
27
28 // ------------------------------------------------------------------------
29 // Constants
30 // ------------------------------------------------------------------------
31
32 public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
33
34 // Property View stuff
35 private static final String sfInfoCategory = "Info"; //$NON-NLS-1$
36 private static final String sfName = "name"; //$NON-NLS-1$
37 private static final String sfPath = "path"; //$NON-NLS-1$
38 private static final String sfLocation = "location"; //$NON-NLS-1$
39
40 private static final TextPropertyDescriptor sfNameDescriptor = new TextPropertyDescriptor(sfName, sfName);
41 private static final TextPropertyDescriptor sfPathDescriptor = new TextPropertyDescriptor(sfPath, sfPath);
42 private static final TextPropertyDescriptor sfLocationDescriptor = new TextPropertyDescriptor(sfLocation, sfLocation);
43
44 private static final IPropertyDescriptor[] sfDescriptors = { sfNameDescriptor, sfPathDescriptor, sfLocationDescriptor };
45
46 static {
47 sfNameDescriptor.setCategory(sfInfoCategory);
48 sfPathDescriptor.setCategory(sfInfoCategory);
49 sfLocationDescriptor.setCategory(sfInfoCategory);
50 }
51
52 // ------------------------------------------------------------------------
53 // Constructors
54 // ------------------------------------------------------------------------
55
56 public TmfExperimentFolder(String name, IFolder folder, TmfProjectElement parent) {
57 super(name, folder, parent);
58 parent.addChild(this);
59 }
60
61 // ------------------------------------------------------------------------
62 // TmfProjectModelElement
63 // ------------------------------------------------------------------------
64
65 @Override
66 public IFolder getResource() {
67 return (IFolder) fResource;
68 }
69
70 @Override
71 public TmfProjectElement getProject() {
72 return (TmfProjectElement) getParent();
73 }
74
75 @Override
76 public void refresh() {
77 TmfProjectElement project = (TmfProjectElement) getParent();
78 project.refresh();
79 }
80
81 // ------------------------------------------------------------------------}
82 // IPropertySource2 // ------------------------------------------------------------------------ @Override public Object getEditableValue() { return null; } @Override public IPropertyDescriptor[] getPropertyDescriptors() { return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null; } @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; }
83
84 }
This page took 0.031792 seconds and 5 git commands to generate.