Author: vyemialyanchyk
Date: 2010-08-12 13:39:29 -0400 (Thu, 12 Aug 2010)
New Revision: 24117
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java
Log:
https://jira.jboss.org/browse/JBIDE-6773 - fixed
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2010-08-12
17:04:41 UTC (rev 24116)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2010-08-12
17:39:29 UTC (rev 24117)
@@ -73,6 +73,7 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.actions.AddConfigurationAction;
import org.hibernate.eclipse.console.utils.LaunchHelper;
+import org.hibernate.eclipse.launch.ConsoleConfigurationJavaClasspathTab;
import org.hibernate.eclipse.launch.ConsoleConfigurationMainTab;
import org.hibernate.eclipse.launch.ConsoleConfigurationTabGroup;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
@@ -568,16 +569,22 @@
setPathAttribute(currentLaunchConfig,
IConsoleConfigurationLaunchConstants.CFG_XML_FILE, configFullPath);
setStrAttribute(currentLaunchConfig,
IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY,
ConfigurationMode.CORE.toString());
ConsoleConfigurationMainTab ccmt = null;
+ ConsoleConfigurationJavaClasspathTab classpathTab = null;
ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
for (int i = 0; i < tabs.length; i++) {
if (tabs[i] instanceof ConsoleConfigurationMainTab) {
ccmt = (ConsoleConfigurationMainTab)tabs[i];
- break;
}
+ if (tabs[i] instanceof ConsoleConfigurationJavaClasspathTab) {
+ classpathTab = (ConsoleConfigurationJavaClasspathTab)tabs[i];
+ }
}
if (ccmt != null) {
ccmt.markConfigurationFileWillBeCreated();
}
+ if (classpathTab != null) {
+ classpathTab.markConfigurationFileWillBeCreated();
+ }
}
performInit();
dialogChanged();
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-08-12
17:04:41 UTC (rev 24116)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationJavaClasspathTab.java 2010-08-12
17:39:29 UTC (rev 24117)
@@ -17,6 +17,7 @@
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.osgi.util.NLS;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -27,6 +28,8 @@
*/
public class ConsoleConfigurationJavaClasspathTab extends JavaClasspathTab {
+ protected boolean configurationFileWillBeCreated = false;
+
public boolean isShowBootpath() {
return false;
}
@@ -61,13 +64,25 @@
setErrorMessage(HibernateConsoleMessages.ConsoleConfigurationTabGroup_classpath_must_be_set_or_restored_to_default);
}
if (resUserClasses && resExistArchive) {
- try {
- ConsoleConfiguration ccTest = new ConsoleConfiguration(new
EclipseLaunchConsoleConfigurationPreferences(launchConfig));
- ccTest.buildWith(null, false);
- } catch (Exception ex) {
- resUserClasses = false;
- setErrorMessage(ex.getMessage());
+ boolean flagTryToBuild = true;
+ ConsoleConfiguration ccTest = new ConsoleConfiguration(new
EclipseLaunchConsoleConfigurationPreferences(launchConfig));
+ if (configurationFileWillBeCreated) {
+ // do not make a try to build console configuration in case of
"configurationFileWillBeCreated" and
+ // exception to resolve the file
+ try {
+ ccTest.getConfigXMLFile();
+ } catch (HibernateConsoleRuntimeException ex) {
+ flagTryToBuild = false;
+ }
}
+ if (flagTryToBuild) {
+ try {
+ ccTest.buildWith(null, false);
+ } catch (Exception ex) {
+ resUserClasses = false;
+ setErrorMessage(ex.getMessage());
+ }
+ }
}
return resUserClasses && resExistArchive;
}
@@ -80,4 +95,8 @@
public boolean canSave() {
return super.canSave();
}
+
+ public void markConfigurationFileWillBeCreated() {
+ configurationFileWillBeCreated = true;
+ }
}