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

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Feb 8 05:58:34 EST 2008


Author: max.andersen at jboss.com
Date: 2008-02-08 05:58:34 -0500 (Fri, 08 Feb 2008)
New Revision: 6200

Modified:
   trunk/
   trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java
Log:
Merged revisions 6199 via svnmerge from 
https://svn.jboss.org/repos/jbosstools/branches/jbosstools-2.0.x

........
  r6199 | max.andersen at jboss.com | 2008-02-08 11:41:59 +0100 (Fri, 08 Feb 2008) | 1 line
  
  JBIDE-1723 fixed broken add/delete launchconfiguration.
........



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/jbosstools-2.0.x:1-6135,6162,6165
   + /branches/jbosstools-2.0.x:1-6135,6162,6165,6199

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java	2008-02-08 10:41:59 UTC (rev 6199)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/AddConfigurationAction.java	2008-02-08 10:58:34 UTC (rev 6200)
@@ -21,6 +21,8 @@
  */
 package org.hibernate.eclipse.console.actions;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.eclipse.core.runtime.CoreException;
@@ -84,14 +86,26 @@
 			ILaunchConfigurationWorkingCopy wc = launchConfigurationType.newInstance(null, launchName);
 			wc.setAttribute(TEMPORARY_CONFIG_FLAG, true); 
 			ILaunchConfiguration saved = wc.doSave();			
-			int i = DebugUITools.openLaunchConfigurationPropertiesDialog( part.getSite().getShell(), saved, "org.eclipse.debug.ui.launchGroup.run" );
-			if(i!=Window.OK) {
-				saved.delete();
-			} else { 
-				wc = saved.getWorkingCopy();
-				wc.setAttribute(TEMPORARY_CONFIG_FLAG, (String)null); // Must be set to null since it should never be in the actual saved configuration!
-				wc.doSave();
+			int res = DebugUITools.openLaunchConfigurationPropertiesDialog( part.getSite().getShell(), saved, "org.eclipse.debug.ui.launchGroup.run" );
+			List<ILaunchConfiguration> listTempConfigs = new ArrayList<ILaunchConfiguration>(); 
+			ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(launchConfigurationType);
+			for (int i = 0; i < configs.length; i++) {
+				boolean temporary = configs[i].getAttribute(AddConfigurationAction.TEMPORARY_CONFIG_FLAG, false);
+				if (temporary) {
+					listTempConfigs.add(configs[i]);
+				}
 			}
+			if (res != Window.OK) {
+				for (int i = 0; i < listTempConfigs.size(); i++) {
+					listTempConfigs.get(i).delete();
+				}
+			} else {
+				for (int i = 0; i < listTempConfigs.size(); i++) {
+					wc = listTempConfigs.get(i).getWorkingCopy();
+					wc.setAttribute(TEMPORARY_CONFIG_FLAG, (String)null); // Must be set to null since it should never be in the actual saved configuration!
+					wc.doSave();
+				}
+			}
 			
 		} catch (CoreException ce) {
 			HibernateConsolePlugin.getDefault().showError( part.getSite().getShell(), "Problem adding a console configuration",  ce);




More information about the jbosstools-commits mailing list