Refactory: replaced deprecated constructor DefaultInformationControl(Shell, int,...
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / 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 import net.sourceforge.phpdt.core.IJavaElement;
15
16 import org.eclipse.jface.viewers.IBasicPropertyConstants;
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 public class JavaElementProperties implements IPropertySource {
22
23         private IJavaElement fSource;
24
25         // Property Descriptors
26         static private IPropertyDescriptor[] fgPropertyDescriptors = new IPropertyDescriptor[1];
27         {
28                 PropertyDescriptor descriptor;
29
30                 // resource name
31                 descriptor = new PropertyDescriptor(IBasicPropertyConstants.P_TEXT,
32                                 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 }