[jbosstools-commits] JBoss Tools SVN: r22549 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jun 4 11:33:08 EDT 2010


Author: vyemialyanchyk
Date: 2010-06-04 11:33:07 -0400 (Fri, 04 Jun 2010)
New Revision: 22549

Modified:
   trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
   trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
https://jira.jboss.org/browse/JBIDE-6103 - fixed

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	2010-06-04 15:25:03 UTC (rev 22548)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java	2010-06-04 15:33:07 UTC (rev 22549)
@@ -84,6 +84,9 @@
 	/* TODO: move this out to the actual users of the configuraiton/sf ? */
 	private Configuration configuration;
 	private SessionFactory sessionFactory;
+	
+	// internal flag to prohibit long time profile refresh
+	private boolean rejectProfileRefresh = false;
 
 	/** Unique name for this configuration */
 	public String getName() {
@@ -208,6 +211,9 @@
 	}
 
 	protected void refreshProfile(IConnectionProfile profile) {
+		if (rejectProfileRefresh) {
+			return;
+		}
 		// refresh profile (refresh jpa connection):
 		// get fresh information about current db structure and update error markers  
 		if (profile.getConnectionState() == IConnectionProfile.CONNECTED_STATE){
@@ -818,4 +824,12 @@
 		return localCfg;
 	}
 
+	public boolean isRejectProfileRefresh() {
+		return rejectProfileRefresh;
+	}
+
+	public void setRejectProfileRefresh(boolean rejectProfileRefresh) {
+		this.rejectProfileRefresh = rejectProfileRefresh;
+	}
+
 }
\ No newline at end of file

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java	2010-06-04 15:25:03 UTC (rev 22548)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java	2010-06-04 15:33:07 UTC (rev 22549)
@@ -16,6 +16,8 @@
 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
 import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.osgi.util.NLS;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences;
 import org.hibernate.eclipse.console.HibernateConsoleMessages;
 import org.hibernate.eclipse.console.HibernateConsolePlugin;
 
@@ -58,6 +60,18 @@
 		if (!resUserClasses) {
 			setErrorMessage(HibernateConsoleMessages.ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default);
 		}
+		if (resUserClasses && resExistArchive) {
+			try {
+				ConsoleConfiguration ccTest = new ConsoleConfiguration(new EclipseLaunchConsoleConfigurationPreferences(launchConfig));
+				// should not try to connect to db - refresh profile try to create db connection
+				// so just reject this
+				ccTest.setRejectProfileRefresh(true);
+				ccTest.buildWith(null, false);
+			} catch (Exception ex) {
+				resUserClasses = false;
+				setErrorMessage(ex.getMessage());
+			}
+		}
 		return resUserClasses && resExistArchive;
 	}
 



More information about the jbosstools-commits mailing list