Author: vyemialyanchyk
Date: 2010-03-26 12:36:54 -0400 (Fri, 26 Mar 2010)
New Revision: 21056
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/DefaultDatabaseCollectorStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HqlSqlTokenTypesStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/JDBCReaderStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/HqlBaseLexerStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/ParserHelper.java
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ConsoleConfigurationBasedAction.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ExecuteQueryAction.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenQueryEditorAction.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PropertyNode.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/AbstractTypeStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ClassMetadataStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/EnvironmentStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HibernateConsoleRuntimeException.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/IHQLCompletionRequestorStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PersistentClassStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PropertyStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/TypeStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
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/diagram/editors/model/SpecialOrmShape.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -121,8 +121,8 @@
public ConfigurationStub buildWith(final ConfigurationStub cfg, final boolean
includeMappings) {
if (classLoader == null) {
classLoader = createClassLoader();
+ executionContext = new DefaultExecutionContext(getName(), classLoader);
}
- executionContext = new DefaultExecutionContext(getName(), classLoader);
ConfigurationStub result = (ConfigurationStub) executionContext.execute(new
ExecutionContext.Command() {
public Object execute() {
ConfigurationStubFactory csf = new ConfigurationStubFactory(prefs);
@@ -224,9 +224,9 @@
}
protected ClassLoader getParentClassLoader() {
- return ClassLoader.getSystemClassLoader();
+ //return ClassLoader.getSystemClassLoader();
//return Thread.currentThread().getContextClassLoader().getParent().getParent();
- //return Thread.currentThread().getContextClassLoader();
+ return Thread.currentThread().getContextClassLoader();
}
public ConfigurationStub getConfiguration() {
return configStub;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -34,7 +34,6 @@
/**
* @author MAX
- *
*/
public class ClassNode extends BaseNode {
@@ -44,81 +43,76 @@
Object baseObject;
boolean childrenCreated = false;
- public ClassNode(NodeFactory factory, BaseNode parent, String name, ClassMetadataStub
metadata, Object baseObject, boolean objectGraph) {
+ public ClassNode(NodeFactory factory, BaseNode parent, String name, ClassMetadataStub
metadata,
+ Object baseObject, boolean objectGraph) {
+
super(factory, parent);
- this.name = name;
- this.baseObject = baseObject;
- this.objectGraph = objectGraph;
+ this.name = name;
+ this.baseObject = baseObject;
+ this.objectGraph = objectGraph;
md = metadata;
- if (md != null) { // Don't have any hibernate related info about this one...
- iconName = ImageConstants.MAPPEDCLASS;
- } else {
- iconName = ImageConstants.UNMAPPEDCLASS;
- }
+ if (md != null) { // Don't have any hibernate related info about this one...
+ iconName = ImageConstants.MAPPEDCLASS;
+ } else {
+ iconName = ImageConstants.UNMAPPEDCLASS;
+ }
}
protected void checkChildren() {
- if(!childrenCreated) {
+ if (!childrenCreated) {
createChildren();
childrenCreated = true;
}
}
protected void createChildren() {
- //System.out.println("Creating children for: " + this);
+ // System.out.println("Creating children for: " + this);
- if(objectGraph && getValue()==null || md == null) {
+ if (objectGraph && getValue() == null || md == null) {
return;
}
-
-
- // Identifier
- if(md.getIdentifierPropertyName()!=null) {
- children.add(0, factory.createIdentifierNode(this, md) );
- }
-
- String[] names = md.getPropertyNames();
- for (int i = 0; i < names.length; i++) {
- TypeStub type = md.getPropertyTypes()[i];
-
- if(type.isCollectionType() ) {
- PersistentCollectionNode tn =
factory.createPersistentCollectionNode(this, names[i], md, (CollectionTypeStub)type,
getValue(), objectGraph);
- children.add(tn);
- } else {
- children.add(factory.createPropertyNode(this, i, md, getValue(),
objectGraph) );
- }
- }
+ // Identifier
+ if (md.getIdentifierPropertyName() != null) {
+ children.add(0, factory.createIdentifierNode(this, md));
+ }
+ String[] names = md.getPropertyNames();
+ TypeStub[] types = md.getPropertyTypes();
+ for (int i = 0; i < names.length; i++) {
+ TypeStub type = types[i];
+ if (type.isCollectionType()) {
+ PersistentCollectionNode tn = factory.createPersistentCollectionNode(this,
+ names[i], md, (CollectionTypeStub) type, getValue(), objectGraph);
+ children.add(tn);
+ } else {
+ children.add(factory.createPropertyNode(this, i, md, getValue(), objectGraph));
+ }
+ }
}
public String getHQL() {
List<BaseNode> parents = new ArrayList<BaseNode>();
- BaseNode currentParent = this;
- while (currentParent != null && !(currentParent instanceof
ConfigurationEntitiesNode) ) {
- parents.add(currentParent);
- currentParent = currentParent.parent;
- }
-
- if(currentParent instanceof ConfigurationEntitiesNode) {
- currentParent = parents.get(parents.size()-1);
- }
-
- // currentParent is the root
- String cname = (
(ClassNode)currentParent).md.getMappedClass(EntityModeStub.POJO).getName();
-
+ BaseNode currentParent = this;
+ while (currentParent != null && !(currentParent instanceof
ConfigurationEntitiesNode)) {
+ parents.add(currentParent);
+ currentParent = currentParent.parent;
+ }
+ if (currentParent instanceof ConfigurationEntitiesNode) {
+ currentParent = parents.get(parents.size() - 1);
+ }
+ // currentParent is the root
+ String cname = ((ClassNode)
currentParent).md.getMappedClass(EntityModeStub.POJO).getName();
if (cname.lastIndexOf(".") != -1) { //$NON-NLS-1$
cname = cname.substring(cname.lastIndexOf(".") + 1); //$NON-NLS-1$
}
String alias = cname.toLowerCase();
-
String path = ""; //$NON-NLS-1$
- for (int i = parents.size()-2; i >= 0; i--) {
- path += "." + parents.get(i).getName(); //$NON-NLS-1$
+ for (int i = parents.size() - 2; i >= 0; i--) {
+ path += "." + parents.get(i).getName(); //$NON-NLS-1$
}
-
return "select " + alias + path + " from " + cname + " as
" + alias; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
@@ -127,24 +121,22 @@
}
public String renderLabel(boolean fullyQualifiedNames) {
- if(objectGraph) {
+ if (objectGraph) {
Object o = getValue();
- if(HibernateStub.isInitialized(o) ) {
- return super.renderLabel(fullyQualifiedNames) + " = " + o; //$NON-NLS-1$
+ if (HibernateStub.isInitialized(o)) {
+ return super.renderLabel(fullyQualifiedNames) + " = " + o; //$NON-NLS-1$
} else {
- return super.renderLabel(fullyQualifiedNames) + " = " +
ConsoleMessages.ClassNode_uninitialized_proxy; //$NON-NLS-1$
+ return super.renderLabel(fullyQualifiedNames)
+ + " = " + ConsoleMessages.ClassNode_uninitialized_proxy; //$NON-NLS-1$
}
-
- } else {
- return super.renderLabel(fullyQualifiedNames);
}
+ return super.renderLabel(fullyQualifiedNames);
}
public Object getValue() {
- if(objectGraph) {
+ if (objectGraph) {
return baseObject;
- } else {
- return null;
}
+ return null;
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -66,7 +66,7 @@
//return new RootNode(this, classes);
}
- public BaseNode createObjectNode(SessionStub sessionStub, Object o) throws
HibernateException {
+ public BaseNode createObjectNode(SessionStub sessionStub, Object o) {
ClassMetadataStub md = getMetaData(sessionStub.getEntityName(o));
return internalCreateClassNode(null, md.getEntityName(), md, o, false);
//return new ClassNode(this,null,md.getEntityName(),md,o,true);
@@ -154,18 +154,18 @@
public String getIconNameForType(TypeStub type) {
String result = ImageConstants.UNKNOWNPROPERTY;
- if(type.isEntityType() ) {
+ if (type.isEntityType()) {
EntityTypeStub et = (EntityTypeStub) type;
- if(!et.isOneToOne() ) {
+ if (!et.isOneToOne()) {
result = ImageConstants.MANYTOONE;
} else {
result = ImageConstants.ONETOONE;
}
- } else if (type.isAnyType() ) {
+ } else if (type.isAnyType()) {
result = ImageConstants.ANY;
- } else if (type.isComponentType() ) {
+ } else if (type.isComponentType()) {
result = ImageConstants.COMPONENT;
- } else if (type.isCollectionType() ) {
+ } else if (type.isCollectionType()) {
//CollectionType pct = (CollectionType)type;
result = ImageConstants.ONETOMANY; //could also be values/collecionts?
} else {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -71,10 +71,15 @@
if(collectionObject!=null) return collectionObject;
try {
collectionObject = md.getPropertyValue(baseObject, name, EntityModeStub.POJO);
- } catch (HibernateException e) {
- IllegalArgumentException iae = new
IllegalArgumentException(ConsoleMessages.PersistentCollectionNode_could_not_access_property_value);
- iae.initCause(e);
- throw iae;
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ IllegalArgumentException iae = new
IllegalArgumentException(ConsoleMessages.PersistentCollectionNode_could_not_access_property_value);
+ iae.initCause(he);
+ throw iae;
+ } else {
+ throw he;
+ }
}
return collectionObject;
}
@@ -120,13 +125,13 @@
}
protected void checkChildren() {
- if(!childrenCreated && objectGraph) {
+ if (!childrenCreated && objectGraph) {
initCollectionObject();
int idx = 0;
- if(!type.isArrayType() ) {
+ if (!type.isArrayType()) {
Iterator<?> i = ( (Collection<?>)collectionObject).iterator();
- while (i.hasNext() ) {
+ while (i.hasNext()) {
Object element = i.next();
children.add(createNode(idx++,element, elementType) );
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PropertyNode.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PropertyNode.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PropertyNode.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -40,8 +40,13 @@
return null;
}
return baseMetaData.getPropertyValue(baseObject, getName(), EntityModeStub.POJO);
- } catch (HibernateException e) {
- e.printStackTrace();
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ he.printStackTrace();
+ } else {
+ throw he;
+ }
return null;
}
} else {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/AbstractTypeStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/AbstractTypeStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/AbstractTypeStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -2,7 +2,7 @@
import org.hibernate.type.AbstractType;
-public abstract class AbstractTypeStub extends TypeStub {
+public class AbstractTypeStub extends TypeStub {
protected AbstractType abstractType;
protected AbstractTypeStub(Object abstractType) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ClassMetadataStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ClassMetadataStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ClassMetadataStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -20,7 +20,7 @@
for (int i = 0; i < types.length; i++) {
res[i] = TypeStubFactory.createTypeStub(types[i]);
}
- return null;
+ return res;
}
public String getIdentifierPropertyName() {
@@ -39,7 +39,6 @@
return TypeStubFactory.createTypeStub(classMetadata.getIdentifierType());
}
- // TODO: should be stub class
public Class getMappedClass(EntityModeStub pojo) {
return classMetadata.getMappedClass(pojo.entityMode);
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -4,6 +4,7 @@
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -15,6 +16,7 @@
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.FakeDelegatingDriver;
import org.hibernate.console.stubs.util.ReflectHelper;
+import org.hibernate.mapping.PersistentClass;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2x.Exporter;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
@@ -82,10 +84,14 @@
return (configuration.getNamingStrategy() != null);
}
- // TODO: temporary?
@SuppressWarnings("unchecked")
- public Iterator getClassMappings() {
- return configuration.getClassMappings();
+ public Iterator<PersistentClassStub> getClassMappings() {
+ Iterator<PersistentClass> it =
(Iterator<PersistentClass>)configuration.getClassMappings();
+ ArrayList<PersistentClassStub> arr = new ArrayList<PersistentClassStub>();
+ while (it.hasNext()) {
+ arr.add(PersistentClassStubFactory.createPersistentClassStub(it.next()));
+ }
+ return arr.iterator();
}
// TODO: temporary should be protected and/or PersistentClassStub?
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/DefaultDatabaseCollectorStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/DefaultDatabaseCollectorStub.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/DefaultDatabaseCollectorStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -0,0 +1,39 @@
+package org.hibernate.console.stubs;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.hibernate.cfg.reveng.DefaultDatabaseCollector;
+import org.hibernate.mapping.Table;
+
+public class DefaultDatabaseCollectorStub {
+ protected DefaultDatabaseCollector defaultDatabaseCollector;
+
+ protected DefaultDatabaseCollectorStub(Object defaultDatabaseCollector) {
+ this.defaultDatabaseCollector = (DefaultDatabaseCollector)defaultDatabaseCollector;
+ }
+
+ public static DefaultDatabaseCollectorStub newInstance() {
+ return new DefaultDatabaseCollectorStub(new DefaultDatabaseCollector());
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterator<Entry<String, List<TableStub>>> getQualifierEntries()
{
+ Iterator<Map.Entry<String, List<Table>>> it =
defaultDatabaseCollector.getQualifierEntries();
+ HashMap<String, List<TableStub>> map = new HashMap<String,
List<TableStub>>();
+ while (it.hasNext()) {
+ Map.Entry<String, List<Table>> entry = it.next();
+ ArrayList<TableStub> arr = new ArrayList<TableStub>();
+ Iterator<Table> itValue = (Iterator<Table>)entry.getValue().iterator();
+ while (itValue.hasNext()) {
+ arr.add(new TableStub(itValue.next()));
+ }
+ map.put(entry.getKey(), arr);
+ }
+ return map.entrySet().iterator();
+ }
+}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/EnvironmentStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/EnvironmentStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/EnvironmentStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -10,6 +10,13 @@
public class EnvironmentStub {
public static final String DIALECT = Environment.DIALECT;
+ public static final String DEFAULT_CATALOG = Environment.DEFAULT_CATALOG;
+ public static final String DEFAULT_SCHEMA = Environment.DEFAULT_SCHEMA;
+ public static final String DRIVER = Environment.DRIVER;
+ public static final String PASS = Environment.PASS;
+ public static final String SESSION_FACTORY_NAME = Environment.SESSION_FACTORY_NAME;
+ public static final String URL = Environment.URL;
+ public static final String USER = Environment.USER;
@SuppressWarnings("unchecked")
public static String[] extractHibernateProperties() {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HibernateConsoleRuntimeException.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HibernateConsoleRuntimeException.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HibernateConsoleRuntimeException.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -21,8 +21,6 @@
*/
package org.hibernate.console.stubs;
-import org.hibernate.HibernateException;
-
/**
* @author max
*
@@ -30,21 +28,16 @@
public class HibernateConsoleRuntimeException extends RuntimeException {
private static final long serialVersionUID = -9056528343206573782L;
-
- protected HibernateException he;
- public HibernateConsoleRuntimeException(String message, Object he) {
+ public HibernateConsoleRuntimeException(Throwable cause) {
+ super("HibernateConsoleRuntimeException", cause); //$NON-NLS-1$
+ }
+
+ public HibernateConsoleRuntimeException(String message) {
super(message);
- this.he = (HibernateException)he;
}
-
- public HibernateConsoleRuntimeException(String message, Throwable cause, Object he) {
+
+ public HibernateConsoleRuntimeException(String message, Throwable cause) {
super(message, cause);
- this.he = (HibernateException)he;
}
-
- public HibernateConsoleRuntimeException(Throwable cause, Object he) {
- super(cause);
- this.he = (HibernateException)he;
- }
}
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HqlSqlTokenTypesStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HqlSqlTokenTypesStub.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/HqlSqlTokenTypesStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -0,0 +1,7 @@
+package org.hibernate.console.stubs;
+
+import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+
+public class HqlSqlTokenTypesStub {
+ public static final int IDENT = HqlSqlTokenTypes.IDENT;
+}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/IHQLCompletionRequestorStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/IHQLCompletionRequestorStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/IHQLCompletionRequestorStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -1,13 +1,24 @@
package org.hibernate.console.stubs;
+import org.hibernate.tool.ide.completion.HQLCompletionProposal;
import org.hibernate.tool.ide.completion.IHQLCompletionRequestor;
public abstract class IHQLCompletionRequestorStub {
protected IHQLCompletionRequestor hqlCompletionRequestor;
- protected IHQLCompletionRequestorStub(Object hqlCompletionRequestor) {
-
+ protected IHQLCompletionRequestorStub() {
+ hqlCompletionRequestor = new IHQLCompletionRequestor() {
+
+ public boolean accept(HQLCompletionProposal proposal) {
+ return IHQLCompletionRequestorStub.this.accept(new
HQLCompletionProposalStub(proposal));
+ }
+
+ public void completionFailure(String errorMessage) {
+ IHQLCompletionRequestorStub.this.completionFailure(errorMessage);
+ }
+
+ };
}
public abstract boolean accept(HQLCompletionProposalStub proposal);
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/JDBCReaderStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/JDBCReaderStub.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/JDBCReaderStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -0,0 +1,27 @@
+package org.hibernate.console.stubs;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.hibernate.cfg.JDBCReaderFactory;
+import org.hibernate.cfg.reveng.JDBCReader;
+import org.hibernate.cfg.reveng.ProgressListener;
+import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
+
+public class JDBCReaderStub {
+
+ protected JDBCReader jdbcReader;
+
+ protected JDBCReaderStub(Properties cfg, SettingsStub settings,
ReverseEngineeringStrategy revengStrategy) {
+ jdbcReader = JDBCReaderFactory.newJDBCReader(cfg, settings.settings, revengStrategy);
+ }
+
+ public static JDBCReaderStub newInstance(Properties cfg, SettingsStub settings,
ReverseEngineeringStrategy revengStrategy) {
+ return new JDBCReaderStub(cfg, settings, revengStrategy);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List readDatabaseSchema(DefaultDatabaseCollectorStub dbs, String catalog, String
schema, ProgressListener progress) {
+ return jdbcReader.readDatabaseSchema(dbs.defaultDatabaseCollector, catalog, schema,
progress);
+ }
+}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PersistentClassStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PersistentClassStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PersistentClassStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -85,4 +85,14 @@
public String getNodeName() {
return persistentClass.getNodeName();
}
+
+ @SuppressWarnings("unchecked")
+ public Iterator<PropertyStub> getPropertyClosureIterator() {
+ Iterator<Property> it =
(Iterator<Property>)persistentClass.getPropertyClosureIterator();
+ ArrayList<PropertyStub> al = new ArrayList<PropertyStub>();
+ while (it.hasNext()) {
+ al.add(new PropertyStub(it.next()));
+ }
+ return al.iterator();
+ }
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PropertyStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PropertyStub.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/PropertyStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -5,7 +5,7 @@
public class PropertyStub {
protected Property property;
- protected PropertyStub(Object table) {
+ protected PropertyStub(Object property) {
this.property = (Property)property;
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -14,6 +14,8 @@
import org.hibernate.engine.query.HQLQueryPlan;
import org.hibernate.hql.QueryTranslator;
import org.hibernate.impl.SessionFactoryImpl;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.type.Type;
public class SessionStubFactory {
@@ -51,21 +53,34 @@
return res;
}
- // TODO: get rid of this - ClassMetadata - should not be public
@SuppressWarnings("unchecked")
public Map<String, ClassMetadataStub> getClassMetaData() {
if (sessionFactory == null) {
return new HashMap<String, ClassMetadataStub>();
}
- return sessionFactory.getAllClassMetadata();
+ Map<String, ClassMetadata> allClassMetadata =
sessionFactory.getAllClassMetadata();
+ Iterator<Map.Entry<String, ClassMetadata>> it =
allClassMetadata.entrySet().iterator();
+ Map<String, ClassMetadataStub> res = new HashMap<String,
ClassMetadataStub>();
+ while (it.hasNext()) {
+ Map.Entry<String, ClassMetadata> entry = it.next();
+ res.put(entry.getKey(), new ClassMetadataStub(entry.getValue()));
+ }
+ return res;
}
- // TODO: get rid of this - ClassMetadata - should not be public
+
@SuppressWarnings("unchecked")
public Map<String, CollectionMetadataStub> getCollectionMetaData() {
if (sessionFactory == null) {
return new HashMap<String, CollectionMetadataStub>();
}
- return sessionFactory.getAllCollectionMetadata();
+ Map<String, CollectionMetadata> allClassMetadata =
sessionFactory.getAllCollectionMetadata();
+ Iterator<Map.Entry<String, CollectionMetadata>> it =
allClassMetadata.entrySet().iterator();
+ Map<String, CollectionMetadataStub> res = new HashMap<String,
CollectionMetadataStub>();
+ while (it.hasNext()) {
+ Map.Entry<String, CollectionMetadata> entry = it.next();
+ res.put(entry.getKey(), new CollectionMetadataStub(entry.getValue()));
+ }
+ return res;
}
/**
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/TypeStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/TypeStubFactory.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/TypeStubFactory.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -1,16 +1,34 @@
package org.hibernate.console.stubs;
+import java.lang.reflect.Type;
+
public class TypeStubFactory {
@SuppressWarnings("unchecked")
public static TypeStub createTypeStub(Object value) {
final Class cl = value.getClass();
- if (0 == "org.hibernate.type.CollectionType".compareTo(cl.getName())) {
//$NON-NLS-1$
+ if (isClassOrOffspring(cl, "org.hibernate.type.CollectionType")) {
//$NON-NLS-1$
return new CollectionTypeStub(value);
//} else if (0 == "org.hibernate.type.Type".compareTo(cl.getName())) {
//$NON-NLS-1$
// return new TypeStub(value);
- } else if (0 == "org.hibernate.type.EntityType".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (isClassOrOffspring(cl, "org.hibernate.type.EntityType")) {
//$NON-NLS-1$
return new EntityTypeStub(value);
+ } else if (isClassOrOffspring(cl, "org.hibernate.type.NullableType")) {
//$NON-NLS-1$
+ return new NullableTypeStub(value);
}
- return null;
+ return new AbstractTypeStub(value);
}
+
+ protected static boolean isClassOrOffspring(final Class<?> cl, final String name)
{
+ if (cl == null || name == null) {
+ return false;
+ }
+ if (0 == name.compareTo(cl.getName())) {
+ return true;
+ }
+ Type type = cl.getGenericSuperclass();
+ if (type instanceof Class<?>) {
+ return isClassOrOffspring((Class<?>)type, name);
+ }
+ return false;
+ }
}
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/HqlBaseLexerStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/HqlBaseLexerStub.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/HqlBaseLexerStub.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -0,0 +1,31 @@
+package org.hibernate.console.stubs.util;
+
+import java.io.Reader;
+
+import org.hibernate.hql.antlr.HqlBaseLexer;
+
+import antlr.Token;
+import antlr.TokenStreamException;
+
+public class HqlBaseLexerStub {
+
+ protected HqlBaseLexer hqlBaseLexer;
+
+ protected HqlBaseLexerStub(HqlBaseLexer hqlBaseLexer) {
+ this.hqlBaseLexer = hqlBaseLexer;
+ }
+
+ public static HqlBaseLexerStub newInstance(Reader in) {
+ return new HqlBaseLexerStub(new HqlBaseLexer(in));
+ }
+
+ // TODO: antlr.Token -> TokenStub?
+ public Token nextToken() {
+ try {
+ return hqlBaseLexer.nextToken();
+ } catch (TokenStreamException e) {
+ return null;
+ }
+ }
+
+}
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/ParserHelper.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/ParserHelper.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/util/ParserHelper.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -0,0 +1,9 @@
+package org.hibernate.console.stubs.util;
+
+public class ParserHelper {
+ public static final String HQL_VARIABLE_PREFIX = ":"; //$NON-NLS-1$
+
+ public static final String HQL_SEPARATORS = "
\n\r\f\t,()=<>&|+-=/*'^![]#~\\"; //$NON-NLS-1$
+ //NOTICE: no " or . since they are part of (compound) identifiers
+ public static final String PATH_SEPARATORS = "."; //$NON-NLS-1$
+}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ConsoleConfigurationBasedAction.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ConsoleConfigurationBasedAction.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ConsoleConfigurationBasedAction.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -62,9 +62,14 @@
try {
doRun();
- } catch(HibernateException he) {
- String out =
NLS.bind(HibernateConsoleMessages.ConsoleConfigurationBasedAction_problem_while_executing,
getText(), he);
- HibernateConsolePlugin.getDefault().showError(null, out, he);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ String out =
NLS.bind(HibernateConsoleMessages.ConsoleConfigurationBasedAction_problem_while_executing,
getText(), he);
+ HibernateConsolePlugin.getDefault().showError(null, out, he);
+ } else {
+ throw he;
+ }
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/EditConsoleConfiguration.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -66,15 +66,25 @@
final ConsoleConfiguration config = (ConsoleConfiguration) node;
edit( config );
}
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.EditConsoleConfiguration_exception_while_edit_config, he);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.EditConsoleConfiguration_exception_while_edit_config, he);
+ } else {
+ throw he;
+ }
}
}
} else {
try {
edit(cfg);
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.EditConsoleConfiguration_exception_while_edit_config, he);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.EditConsoleConfiguration_exception_while_edit_config, he);
+ } else {
+ throw he;
+ }
}
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ExecuteQueryAction.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ExecuteQueryAction.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/ExecuteQueryAction.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -67,11 +67,16 @@
if (cfg.getConfiguration() == null) {
try {
cfg.build();
- } catch (HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(
- HibernateConsolePlugin.getShell(),
-
HibernateConsoleMessages.LoadConsoleCFGCompletionProposal_could_not_load_configuration
+
- ' ' + cfg.getName(), he);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(
+ HibernateConsolePlugin.getShell(),
+
HibernateConsoleMessages.LoadConsoleCFGCompletionProposal_could_not_load_configuration
+
+ ' ' + cfg.getName(), he);
+ } else {
+ throw he;
+ }
}
}
if (cfg.getConfiguration() != null) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenQueryEditorAction.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenQueryEditorAction.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenQueryEditorAction.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -35,8 +35,13 @@
try {
openQueryEditor( config, generateQuery(path) );
showed = true;
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.OpenQueryEditorAction_exception_open_hql_editor, he);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(null,
HibernateConsoleMessages.OpenQueryEditorAction_exception_open_hql_editor, he);
+ } else {
+ throw he;
+ }
}
}
return showed;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -64,8 +64,8 @@
import org.hibernate.console.ImageConstants;
import org.hibernate.console.QueryInputModel;
import org.hibernate.console.stubs.NullableTypeStub;
-import org.hibernate.console.stubs.TableStub;
import org.hibernate.console.stubs.TypeStub;
+import org.hibernate.console.stubs.util.ParserHelper;
import org.hibernate.console.stubs.util.StringHelper;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.QueryEditor;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -27,7 +27,6 @@
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osgi.util.NLS;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext.Command;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction;
@@ -88,10 +87,15 @@
// the view just react to config being
// build ?
}
- } catch (HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(
- viewer.getControl().getShell(),
- HibernateConsoleMessages.SchemaExportAction_exception_running_schemaexport, he );
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(
+ viewer.getControl().getShell(),
+ HibernateConsoleMessages.SchemaExportAction_exception_running_schemaexport, he );
+ } else {
+ throw he;
+ }
}
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -48,7 +48,8 @@
if (qp != null) {
SessionStub sessionStub = qp.getSessionStub();
String consoleConfigName = qp.getConsoleConfigName();
- if ((sessionStub.isOpen() && sessionStub.contains(obj)) ||
sessionStub.hasMetaData(obj)) {
+ if ((sessionStub.isOpen() && sessionStub.contains(obj)) ||
+ (obj != null && sessionStub.hasMetaData(obj))) {
res = new EntityPropertySource(obj, sessionStub);
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -37,7 +37,7 @@
@SuppressWarnings("unchecked")
public Object[] getChildren(Object o) {
ConfigurationStub cfg = (ConfigurationStub) o;
- Iterator<? extends PersistentClassStub> classMappings = cfg.getClassMappings();
+ Iterator<PersistentClassStub> classMappings = cfg.getClassMappings();
return toArray(classMappings, PersistentClassStub.class, new
Comparator<PersistentClassStub>() {
public int compare(PersistentClassStub p0, PersistentClassStub p1) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -31,14 +31,14 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.cfg.reveng.DefaultDatabaseCollector;
-import org.hibernate.cfg.reveng.JDBCReader;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.console.stubs.ConnectionProviderStub;
+import org.hibernate.console.stubs.DefaultDatabaseCollectorStub;
+import org.hibernate.console.stubs.JDBCReaderStub;
import org.hibernate.console.stubs.SettingsStub;
import org.hibernate.console.stubs.TableStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -51,10 +51,9 @@
return getChildren(o, new NullProgressMonitor());
}
- @SuppressWarnings("unchecked")
public synchronized Object[] getChildren(Object o, final IProgressMonitor monitor) {
LazyDatabaseSchema dbs = getLazyDatabaseSchema( o );
- final DefaultDatabaseCollector db = new DefaultDatabaseCollector();
+ final DefaultDatabaseCollectorStub db = DefaultDatabaseCollectorStub.newInstance();
ConsoleConfiguration consoleConfiguration = dbs.getConsoleConfiguration();
try{
@@ -63,7 +62,7 @@
List<TableContainer> result = new ArrayList<TableContainer>();
Iterator<Map.Entry<String, List<TableStub>>> qualifierEntries =
db.getQualifierEntries();
- while ( qualifierEntries.hasNext() ) {
+ while (qualifierEntries.hasNext()) {
Map.Entry<String, List<TableStub>> entry = qualifierEntries.next();
result.add(new TableContainer(entry.getKey(), entry.getValue()));
}
@@ -75,10 +74,15 @@
}
});
- } catch (HibernateException e){
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_problems_while_reading_database_schema,
e);
- String out =
NLS.bind(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_reading_schema_error,
e.getMessage());
- return new Object[]{out};
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_problems_while_reading_database_schema,
he);
+ String out =
NLS.bind(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_reading_schema_error,
he.getMessage());
+ return new Object[]{out};
+ } else {
+ throw he;
+ }
}
}
@@ -99,7 +103,7 @@
return getLazyDatabaseSchema(o).getConsoleConfiguration();
}
- protected void readDatabaseSchema(final IProgressMonitor monitor, final
DefaultDatabaseCollector db, ConsoleConfiguration consoleConfiguration, final
ReverseEngineeringStrategy strategy) {
+ protected void readDatabaseSchema(final IProgressMonitor monitor, final
DefaultDatabaseCollectorStub db, ConsoleConfiguration consoleConfiguration, final
ReverseEngineeringStrategy strategy) {
final ConfigurationStub configuration = consoleConfiguration.buildWith(null, false);
consoleConfiguration.execute(new ExecutionContext.Command() {
@@ -110,13 +114,17 @@
try {
connectionProvider = settings.getConnectionProvider();
- JDBCReader reader = JDBCReaderFactory.newJDBCReader(configuration.getProperties(),
settings, strategy);
+ JDBCReaderStub reader = JDBCReaderStub.newInstance(configuration.getProperties(),
settings, strategy);
reader.readDatabaseSchema(db, settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(), new ProgressListenerMonitor(monitor));
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_problem_while_reading_database_schema,
he);
- return new Object[] {
HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_schema_not_available};
- }
- finally {
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_problem_while_reading_database_schema,
he);
+ return new Object[] {
HibernateConsoleMessages.LazyDatabaseSchemaWorkbenchAdapter_schema_not_available};
+ } else {
+ throw he;
+ }
+ } finally {
if (connectionProvider!=null) {
connectionProvider.close();
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -23,7 +23,6 @@
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
import org.hibernate.console.ImageConstants;
@@ -33,18 +32,18 @@
public class PersistentClassWorkbenchAdapter extends BasicWorkbenchAdapter {
- @SuppressWarnings("unchecked")
public Object[] getChildren(Object o) {
PersistentClassStub pc = (PersistentClassStub) o;
PropertyStub identifierProperty = pc.getIdentifierProperty();
- List<PropertyStub> properties = new ArrayList<PropertyStub>();
-
- if(identifierProperty!=null) {
- properties.add(identifierProperty);
+ ArrayList<PropertyStub> res = new ArrayList<PropertyStub>();
+ Iterator<PropertyStub> it = pc.getPropertyClosureIterator();
+ while (it.hasNext()) {
+ res.add(it.next());
}
-
- Iterator<PropertyStub> propertyClosureIterator = new
JoinedIterator(properties.iterator(), pc.getPropertyClosureIterator());
- return toArray(propertyClosureIterator, PropertyStub.class, null);
+ if (identifierProperty != null) {
+ res.add(identifierProperty);
+ }
+ return res.toArray();
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -178,9 +178,14 @@
try {
consoleConfiguration.build();
consoleConfiguration.buildMappings();
- } catch (HibernateException e) {
- String mess =
NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc,
consoleConfiguration.getName());
- HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ String mess =
NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc,
consoleConfiguration.getName());
+ HibernateConsolePlugin.getDefault().logErrorMessage(mess, he);
+ } else {
+ throw he;
+ }
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -29,6 +29,7 @@
import org.eclipse.swt.graphics.Image;
import org.hibernate.console.stubs.CollectionStub;
import org.hibernate.console.stubs.EntityTypeStub;
+import org.hibernate.console.stubs.HibernateConsoleRuntimeException;
import org.hibernate.console.stubs.OneToManyStub;
import org.hibernate.console.stubs.PropertyStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -96,8 +97,13 @@
this.addSourceAssociation( pava );
target.addTargetAssociation( pava );
}
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().logWarning( he );
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logWarning( new
HibernateConsoleRuntimeException("", he) ); //$NON-NLS-1$
+ } else {
+ throw he;
+ }
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -33,9 +33,8 @@
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.eclipse.console.workbench.HibernateWorkbenchHelper;
import org.hibernate.tool.ide.completion.HQLCompletionProposal;
-import org.hibernate.tool.ide.completion.IHQLCompletionRequestor;
-public class EclipseHQLCompletionRequestor implements IHQLCompletionRequestorStub {
+public class EclipseHQLCompletionRequestor extends IHQLCompletionRequestorStub {
private final List<ICompletionProposal> result = new
ArrayList<ICompletionProposal>();
private String lastErrorMessage;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -27,9 +27,10 @@
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
+import org.hibernate.console.stubs.HqlSqlTokenTypesStub;
+import org.hibernate.console.stubs.util.HqlBaseLexerStub;
import antlr.Token;
-import antlr.TokenStreamException;
public class HQLLexerRule implements IRule {
@@ -40,7 +41,7 @@
}
public IToken evaluate(final ICharacterScanner scanner) {
- HqlBaseLexer lexer = new HqlBaseLexer(new Reader() {
+ HqlBaseLexerStub lexer = HqlBaseLexerStub.newInstance(new Reader() {
public void close() throws IOException {
// noop
@@ -66,16 +67,10 @@
}
});
- try {
- Token token = lexer.nextToken();
- if(token.getType()==HqlSqlTokenTypes.IDENT) {
- return hqlToken;
- }
- }
- catch (TokenStreamException e) {
- // undefined
- }
-
+ Token token = lexer.nextToken();
+ if (token != null && token.getType() == HqlSqlTokenTypesStub.IDENT) {
+ return hqlToken;
+ }
return org.eclipse.jface.text.rules.Token.UNDEFINED;
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -234,9 +234,14 @@
LazyDatabaseSchema lazyDatabaseSchema = new LazyDatabaseSchema(configuration,
repository.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()));
return lazyDatabaseSchema;
- } catch(HibernateException he) {
- HibernateConsolePlugin.getDefault().showError(getContainer().getShell(),
MapperMessages.ReverseEngineeringEditor_error_while_refreshing_databasetree, he);
- return null;
+ } catch(RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().showError(getContainer().getShell(),
MapperMessages.ReverseEngineeringEditor_error_while_refreshing_databasetree, he);
+ return null;
+ } else {
+ throw he;
+ }
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2010-03-26
16:36:54 UTC (rev 21056)
@@ -59,9 +59,9 @@
<objectContribution id="diagramEditorAction"
objectClass="java.lang.Object">
<visibility>
<or>
- <objectClass name="org.hibernate.cfg.Configuration"/>
+ <objectClass
name="org.hibernate.console.stubs.ConfigurationStub"/>
<objectClass
name="org.hibernate.console.ConsoleConfiguration"/>
- <objectClass name="org.hibernate.mapping.PersistentClass"/>
+ <objectClass
name="org.hibernate.console.stubs.PersistentClassStub"/>
</or>
</visibility>
<action
Modified:
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/diagram/editors/model/OrmDiagram.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -792,15 +792,20 @@
try {
consoleConfig.build();
consoleConfig.buildMappings();
- } catch (HibernateException he) {
- // here just ignore this
- if (error != null) {
- error.append(consoleConfigName);
- error.append(": "); //$NON-NLS-1$
- error.append(he.getMessage());
- if (error.length() == 0) {
- error.append(he.getCause());
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) {
//$NON-NLS-1$
+ // here just ignore this
+ if (error != null) {
+ error.append(consoleConfigName);
+ error.append(": "); //$NON-NLS-1$
+ error.append(he.getMessage());
+ if (error.length() == 0) {
+ error.append(he.getCause());
+ }
}
+ } else {
+ throw he;
}
}
config = consoleConfig.getConfiguration();
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -17,7 +17,6 @@
import org.hibernate.console.stubs.PropertyStub;
import org.hibernate.console.stubs.RootClassStub;
import org.hibernate.console.stubs.TypeStub;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
/**
*
@@ -33,7 +32,6 @@
/**
* creates children of the shape,
*/
- @SuppressWarnings("unchecked")
@Override
protected void initModel() {
RootClassStub rootClass = (RootClassStub)getOrmElement();
@@ -61,12 +59,7 @@
return fField.getValue().getType();
}});
} else {
- try{
- type = field.getValue().getType();
- } catch (MappingException e) {
- //type is not accessible
- HibernateConsolePlugin.getDefault().logErrorMessage("MappingException: ",
e); //$NON-NLS-1$
- }
+ type = field.getValue().getType();
}
Shape bodyOrmShape = null;
if (type != null && type.isEntityType()) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -69,10 +69,15 @@
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
- } catch (InvalidMappingException ex){
- String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
- new Object[]{testPackage.getElementName(), ex.getMessage()});
- fail(out);
+ } catch (RuntimeException ex) {
+ // TODO: RuntimeException ? - find correct solution
+ if (ex.getClass().getName().contains("InvalidMappingException")) {
//$NON-NLS-1$
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
+ fail(out);
+ } else {
+ throw ex;
+ }
}
if (persClasses.length > 0){
Modified:
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -76,10 +76,15 @@
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
- } catch (InvalidMappingException ex){
- String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
- new Object[]{testPackage.getElementName(), ex.getMessage()});
- fail(out);
+ } catch (RuntimeException ex) {
+ // TODO: RuntimeException ? - find correct solution
+ if (ex.getClass().getName().contains("InvalidMappingException")) {
//$NON-NLS-1$
+ String out =
NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
+ new Object[]{testPackage.getElementName(), ex.getMessage()});
+ fail(out);
+ } else {
+ throw ex;
+ }
}
if (persClasses.length > 0) {
final String testClass = "class"; //$NON-NLS-1$
Modified:
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -78,10 +78,15 @@
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
- } catch (InvalidMappingException ex) {
- String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
- testPackage.getElementName(), ex.getMessage());
- fail(out);
+ } catch (RuntimeException ex) {
+ // TODO: RuntimeException ? - find correct solution
+ if (ex.getClass().getName().contains("InvalidMappingException")) {
//$NON-NLS-1$
+ String out =
NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
+ testPackage.getElementName(), ex.getMessage());
+ fail(out);
+ } else {
+ throw ex;
+ }
}
if (persClasses.length > 0) {
for (int i = 0; i < persClasses.length; i++) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2010-03-26
16:23:10 UTC (rev 21055)
+++
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2010-03-26
16:36:54 UTC (rev 21056)
@@ -170,8 +170,13 @@
try {
ccfg.checkQuery("from TestClass where id = #{some.id.field}", false);
//$NON-NLS-1$
fail("should have failed with EL expressions!"); //$NON-NLS-1$
- } catch (HibernateException he) {
- // ok
+ } catch (RuntimeException he) {
+ // TODO: RuntimeException ? - find correct solution
+ if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
+ // ok
+ } else {
+ throw he;
+ }
}
ccfg.checkQuery("from TestClass where id = #{some.id.field}", true);
//$NON-NLS-1$