1 5 package org.hibernate.eclipse.console.views.properties; 6 7 import org.eclipse.ui.views.properties.IPropertySource; 8 import org.eclipse.ui.views.properties.IPropertySourceProvider; 9 import org.hibernate.Session; 10 import org.hibernate.console.ConsoleConfiguration; 11 import org.hibernate.console.QueryPage; 12 import org.hibernate.eclipse.console.views.QueryPageTabView; 13 14 import com.l2fprod.common.propertysheet.Property; 15 16 public class HibernatePropertySourceProvider implements IPropertySourceProvider 17 { 18 private final QueryPageTabView view; 20 21 public HibernatePropertySourceProvider(QueryPageTabView view) { 22 this.view = view; 23 } 24 25 public IPropertySource getPropertySource(Object object) { 26 if (object instanceof QueryPage) 27 { 28 return new QueryPagePropertySource((QueryPage)object); 29 } 30 else if (object instanceof Property) 31 { 32 return new HibernatePropertySource(object); 33 } 34 else { 35 Session currentSession = view.getSelectedQueryPage().getSession(); 37 ConsoleConfiguration currentConfiguration = view.getSelectedQueryPage().getConsoleConfiguration(); 38 if(currentSession.contains(object)) { 39 return new EntityPropertySource(object, currentSession, currentConfiguration); 40 } else { 41 return null; 42 } 43 44 } 45 46 } 47 } | Popular Tags |