KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > eclipse > console > views > properties > QueryPagePropertySource


1 /*
2  * Created on 22-Mar-2005
3  *
4  */

5 package org.hibernate.eclipse.console.views.properties;
6
7 import org.eclipse.ui.views.properties.IPropertyDescriptor;
8 import org.eclipse.ui.views.properties.IPropertySource2;
9 import org.eclipse.ui.views.properties.PropertyDescriptor;
10 import org.eclipse.ui.views.properties.TextPropertyDescriptor;
11 import org.hibernate.console.QueryPage;
12
13 public class QueryPagePropertySource implements IPropertySource2
14 {
15     private final QueryPage page;
16
17     static IPropertyDescriptor[] descriptors;
18
19     private static final String JavaDoc QUERY_TEXT = "QueryPage.queryString";
20
21     private static final Object JavaDoc CONFIGURATION_TEXT = "QueryPage.consoleConfiguration";
22     
23     static {
24         descriptors = new IPropertyDescriptor[2];
25         PropertyDescriptor descriptor;
26
27         // query string
28
descriptor = new TextPropertyDescriptor(QUERY_TEXT,
29                 "Query string");
30         descriptor.setAlwaysIncompatible(true);
31         //descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
32
descriptors[0] = descriptor;
33         
34         // configuration name
35
descriptor = new TextPropertyDescriptor(CONFIGURATION_TEXT,
36                 "Console configuration");
37         descriptor.setAlwaysIncompatible(true);
38         //descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
39
descriptors[1] = descriptor;
40     }
41     
42     public QueryPagePropertySource (QueryPage page) {
43         this.page = page;
44     }
45
46     public boolean isPropertyResettable(Object JavaDoc id) {
47         return false;
48     }
49
50     public Object JavaDoc getEditableValue() {
51         return "";
52     }
53
54     public IPropertyDescriptor[] getPropertyDescriptors() {
55         return descriptors;
56     }
57
58     public Object JavaDoc getPropertyValue(Object JavaDoc id) {
59         if(CONFIGURATION_TEXT.equals(id)) {
60             return page.getConsoleConfiguration().getName();
61         }
62         if(QUERY_TEXT.equals(id)) {
63             return page.getQueryString();
64         }
65         
66         return null;
67     }
68
69     public boolean isPropertySet(Object JavaDoc id) {
70         return false;
71     }
72
73     public void resetPropertyValue(Object JavaDoc id) {
74         
75     }
76
77     public void setPropertyValue(Object JavaDoc id, Object JavaDoc value) {
78         
79         
80     }
81 }
Popular Tags