Author: vyemialyanchyk
Date: 2010-03-18 16:11:55 -0400 (Thu, 18 Mar 2010)
New Revision: 20918
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Copied:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui
(from rev 20855, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui)
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2010-03-16
18:50:31 UTC (rev 20855)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2010-03-18
20:11:55 UTC (rev 20918)
@@ -16,7 +16,7 @@
import java.util.Iterator;
import java.util.Set;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -42,11 +42,11 @@
*/
public class ElementsFactory {
- private final Configuration config;
+ private final ConfigurationStub config;
private final HashMap<String, OrmShape> elements;
private final ArrayList<Connection> connections;
- public ElementsFactory(Configuration config, HashMap<String, OrmShape> elements,
+ public ElementsFactory(ConfigurationStub config, HashMap<String, OrmShape>
elements,
ArrayList<Connection> connections) {
this.config = config;
this.elements = elements;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-03-16
18:50:31 UTC (rev 20855)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-03-18
20:11:55 UTC (rev 20918)
@@ -47,10 +47,9 @@
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.RootClass;
@@ -217,7 +216,7 @@
elements.clear();
connections.clear();
StringBuilder errorMessage = new StringBuilder();
- Configuration config = getConfig(errorMessage);
+ ConfigurationStub config = getConfig(errorMessage);
final ElementsFactory factory = new ElementsFactory(
config, elements, connections);
for (int i = 0; i < roots.size(); i++) {
@@ -363,7 +362,7 @@
}
public boolean refreshRootsFromNames() {
- final Configuration config = getConfig();
+ final ConfigurationStub config = getConfig();
if (config == null) {
return false;
}
@@ -779,20 +778,21 @@
return consoleConfigName;
}
- protected Configuration getConfig() {
+ protected ConfigurationStub getConfig() {
return getConfig(null);
}
- protected Configuration getConfig(StringBuilder error) {
+ protected ConfigurationStub getConfig(StringBuilder error) {
if (error != null) {
error.delete(0, error.length());
}
final ConsoleConfiguration consoleConfig = getConsoleConfig();
if (consoleConfig != null) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
// here just ignore this
if (error != null) {
@@ -804,14 +804,6 @@
}
}
}
- consoleConfig.execute(new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
return config;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2010-03-16
18:50:31 UTC (rev 20855)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2010-03-18
20:11:55 UTC (rev 20918)
@@ -27,9 +27,8 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
@@ -68,31 +67,24 @@
if (last_el instanceof PersistentClass) {
PersistentClass persClass = (PersistentClass) last_el;
setPC.add(persClass);
- } else if (last_el instanceof Configuration) {
- Configuration config = (Configuration)last_el;
+ } else if (last_el instanceof ConfigurationStub) {
+ ConfigurationStub config = (ConfigurationStub)last_el;
Iterator<PersistentClass> it =
(Iterator<PersistentClass>)(config.getClassMappings());
while (it.hasNext()) {
setPC.add(it.next());
}
} else if (last_el instanceof ConsoleConfiguration) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
HibernateConsolePlugin.getDefault().showError(
HibernateConsolePlugin.getShell(),
DiagramViewerMessages.OpenDiagramActionDelegate_could_not_load_configuration +
' ' + consoleConfig.getName(), he);
}
- consoleConfig.execute( new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
if (config != null) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2010-03-16
18:50:31 UTC (rev 20855)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2010-03-18
20:11:55 UTC (rev 20918)
@@ -24,11 +24,10 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.dialect.Dialect;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.engine.Mapping;
@@ -64,24 +63,17 @@
dialect = null;
}
- protected Configuration getConfig() {
+ protected ConfigurationStub getConfig() {
final ConsoleConfiguration consoleConfig = getConsoleConfig();
if (consoleConfig != null) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
// here just ignore this
}
- consoleConfig.execute(new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
return config;
@@ -152,7 +144,7 @@
if (sqlType != null) {
return false;
}
- final Configuration config = getConfig();
+ final ConfigurationStub config = getConfig();
if (mapping == null && config != null) {
mapping = config.buildMapping();
}