Author: dgeraskov
Date: 2009-08-06 08:26:44 -0400 (Thu, 06 Aug 2009)
New Revision: 16980
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.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4723
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-06
11:55:19 UTC (rev 16979)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java 2009-08-06
12:26:44 UTC (rev 16980)
@@ -10,9 +10,14 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
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;
/**
* @author Dmitry Geraskov
@@ -79,4 +84,16 @@
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;
+ }
+
}
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-06
11:55:19 UTC (rev 16979)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-08-06
12:26:44 UTC (rev 16980)
@@ -48,6 +48,7 @@
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
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.ui.HibernateJptUIPlugin;
/**
@@ -115,7 +116,7 @@
connectionProfileName.setEnabled(!selectMethod.getSelection());
schemaName.setEnabled(!selectMethod.getSelection());
dialectName.setEnabled(!selectMethod.getSelection());
- dialogChanged();
+ dialogChanged();
}});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = numColumns;
@@ -130,14 +131,15 @@
names[i] = configuration.getName();
}
consoleConfigurationName.setItems(names);
+ consoleConfigurationName.setText(HibernateJptPlugin.getDefaultConsoleConfiguration(jpaProject));
consoleConfigurationName.setDialogFieldListener(fieldlistener);
- consoleConfigurationName.doFillIntoGrid(container, numColumns);
-
+ consoleConfigurationName.doFillIntoGrid(container, numColumns);
+
createDBGroup(container, numColumns);
-
+
setControl(container);
}
-
+
/**
* @param parent
*/