Author: vyemialyanchyk
Date: 2009-04-17 06:58:13 -0400 (Fri, 17 Apr 2009)
New Revision: 14792
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
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/GenerateEntitiesWizard.java
Log:
JBIDE-4141
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2009-04-17
10:57:56 UTC (rev 14791)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/plugin.xml 2009-04-17
10:58:13 UTC (rev 14792)
@@ -3,10 +3,11 @@
<plugin>
<extension
id="org.jboss.tools.hibernate.jpt"
- point="org.eclipse.jpt.ui.jpaPlatform">
- <jpaPlatform
-
class="org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI"
+ point="org.eclipse.jpt.ui.jpaPlatformUis">
+ <jpaPlatformUi
+
factoryClass="org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUiFactory"
+ jpaPlatform="hibernate"
id="hibernate">
- </jpaPlatform>
+ </jpaPlatformUi>
</extension>
</plugin>
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUiFactory.java 2009-04-17
10:58:13 UTC (rev 14792)
@@ -0,0 +1,29 @@
+package org.jboss.tools.hibernate.jpt.ui.internal.platform;
+
+import org.eclipse.jpt.ui.JpaPlatformUi;
+import org.eclipse.jpt.ui.JpaPlatformUiFactory;
+import org.eclipse.jpt.ui.internal.GenericJpaPlatformUiProvider;
+import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericJpaPlatformUiFactory;
+import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorProvider;
+import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
+import org.eclipse.jpt.ui.internal.structure.PersistenceResourceModelStructureProvider;
+
+public class HibernateJpaPlatformUiFactory implements JpaPlatformUiFactory {
+
+ public HibernateJpaPlatformUiFactory() {
+ super();
+ }
+
+ public JpaPlatformUi buildJpaPlatformUi() {
+ return new HibernateJpaPlatformUi(
+ new HibernateJpaUiFactory(),
+ new GenericNavigatorProvider(),
+ JavaResourceModelStructureProvider.instance(),
+ PersistenceResourceModelStructureProvider.instance(),
+ GenericJpaPlatformUiProvider.instance()
+ );
+ }
+
+}
Copied:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java
(from rev 14606,
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateUiFactory.java)
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaUiFactory.java 2009-04-17
10:58:13 UTC (rev 14792)
@@ -0,0 +1,62 @@
+package org.jboss.tools.hibernate.jpt.ui.internal.platform;
+
+import java.util.ArrayList;
+import java.util.ListIterator;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.ui.WidgetFactory;
+import org.eclipse.jpt.ui.details.JpaPageComposite;
+import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
+import
org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitConnectionComposite;
+import
org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitPropertiesComposite;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
+import
org.jboss.tools.hibernate.jpt.ui.internal.persistence.details.HibernatePropertiesComposite;
+import org.jboss.tools.hibernate.jpt.ui.xpl.PersistenceUnitGeneralComposite;
+
+public class HibernateJpaUiFactory extends GenericJpaUiFactory {
+
+ public ListIterator createPersistenceUnitComposites(
+ PropertyValueModel<PersistenceUnit> subjectHolder, Composite parent,
WidgetFactory widgetFactory) {
+
+ ArrayList<JpaPageComposite> pages = new ArrayList<JpaPageComposite>(1);
+
+ //replaced from Dali 2.0
+ pages.add(new PersistenceUnitGeneralComposite(subjectHolder, parent, widgetFactory));
+ pages.add(new PersistenceUnitConnectionComposite(subjectHolder, parent,
widgetFactory));
+ pages.add(new PersistenceUnitPropertiesComposite(subjectHolder, parent,
widgetFactory));
+
+ // ************Hibernate pages***************
+ PropertyValueModel<HibernatePersistenceUnit> hibernatePersistenceUnitHolder =
this
+ .buildHibernatePersistenceUnitHolder(subjectHolder);
+
+ PropertyValueModel<BasicHibernateProperties> basicHolder =
this.buildBasicHolder(hibernatePersistenceUnitHolder);
+ pages.add(new HibernatePropertiesComposite(basicHolder, parent, widgetFactory));
+
+ return pages.listIterator();
+ }
+
+ private PropertyValueModel<BasicHibernateProperties> buildBasicHolder(
+ PropertyValueModel<HibernatePersistenceUnit> subjectHolder) {
+ return new TransformationPropertyValueModel<HibernatePersistenceUnit,
BasicHibernateProperties>(subjectHolder) {
+ @Override
+ protected BasicHibernateProperties transform_(HibernatePersistenceUnit value) {
+ return value.getBasicProperties();
+ }
+ };
+ }
+
+ private PropertyValueModel<HibernatePersistenceUnit>
buildHibernatePersistenceUnitHolder(
+ PropertyValueModel<PersistenceUnit> subjectHolder) {
+ return new TransformationPropertyValueModel<PersistenceUnit,
HibernatePersistenceUnit>(subjectHolder) {
+ @Override
+ protected HibernatePersistenceUnit transform_(PersistenceUnit value) {
+ return (HibernatePersistenceUnit) value;
+ }
+ };
+ }
+
+}
\ No newline at end of file
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-04-17
10:57:56 UTC (rev 14791)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-04-17
10:58:13 UTC (rev 14792)
@@ -23,7 +23,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
+import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
/**
* @author Dmitry Geraskov
@@ -52,7 +52,7 @@
@Override
public boolean performFinish() {
String projectName = jpaProject.getName();
- ILaunchConfigurationWorkingCopy wc =
HibernatePlatformUI.createDefaultLaunchConfig(projectName);
+ ILaunchConfigurationWorkingCopy wc =
HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
String concoleConfigurationName = initPage.getConfigurationName();
wc.setAttribute(HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME,
concoleConfigurationName);
@@ -63,8 +63,8 @@
prop.put("format", "true"); //$NON-NLS-1$ //$NON-NLS-2$
prop.put("scriptToConsole", "false"); //$NON-NLS-1$
//$NON-NLS-2$
- wc.setAttribute(HibernatePlatformUI.full_exporter_id + ".properties", prop);
//$NON-NLS-1$
- wc.setAttribute(HibernatePlatformUI.full_exporter_id + ".extension_id",
HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".properties",
prop); //$NON-NLS-1$
+ wc.setAttribute(HibernateJpaPlatformUi.full_exporter_id + ".extension_id",
HibernateLaunchConstants.ATTR_PREFIX + "hbm2ddl"); //$NON-NLS-1$ //$NON-NLS-2$
try {
wc.launch(ILaunchManager.RUN_MODE, null);
} catch (CoreException e) {
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-04-17
10:57:56 UTC (rev 14791)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-04-17
10:58:13 UTC (rev 14792)
@@ -20,7 +20,7 @@
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
-import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernatePlatformUI;
+import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
/**
* @author Dmitry Geraskov
@@ -53,7 +53,7 @@
@Override
public boolean performFinish() {
String projectName = jpaProject.getName();
- ILaunchConfigurationWorkingCopy wc =
HibernatePlatformUI.createDefaultLaunchConfig(projectName);
+ ILaunchConfigurationWorkingCopy wc =
HibernateJpaPlatformUi.createDefaultLaunchConfig(projectName);
if (wc != null) {
// SHOULD PRESENT THE CONFIGURATION!!!
String concoleConfigurationName = initPage.getConfigurationName();
@@ -72,7 +72,7 @@
wc.setAttribute("hibernate.dialect",
"org.hibernate.dialect.PostgreSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
wc.setAttribute("hibernate.temp.use_jdbc_metadata_defaults", true);
//$NON-NLS-1$
- wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + '.' +
HibernatePlatformUI.exporter_id + ".extension_id", //$NON-NLS-1$
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + '.' +
HibernateJpaPlatformUi.exporter_id + ".extension_id", //$NON-NLS-1$
HibernateLaunchConstants.ATTR_PREFIX + "hbm2java"); //$NON-NLS-1$
try {
wc.launch(ILaunchManager.RUN_MODE, null);