fixed bug #1115300, #1115292
[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 org.eclipse.jface.viewers.IBasicPropertyConstants;
16
17 import org.eclipse.ui.views.properties.IPropertyDescriptor;
18 import org.eclipse.ui.views.properties.IPropertySource;
19 import org.eclipse.ui.views.properties.PropertyDescriptor;
20
21 import net.sourceforge.phpdt.core.IJavaElement;
22
23 public class JavaElementProperties implements IPropertySource {
24         
25         private IJavaElement fSource;
26         
27         // Property Descriptors
28         static private IPropertyDescriptor[] fgPropertyDescriptors= new IPropertyDescriptor[1];
29         {
30                 PropertyDescriptor descriptor;
31
32                 // resource name
33                 descriptor= new PropertyDescriptor(IBasicPropertyConstants.P_TEXT, PHPUIMessages.getString("JavaElementProperties.name")); //$NON-NLS-1$
34                 descriptor.setAlwaysIncompatible(true);
35                 fgPropertyDescriptors[0]= descriptor;
36         }
37         
38         public JavaElementProperties(IJavaElement source) {
39                 fSource= source;
40         }
41         
42         public IPropertyDescriptor[] getPropertyDescriptors() {
43                 return fgPropertyDescriptors;
44         }
45         
46         public Object getPropertyValue(Object name) {
47                 if (name.equals(IBasicPropertyConstants.P_TEXT)) {
48                         return fSource.getElementName();
49                 }
50                 return null;
51         }
52         
53         public void setPropertyValue(Object name, Object value) {
54         }
55         
56         public Object getEditableValue() {
57                 return this;
58         }
59         
60         public boolean isPropertySet(Object property) {
61                 return false;
62         }
63         
64         public void resetPropertyValue(Object property) {
65         }
66 }