fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1431317&group_id...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / JavaElementProperties.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.internal.ui;
13
14
15 import net.sourceforge.phpdt.core.IJavaElement;
16
17 import org.eclipse.jface.viewers.IBasicPropertyConstants;
18 import org.eclipse.ui.views.properties.IPropertyDescriptor;
19 import org.eclipse.ui.views.properties.IPropertySource;
20 import org.eclipse.ui.views.properties.PropertyDescriptor;
21
22 public class JavaElementProperties implements IPropertySource {
23         
24         private IJavaElement fSource;
25         
26         // Property Descriptors
27         static private IPropertyDescriptor[] fgPropertyDescriptors= new IPropertyDescriptor[1];
28         {
29                 PropertyDescriptor descriptor;
30
31                 // resource name
32                 descriptor= new PropertyDescriptor(IBasicPropertyConstants.P_TEXT, PHPUIMessages.getString("JavaElementProperties.name")); //$NON-NLS-1$
33                 descriptor.setAlwaysIncompatible(true);
34                 fgPropertyDescriptors[0]= descriptor;
35         }
36         
37         public JavaElementProperties(IJavaElement source) {
38                 fSource= source;
39         }
40         
41         public IPropertyDescriptor[] getPropertyDescriptors() {
42                 return fgPropertyDescriptors;
43         }
44         
45         public Object getPropertyValue(Object name) {
46                 if (name.equals(IBasicPropertyConstants.P_TEXT)) {
47                         return fSource.getElementName();
48                 }
49                 return null;
50         }
51         
52         public void setPropertyValue(Object name, Object value) {
53         }
54         
55         public Object getEditableValue() {
56                 return this;
57         }
58         
59         public boolean isPropertySet(Object property) {
60                 return false;
61         }
62         
63         public void resetPropertyValue(Object property) {
64         }
65 }