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