1 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 QUERY_TEXT = "QueryPage.queryString"; 20 21 private static final Object CONFIGURATION_TEXT = "QueryPage.consoleConfiguration"; 22 23 static { 24 descriptors = new IPropertyDescriptor[2]; 25 PropertyDescriptor descriptor; 26 27 descriptor = new TextPropertyDescriptor(QUERY_TEXT, 29 "Query string"); 30 descriptor.setAlwaysIncompatible(true); 31 descriptors[0] = descriptor; 33 34 descriptor = new TextPropertyDescriptor(CONFIGURATION_TEXT, 36 "Console configuration"); 37 descriptor.setAlwaysIncompatible(true); 38 descriptors[1] = descriptor; 40 } 41 42 public QueryPagePropertySource (QueryPage page) { 43 this.page = page; 44 } 45 46 public boolean isPropertyResettable(Object id) { 47 return false; 48 } 49 50 public Object getEditableValue() { 51 return ""; 52 } 53 54 public IPropertyDescriptor[] getPropertyDescriptors() { 55 return descriptors; 56 } 57 58 public Object getPropertyValue(Object 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 id) { 70 return false; 71 } 72 73 public void resetPropertyValue(Object id) { 74 75 } 76 77 public void setPropertyValue(Object id, Object value) { 78 79 80 } 81 } | Popular Tags |