Author: vyemialyanchyk
Date: 2008-01-18 09:19:10 -0500 (Fri, 18 Jan 2008)
New Revision: 5806
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/DeferredContentProvider.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1422
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -21,13 +21,10 @@
*/
package org.hibernate.eclipse.console.views;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.model.IWorkbenchAdapter;
import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
@@ -66,25 +63,19 @@
}
private void refreshTree() {
+ tv.getTree().setRedraw(false);
Runnable runnable = new Runnable() {
public void run() {
tv.refresh();
}
};
- tv.getControl().getDisplay().syncExec(runnable);
+ tv.getControl().getDisplay().asyncExec(runnable);
+ tv.getTree().setRedraw(true);
}
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
refreshTree();
}
-
- protected IWorkbenchAdapter getAdapter(Object o) {
- if (o instanceof IAdaptable) {
- return (IWorkbenchAdapter) ((IAdaptable)
o).getAdapter(IWorkbenchAdapter.class);
- } else {
- return (IWorkbenchAdapter) Platform.getAdapterManager().getAdapter(o,
IWorkbenchAdapter.class);
- }
- }
public void sessionFactoryBuilt(final ConsoleConfiguration ccfg, SessionFactory
builtFactory) {
/*(Display.getDefault().syncExec(new Runnable() { Disabled as it will generate double
entries in the child list
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -75,7 +75,9 @@
o2 = sfError;
}*/
- return new Object[] { o1, new LazySessionFactory(ccfg), new LazyDatabaseSchema(ccfg)
};
+ Object[] res = new Object[] { o1, new LazySessionFactory(ccfg), new
LazyDatabaseSchema(ccfg) };
+ ccfg.setChildren(res);
+ return res;
}
private ConsoleConfiguration getConsoleConfiguration(Object o) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/DeferredContentProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/DeferredContentProvider.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/DeferredContentProvider.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -29,6 +29,7 @@
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.progress.DeferredTreeContentManager;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
+import org.hibernate.console.model.IParentEl;
public class DeferredContentProvider extends BaseWorkbenchContentProvider {
@@ -55,6 +56,10 @@
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
public boolean hasChildren(Object element) {
+ // if we could check simple check it without DeferredTreeContentManager
+ if (element instanceof IParentEl) {
+ return ((IParentEl)element).hasChildren();
+ }
// the + box will always appear, but then disappear
// if not needed after you first click on it.
if (manager != null) {
@@ -69,6 +74,13 @@
* @see org.eclipse.ui.model.WorkbenchContentProvider#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object element) {
+ // if we could get children simple get it without DeferredTreeContentManager
+ if (element instanceof IParentEl) {
+ Object[] children = ((IParentEl)element).getChildren();
+ if (null != children) {
+ return children;
+ }
+ }
if (manager != null) {
Object[] children = manager.getChildren(element);
if(children != null) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -24,8 +24,9 @@
import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.model.IParentElImpl;
-public class LazyDatabaseSchema {
+public class LazyDatabaseSchema extends IParentElImpl {
private final ConsoleConfiguration ccfg;
private final ReverseEngineeringStrategy res;
@@ -45,5 +46,4 @@
public ReverseEngineeringStrategy getReverseEngineeringStrategy() {
return res;
}
-
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -64,7 +64,7 @@
Map.Entry entry = (Map.Entry) qualifierEntries.next();
result.add(new TableContainer((String) entry.getKey(),(List)entry.getValue()));
}
- return toArray(result.iterator(), TableContainer.class, new Comparator() {
+ Object[] res = toArray(result.iterator(), TableContainer.class, new Comparator() {
public int compare(Object arg0, Object arg1) {
@@ -72,6 +72,8 @@
}
});
+ dbs.setChildren(res);
+ return res;
}
private LazyDatabaseSchema getLazyDatabaseSchema(Object o) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactory.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactory.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -22,9 +22,10 @@
package org.hibernate.eclipse.console.workbench;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.model.IParentElImpl;
import org.hibernate.console.node.ConfigurationEntitiesNode;
-public class LazySessionFactory {
+public class LazySessionFactory extends IParentElImpl {
private final ConsoleConfiguration ccfg;
private ConfigurationEntitiesNode cfgNode;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -50,7 +50,9 @@
}
}
if(lazySessionFactory.getCfgNode()!=null) {
- return toArray(lazySessionFactory.getCfgNode().children(),BaseNode.class);
+ Object[] res = toArray(lazySessionFactory.getCfgNode().children(),BaseNode.class);
+ lazySessionFactory.setChildren(res);
+ return res;
} else {
return new Object[] { label };
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -23,8 +23,10 @@
import java.util.List;
-public class TableContainer {
+import org.hibernate.console.model.IParentElImpl;
+public class TableContainer extends IParentElImpl {
+
private final List tables;
private final String name;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java 2008-01-18
14:17:03 UTC (rev 5805)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java 2008-01-18
14:19:10 UTC (rev 5806)
@@ -32,7 +32,7 @@
public Object[] getChildren(Object o) {
TableContainer tc = getTableContainer( o );
- return toArray(tc.getTables().iterator(), Table.class, new Comparator() {
+ Object[] res = toArray(tc.getTables().iterator(), Table.class, new Comparator() {
public int compare(Object arg0, Object arg1) {
@@ -40,6 +40,8 @@
}
});
+ tc.setChildren(res);
+ return res;
}
private TableContainer getTableContainer(Object o) {