KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > JavaElementProperties


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.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 org.eclipse.jdt.core.IJavaElement;
22
23 public class JavaElementProperties implements IPropertySource {
24     
25     private IJavaElement fSource;
26     
27     // Property Descriptors
28
private static final IPropertyDescriptor[] fgPropertyDescriptors= new IPropertyDescriptor[1];
29     static {
30         PropertyDescriptor descriptor;
31
32         // resource name
33
descriptor= new PropertyDescriptor(IBasicPropertyConstants.P_TEXT, JavaUIMessages.JavaElementProperties_name);
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 JavaDoc getPropertyValue(Object JavaDoc name) {
47         if (name.equals(IBasicPropertyConstants.P_TEXT)) {
48             return fSource.getElementName();
49         }
50         return null;
51     }
52     
53     public void setPropertyValue(Object JavaDoc name, Object JavaDoc value) {
54     }
55     
56     public Object JavaDoc getEditableValue() {
57         return this;
58     }
59     
60     public boolean isPropertySet(Object JavaDoc property) {
61         return false;
62     }
63     
64     public void resetPropertyValue(Object JavaDoc property) {
65     }
66 }
67
Popular Tags