Author: dgeraskov
Date: 2009-08-18 09:34:19 -0400 (Tue, 18 Aug 2009)
New Revision: 17129
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4761
Added HibernateProject-point to add hibernate specific methods
(getNamingStrategy/ConsoleConfiguration)
Added listener to ConsoleConfiguration build process.
Added NamingStrategy support in default db object's name.
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>ConcoleConfigurationListener</code>
interface.
+ * <p>
+ * Classes that wish to deal with <code>ConcoleConfiguration</code> events
can
+ * extend this class and override only the methods which they are
+ * interested in.
+ * </p>
+ *
+ * @see ConcoleConfigurationListener
+ * @see ConcoleConfiguration
+ *
+ * @author Dmitry Geraskov
+ */
+public abstract class ConcoleConfigurationAdapter implements
+ ConsoleConfigurationListener {
+
+ public void queryPageCreated(QueryPage qp) {}
+
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
+ SessionFactory builtSessionFactory) {}
+
+ public void sessionFactoryClosing(ConsoleConfiguration configuration,
+ SessionFactory aboutToCloseFactory) {}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg){};
+}
Property changes on:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -110,6 +110,7 @@
public void build() {
configuration = buildWith(null, true);
+ fireConfigurationBuilt();
}
private Configuration buildJPAConfiguration(String persistenceUnit, Properties
properties, String entityResolver, boolean includeMappings) {
@@ -552,8 +553,13 @@
});
}
+
+ private void fireConfigurationBuilt() {
+ for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ view.configurationBuilt(this);
+ }
+ }
-
private void fireQueryPageCreated(QueryPage qp) {
for (ConsoleConfigurationListener view : consoleCfgListeners) {
view.queryPageCreated(qp);
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -43,5 +43,7 @@
* @param closedSessionFactory TODO
*/
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory
aboutToCloseFactory);
+
+ public void configurationBuilt(ConsoleConfiguration ccfg);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -66,7 +66,7 @@
private QueryPageModel queryPages = new QueryPageModel();
private List<KnownConfigurationsListener> configurationListeners = new
ArrayList<KnownConfigurationsListener>();
private Map<String, ConsoleConfiguration> configurations;
- private ConsoleConfigurationListener sfListener = new ConsoleConfigurationListener() {
+ private ConsoleConfigurationListener sfListener = new ConcoleConfigurationAdapter() {
public void sessionFactoryClosing(final ConsoleConfiguration configuration, final
SessionFactory closingFactory) {
fireNotification(new Notification() {
@@ -87,6 +87,14 @@
public void queryPageCreated(QueryPage qp) {
queryPages.add(qp);
}
+
+ public void configurationBuilt(final ConsoleConfiguration ccfg) {
+ fireNotification(new Notification() {
+ public void notify(KnownConfigurationsListener listener) {
+ listener.configurationBuilt(ccfg);
+ }
+ });
+ };
};
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+import org.hibernate.SessionFactory;
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>KnownConfigurationsListener</code>
interface.
+ * <p>
+ * Classes that wish to deal with <code>KnownConfigurations</code> events
can
+ * extend this class and override only the methods which they are
+ * interested in.
+ * </p>
+ *
+ * @see KnownConfigurationsListener
+ * @see KnownConfigurations
+ *
+ * @author Dmitry Geraskov
+ */
+
+public abstract class KnownConfigurationsAdapter implements KnownConfigurationsListener
{
+
+ public void configurationAdded(ConsoleConfiguration root) {}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg) {}
+
+ public void configurationRemoved(ConsoleConfiguration root,
+ boolean forUpdate) {}
+
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
+ SessionFactory builtFactory) {}
+
+ public void sessionFactoryClosing(ConsoleConfiguration configuration,
+ SessionFactory closingFactory) {}
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -27,6 +27,8 @@
public interface KnownConfigurationsListener {
public void configurationAdded(ConsoleConfiguration root);
+ public void configurationBuilt(ConsoleConfiguration ccfg);
+
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory
builtFactory);
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory
closingFactory);
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -24,10 +24,9 @@
import java.util.Arrays;
import java.util.Comparator;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.KnownConfigurationsListener;
+import org.hibernate.console.KnownConfigurationsAdapter;
/**
* @author max
@@ -42,7 +41,7 @@
super(null,null);
this.kc = kc;
- kc.addConsoleConfigurationListener(new KnownConfigurationsListener() {
+ kc.addConsoleConfigurationListener(new KnownConfigurationsAdapter() {
public void configurationAdded(ConsoleConfiguration root) {
markChildrenForReload();
}
@@ -55,14 +54,6 @@
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
markChildrenForReload();
}
-
- public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory
closingFactory) {
- }
-
- public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory
builtFactory) {
- // TODO Auto-generated method stub
-
- }
});
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -22,11 +22,10 @@
package org.hibernate.console.node;
import org.hibernate.SessionFactory;
+import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ConsoleConfigurationListener;
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.ImageConstants;
-import org.hibernate.console.QueryPage;
/**
* @author max
@@ -40,7 +39,7 @@
public ConfigurationNode(BaseNode parent, ConsoleConfiguration configuration) {
super(null,parent);
this.configuration = configuration;
- configuration.addConsoleConfigurationListener(new ConsoleConfigurationListener() {
+ configuration.addConsoleConfigurationListener(new ConcoleConfigurationAdapter() {
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory
builtSessionFactory) {
clear();
}
@@ -48,8 +47,6 @@
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory
closedSessionFactory) {
clear();
}
-
- public void queryPageCreated(QueryPage qp) { }
});
name = configuration.getName();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -11,6 +11,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.KnownConfigurationsListener;
final class ConfigurationCombo extends ComboContribution {
@@ -38,7 +39,7 @@
Control control = super.createControl( parent );
- listener = new KnownConfigurationsListener() {
+ listener = new KnownConfigurationsAdapter() {
public void sessionFactoryClosing(
ConsoleConfiguration configuration,
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -54,10 +54,10 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.hibernate.HibernateException;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.KnownConfigurationsListener;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.actions.AddConfigurationAction;
@@ -126,20 +126,8 @@
private void listenForConfigurations() {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- kcl = new KnownConfigurationsListener() {
+ kcl = new KnownConfigurationsAdapter() {
- public void sessionFactoryClosing(ConsoleConfiguration configuration,
- SessionFactory closingFactory) {
- // TODO Auto-generated method stub
-
- }
-
- public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
- SessionFactory builtFactory) {
- // TODO Auto-generated method stub
-
- }
-
/**
* @param root
* @param forUpdate - shows whether physical removal necessary
@@ -153,12 +141,6 @@
}
}
}
-
- public void configurationAdded(ConsoleConfiguration root) {
- // TODO Auto-generated method stub
-
- }
-
};
KnownConfigurations.getInstance().addConsoleConfigurationListener(kcl);
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 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -104,4 +104,8 @@
}
});
}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg) {
+ //TODO refresh tree?
+ }
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-08-18
13:34:19 UTC (rev 17129)
@@ -24,5 +24,6 @@
org.jboss.tools.hibernate.jpt.core.internal.context.java
Bundle-Localization: plugin
Bundle-Activator: org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin
+Bundle-ActivationPolicy: lazy
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -10,12 +10,21 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaEmbeddable;
import org.eclipse.jpt.core.context.java.JavaEntity;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.context.java.JavaColumn.Owner;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
@@ -23,10 +32,16 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaColumn;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEmbeddable;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntity;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntityImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaIdMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaJoinColumn;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaManyToManyMapping;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaManyToOneMapping;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaOneToManyMapping;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaOneToOneMapping;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaParameter;
import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedNativeQueryImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryImpl;
@@ -41,13 +56,21 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJpaFactory extends GenericJpaFactory {
+
+ // ********** Core Model **********
+ public JpaProject buildJpaProject(JpaProject.Config config) throws CoreException {
+ return new HibernateJpaProject(config);
+ }
+ // ********** Persistence Context Model **********
@Override
public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit
persistenceUnit) {
return new HibernatePersistenceUnit(parent, persistenceUnit);
}
+ // ********** Java Context Model **********
@Override
public JavaEntity buildJavaEntity(JavaPersistentType parent) {
return new HibernateJavaEntityImpl(parent);
@@ -82,5 +105,40 @@
public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) {
return new HibernateJavaEmbeddable(parent);
}
+
+ @Override
+ public JavaColumn buildJavaColumn(JavaJpaContextNode parent, Owner owner) {
+ return new HibernateJavaColumn(parent, owner);
+ }
+
+ @Override
+ public JavaOneToManyMapping buildJavaOneToManyMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaOneToManyMapping(parent);
+ }
+
+ @Override
+ public JavaManyToManyMapping buildJavaManyToManyMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaManyToManyMapping(parent);
+ }
+
+ @Override
+ public JavaManyToOneMapping buildJavaManyToOneMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaManyToOneMapping(parent);
+ }
+
+ @Override
+ public JavaOneToOneMapping buildJavaOneToOneMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaOneToOneMapping(parent);
+ }
+
+ @Override
+ public JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent,
+ org.eclipse.jpt.core.context.java.JavaJoinColumn.Owner owner) {
+ return new HibernateJavaJoinColumn(parent, owner);
+ }
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.internal.AbstractJpaProject;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class HibernateJpaProject extends AbstractJpaProject {
+
+
+ public HibernateJpaProject(JpaProject.Config config) throws CoreException {
+ super(config);
+ }
+
+ public NamingStrategy getNamingStrategy(){
+ String ccName = getDefaultConsoleConfigurationName();
+ if (ccName != null || "".equals(ccName)){//$NON-NLS-1$
+ ConsoleConfiguration cc = KnownConfigurations.getInstance().find(ccName);
+ if (cc != null){
+ if (cc.getConfiguration() != null){
+ Configuration config = cc.getConfiguration();
+ return config.getNamingStrategy();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getDefaultConsoleConfigurationName(){
+ IScopeContext scope = new ProjectScope(getProject());
+ Preferences node = scope.getNode("org.hibernate.eclipse.console");
//$NON-NLS-1$
+ if(node!=null) {
+ return node.get("default.configuration", getName() ); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -10,19 +10,25 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jpt.core.JpaProject;
-import org.osgi.service.prefs.Preferences;
+import org.eclipse.jpt.core.internal.JpaModelManager;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
+import org.osgi.framework.BundleContext;
/**
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJptPlugin extends Plugin {
public static final String ID = "org.jboss.tools.hibernate.jpt.core";
//$NON-NLS-1$
@@ -84,16 +90,51 @@
log(IStatus.INFO, message, null);
}
- public static String getDefaultConsoleConfiguration(JpaProject jpaProject){
- IProject project = jpaProject.getProject();
- IScopeContext scope = new ProjectScope(project);
-
- Preferences node = scope.getNode("org.hibernate.eclipse.console");
//$NON-NLS-1$
-
- if(node!=null) {
- return node.get("default.configuration", project.getName() ); //$NON-NLS-1$
- }
- return null;
- }
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ KnownConfigurations.getInstance().addConsoleConfigurationListener(new
KnownConfigurationsAdapter(){
+
+ private void revalidateProjects(ConsoleConfiguration ccfg){
+ //FIXME: call only Dali's validator
+ try {
+ Iterator<JpaProject> jpaProjects =
JpaModelManager.instance().getJpaModel().jpaProjects();
+ while (jpaProjects.hasNext()) {
+ JpaProject jpaProject = (JpaProject) jpaProjects.next();
+ if (jpaProject instanceof HibernateJpaProject) {
+ String ccName =
((HibernateJpaProject)jpaProject).getDefaultConsoleConfigurationName();
+ if (ccfg.getName().equals(ccName)){
+ jpaProject.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD,
null);
+ }
+ }
+
+
+ }
+ } catch (CoreException e) {
+ logException(e);
+ }
+ }
+
+ @Override
+ public void configurationBuilt(ConsoleConfiguration ccfg) {
+ if (ccfg.getConfiguration() == null
+ || ccfg.getConfiguration().getNamingStrategy() == null){
+ return;
+ }
+ revalidateProjects(ccfg);
+ }
+
+ @Override
+ public void configurationRemoved(ConsoleConfiguration root,
+ boolean forUpdate) {
+ if(forUpdate || root.getConfiguration() == null
+ || root.getConfiguration().getNamingStrategy() == null) {
+ return;
+ }
+ revalidateProjects(root);
+ }
+
+ });
+ }
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
+import org.eclipse.jpt.core.context.RelationshipMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.db.Table;
+import org.hibernate.cfg.NamingStrategy;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class NamingStrategyMappingTools extends MappingTools {
+
+ public static String buildJoinTableDefaultName(RelationshipMapping relationshipMapping)
{
+ if (relationshipMapping.getJpaProject().getDataSource().connectionProfileIsActive()) {
+ return buildDbJoinTableDefaultName(relationshipMapping);
+ }
+ // continue with a "best effort":
+ String owningTableName = relationshipMapping.getTypeMapping().getPrimaryTableName();
+ if (owningTableName == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String targetTableName = targetEntity.getPrimaryTableName();
+ if (targetTableName == null) {
+ return null;
+ }
+ NamingStrategy namingStrategy
=((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String name =
namingStrategy.collectionTableName(relationshipMapping.getEntity().getPersistentType().getName(),
+ owningTableName, targetEntity.getPersistentType().getName(), targetTableName,
relationshipMapping.getName());
+ Table primaryTable = relationshipMapping.getTypeMapping().getPrimaryDbTable();
+ return primaryTable.getDatabase().convertNameToIdentifier(name);
+ }
+ return owningTableName + '_' + targetTableName;
+ }
+
+ protected static String buildDbJoinTableDefaultName(RelationshipMapping
relationshipMapping) {
+ Table owningTable = relationshipMapping.getTypeMapping().getPrimaryDbTable();
+ if (owningTable == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ Table targetTable = targetEntity.getPrimaryDbTable();
+ if (targetTable == null) {
+ return null;
+ }
+ NamingStrategy namingStrategy =
((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String name =
namingStrategy.collectionTableName(relationshipMapping.getEntity().getPersistentType().getName(),
+ owningTable.getName(), targetEntity.getPersistentType().getName(),
targetTable.getName(), relationshipMapping.getName());
+ return owningTable.getDatabase().convertNameToIdentifier(name);
+ }
+ String name = owningTable.getName() + '_' + targetTable.getName();
+ return owningTable.getDatabase().convertNameToIdentifier(name);
+ }
+
+ public static String buildJoinColumnDefaultName(JoinColumn joinColumn) {
+ JoinColumn.Owner owner = joinColumn.getOwner();
+ RelationshipMapping relationshipMapping = owner.getRelationshipMapping();
+ if (relationshipMapping == null) {
+ return null;
+ }
+ if (owner.joinColumnsSize() != 1) {
+ return null;
+ }
+ String prefix = owner.getAttributeName();
+ Entity targetEntity = owner.getTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String targetEntityName = targetEntity.getName();
+ // not sure which of these is correct...
+ // (the spec implies that the referenced column is always the
+ // primary key column of the target entity)
+ // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn();
+ String targetColumnName = joinColumn.getReferencedColumnName();
+
+ NamingStrategy namingStrategy =
((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String logicalTargetColumnName = namingStrategy.logicalColumnName(targetColumnName,
prefix);
+ String name = namingStrategy.foreignKeyColumnName(prefix,
+ targetEntity.getPersistentType().getName(),
+ targetEntity.getPrimaryTableName(),
+ logicalTargetColumnName);
+ return targetEntity.getPrimaryDbTable().getDatabase().convertNameToIdentifier(name);
+ }
+ if (prefix == null) {
+ prefix = targetEntityName;
+ }
+ if (targetColumnName == null) {
+ return null;
+ }
+ String name = prefix + '_' + targetColumnName;
+ // not sure which of these is correct...
+ // converting the name to an identifier will result in the identifier
+ // being delimited nearly every time (at least on non-Sybase/MS
+ // databases); but that probably is not the intent of the spec...
+ // return targetColumn.getDatabase().convertNameToIdentifier(name);
+ return name;
+ }
+
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,30 @@
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaColumn;
+import org.hibernate.cfg.NamingStrategy;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
+
+@SuppressWarnings("restriction")
+public class HibernateJavaColumn extends GenericJavaColumn {
+
+ public HibernateJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public HibernateJpaProject getJpaProject() {
+ return (HibernateJpaProject) super.getJpaProject();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ NamingStrategy namingStrategy = getJpaProject().getNamingStrategy();
+ if (namingStrategy != null && super.buildDefaultName() != null){
+ return namingStrategy.propertyToColumnName(super.buildDefaultName());
+ }
+ return super.buildDefaultName();
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -16,12 +16,18 @@
import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.BaseJoinColumn;
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
import org.eclipse.jpt.core.context.java.JavaGenerator;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaQuery;
+import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn.Owner;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -29,7 +35,9 @@
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.hibernate.cfg.NamingStrategy;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaFactory;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.core.internal.context.GenericGenerator;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
@@ -46,6 +54,7 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJavaEntityImpl extends AbstractJavaEntity
implements HibernateJavaEntity {
@@ -86,6 +95,11 @@
return (HibernateJpaFactory) this.getJpaPlatform().getJpaFactory();
}
+ @Override
+ public HibernateJpaProject getJpaProject() {
+ return (HibernateJpaProject) super.getJpaProject();
+ }
+
@SuppressWarnings("unchecked")
@Override
public Iterator<JavaQuery> queries() {
@@ -450,4 +464,63 @@
}
return null;
}
+
+ protected String getResourceDefaultName() {
+ NamingStrategy namingStrategy = getJpaProject().getNamingStrategy();
+ if (namingStrategy != null){
+ return namingStrategy.classToTableName(javaResourcePersistentType.getName());
+ }
+ return javaResourcePersistentType.getName();
+ }
+
+ @Override
+ protected Owner createPrimaryKeyJoinColumnOwner() {
+ return new HibernatePrimaryKeyJoinColumnOwner();
+ }
+
+ // ********** pk join column owner **********
+
+ class HibernatePrimaryKeyJoinColumnOwner implements JavaBaseJoinColumn.Owner
+ {
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return HibernateJavaEntityImpl.this.getValidationTextRange(astRoot);
+ }
+
+ public TypeMapping getTypeMapping() {
+ return HibernateJavaEntityImpl.this;
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return HibernateJavaEntityImpl.this.getDbTable(tableName);
+ }
+
+ public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
+ Entity parentEntity = HibernateJavaEntityImpl.this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return HibernateJavaEntityImpl.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean isVirtual(BaseJoinColumn joinColumn) {
+ return HibernateJavaEntityImpl.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String getDefaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = HibernateJavaEntityImpl.this.getParentEntity();
+ NamingStrategy ns = HibernateJavaEntityImpl.this.getJpaProject().getNamingStrategy();
+ if (ns == null)
+ return parentEntity.getPrimaryKeyColumnName();
+
+ String name = ns.joinKeyColumnName(parentEntity.getPrimaryKeyColumnName(),
+ parentEntity.getPrimaryTableName());
+ return parentEntity.getPrimaryDbTable().getDatabase().convertNameToIdentifier(name) ;
+ }
+ }
}
+
+
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaJoinColumn;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class HibernateJavaJoinColumn extends GenericJavaJoinColumn {
+
+ public HibernateJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return NamingStrategyMappingTools.buildJoinColumnDefaultName(this);
+ }
+
+
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaManyToManyMapping extends
+ GenericJavaManyToManyMapping {
+
+ public HibernateJavaManyToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToOneMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaManyToOneMapping extends GenericJavaManyToOneMapping {
+
+
+ public HibernateJavaManyToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaOneToManyMapping extends GenericJavaOneToManyMapping {
+
+ public HibernateJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToOneMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaOneToOneMapping extends GenericJavaOneToOneMapping {
+
+ public HibernateJavaOneToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -27,6 +27,7 @@
import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider;
import org.eclipse.jpt.ui.structure.JpaStructureProvider;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateDdlWizard;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateEntitiesWizard;
@@ -35,6 +36,8 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class HibernateJpaPlatformUi extends GenericJpaPlatformUi {
public static final String LaunchConfigurationType_ID =
"org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType";
//$NON-NLS-1$
@@ -54,7 +57,7 @@
@Override
public void generateEntities(JpaProject project, IStructuredSelection selection) {
- GenerateEntitiesWizard wizard = new GenerateEntitiesWizard(project, selection);
+ GenerateEntitiesWizard wizard = new GenerateEntitiesWizard((HibernateJpaProject)
project, selection);
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.open();
@@ -62,7 +65,7 @@
@Override
public void generateDDL(JpaProject project, IStructuredSelection selection) {
- GenerateDdlWizard wizard = new GenerateDdlWizard(project, selection);
+ GenerateDdlWizard wizard = new GenerateDdlWizard((HibernateJpaProject) project,
selection);
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.open();
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -18,10 +18,10 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
@@ -29,14 +29,16 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateDdlWizard extends Wizard {
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
private GenerateDdlWizardPage initPage;
- public GenerateDdlWizard(JpaProject jpaProject, IStructuredSelection selection) {
+ public GenerateDdlWizard(HibernateJpaProject jpaProject, IStructuredSelection selection)
{
super();
this.jpaProject = jpaProject;
this.setWindowTitle( JptUiMessages.GenericPlatformUiDialog_notSupportedMessageTitle);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -14,19 +14,21 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.swt.widgets.Composite;
import org.hibernate.util.StringHelper;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateDdlWizardPage extends GenerateInitWizardPage {
private StringDialogField filename;
- protected GenerateDdlWizardPage(JpaProject jpaProject) {
+ protected GenerateDdlWizardPage(HibernateJpaProject jpaProject) {
super(jpaProject);
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -15,10 +15,10 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
@@ -26,15 +26,17 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateEntitiesWizard extends Wizard {
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
private GenerateEntitiesWizardPage initPage;
- public GenerateEntitiesWizard( JpaProject jpaProject, IStructuredSelection selection) {
+ public GenerateEntitiesWizard( HibernateJpaProject jpaProject, IStructuredSelection
selection) {
super();
this.jpaProject = jpaProject;
this.setWindowTitle( JptUiMessages.GenerateEntitiesWizard_generateEntities);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -21,12 +21,14 @@
import org.eclipse.swt.widgets.Composite;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.launch.PathHelper;
-import org.hibernate.util.StringHelper;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateEntitiesWizardPage extends GenerateInitWizardPage {
private StringDialogField packageName;
@@ -34,7 +36,7 @@
/**
* @param pageName
*/
- public GenerateEntitiesWizardPage(JpaProject jpaProject) {
+ public GenerateEntitiesWizardPage(HibernateJpaProject jpaProject) {
super(jpaProject);
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -50,13 +50,15 @@
import org.hibernate.eclipse.launch.PathHelper;
import org.hibernate.tool.hbm2x.StringUtils;
import org.hibernate.util.StringHelper;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public abstract class GenerateInitWizardPage extends WizardPage {
private static final String AUTODETECT = Messages.GenerateInitWizardPage_autodetect;
@@ -77,7 +79,7 @@
private Group dbGroup;
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
protected int numColumns = 3;
@@ -87,7 +89,7 @@
}
};
- public GenerateInitWizardPage(JpaProject jpaProject){
+ public GenerateInitWizardPage(HibernateJpaProject jpaProject){
super("", Messages.GenerateInitWizardPage_title, null); //$NON-NLS-1$
this.jpaProject = jpaProject;
}
@@ -153,7 +155,7 @@
names[i] = configuration.getName();
}
consoleConfigurationName.setItems(names);
- consoleConfigurationName.setText(HibernateJptPlugin.getDefaultConsoleConfiguration(jpaProject));
+ consoleConfigurationName.setText(jpaProject.getDefaultConsoleConfigurationName());
consoleConfigurationName.setDialogFieldListener(fieldlistener);
consoleConfigurationName.doFillIntoGrid(container, numColumns);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -9,8 +9,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.hibernate.SessionFactory;
+import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ConsoleConfigurationListener;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
@@ -125,7 +125,7 @@
}
- static class MockCCListener implements ConsoleConfigurationListener {
+ static class MockCCListener extends ConcoleConfigurationAdapter {
int factoryBuilt = 0;
int factoryClosing = 0;
public int queryCreated;
@@ -143,9 +143,6 @@
public void queryPageCreated(QueryPage qp) {
queryCreated++;
}
-
-
-
}
public void testBuildConfiguration() {
@@ -155,7 +152,7 @@
consoleCfg.addConsoleConfigurationListener(listener);
consoleCfg.build();
-
+
assertEquals(0, listener.factoryBuilt);
consoleCfg.buildSessionFactory();
assertEquals(1, listener.factoryBuilt);
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-08-18
12:10:46 UTC (rev 17128)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-08-18
13:34:19 UTC (rev 17129)
@@ -11,7 +11,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.KnownConfigurationsListener;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.w3c.dom.Element;
@@ -21,7 +21,7 @@
super( name );
}
- static class CCListener implements KnownConfigurationsListener {
+ static class CCListener extends KnownConfigurationsAdapter {
List<ConsoleConfiguration> added = new ArrayList<ConsoleConfiguration>();