Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Launch fix

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/ChangeLog,v
retrieving revision 1.17
diff -u -r1.17 ChangeLog
--- ChangeLog	6 Jan 2003 22:09:37 -0000	1.17
+++ ChangeLog	16 Jan 2003 19:22:32 -0000
@@ -1,3 +1,12 @@
+2003-01-16 David Inglis
+	* src/.../launch/AbstractCLaunchDelegate.java
+	add check for program existance on disk before launch
+		
+	* src/.../launch/internal/ui/AbstractCDebuggerTab.java
+	* src/.../launch/ui/CDebuggerTab.java
+	* src/.../launch/ui/CorefileDebuggerTab.java
+	Fixed http://bugs.eclipse.org/bugs/show_bug.cgi?id=29532
+
 2003-01-06 Alain Magloire

 	* build.properties: Patch from Judy Green.
Index: src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java,v
retrieving revision 1.13
diff -u -r1.13 AbstractCLaunchDelegate.java
--- src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java	6 Jan 2003 22:02:39 -0000	1.13
+++ src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java	16 Jan 2003 19:22:33 -0000
@@ -396,7 +396,7 @@
 		}

 		IFile projectPath = ((IProject) cproject.getResource()).getFile(fileName);
-		if (projectPath == null || !projectPath.exists()) {
+		if (projectPath == null || !projectPath.exists() || !projectPath.getLocation().toFile().exists()) {
 			abort("Program file does not exist", null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
 		}
 		return projectPath.getLocation();
@@ -510,7 +510,7 @@

 		private String parseToken() {
 			StringBuffer buf = new StringBuffer();
-
+			
 			while (ch > 0 && !Character.isWhitespace((char) ch)) {
 				if (ch == '\\') {
 					ch = getNext();
Index: src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java,v
retrieving revision 1.3
diff -u -r1.3 AbstractCDebuggerTab.java
--- src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java	8 Oct 2002 11:51:11 -0000	1.3
+++ src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java	16 Jan 2003 19:22:33 -0000
@@ -26,6 +26,7 @@
 	// Dynamic Debugger UI widgets
 	protected ILaunchConfigurationTab fDynamicTab;
 	protected Composite fDynamicTabHolder;
+	private boolean fInitDefaults;

 	protected void setDebugConfig(ICDebugConfiguration config) {
 		fCurrentDebugConfig = config;
@@ -76,8 +77,7 @@
 		ILaunchConfigurationTab tab = getDynamicTab();
 		if ((super.getErrorMessage() != null) || (tab == null)) {
 			return super.getErrorMessage();
-		}
-		else {
+		} else {
 			return tab.getErrorMessage();
 		}
 	}
@@ -100,23 +100,24 @@
 			if (wc != null) {
 				wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
 			}
-		}
-		else {
+		} else {
 			if (wc == null) {
 				try {
 					if (getLaunchConfiguration().isWorkingCopy()) {
-						// get a fresh copy to work on
-						wc = ((ILaunchConfigurationWorkingCopy) getLaunchConfiguration()).getOriginal().getWorkingCopy();
+						setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy)getLaunchConfiguration());
+					} else {
+						setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy());
 					}
-					else {
-						wc = getLaunchConfiguration().getWorkingCopy();
-					}
-				}
-				catch (CoreException e) {
+					wc = getLaunchConfigurationWorkingCopy();
+
+				} catch (CoreException e) {
 					return;
 				}
 			}
-			getDynamicTab().setDefaults(wc);
+			if (initDefaults()) {
+				getDynamicTab().setDefaults(wc);
+			}
+			setInitializeDefault(false);
 			getDynamicTab().initializeFrom(wc);
 		}
 		updateLaunchConfigurationDialog();
@@ -137,9 +138,12 @@
 		ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
 		if (debugConfig == null) {
 			setDynamicTab(null);
-		}
-		else {
+		} else {
 			setDynamicTab(CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID()));
+			ICDebugConfiguration oldConfig = getDebugConfig();
+			if ( oldConfig != null && oldConfig != debugConfig ) {
+				setInitializeDefault(true);
+			}
 		}
 		setDebugConfig(debugConfig);
 		if (getDynamicTab() == null) {
@@ -165,13 +169,12 @@
 	}

 	public void performApply(ILaunchConfigurationWorkingCopy config) {
-		if ( getDebugConfig() != null ) {
+		if (getDebugConfig() != null) {
 			config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID());
 			ILaunchConfigurationTab dynamicTab = getDynamicTab();
 			if (dynamicTab == null) {
 				config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
-			}
-			else {
+			} else {
 				dynamicTab.performApply(config);
 			}
 		}
@@ -182,6 +185,7 @@
 		ILaunchConfigurationTab dynamicTab = getDynamicTab();
 		if (dynamicTab != null) {
 			dynamicTab.setDefaults(config);
+			setInitializeDefault(false);
 		}
 	}

@@ -198,6 +202,14 @@
 			return dynamicTab.isValid(config);
 		}
 		return true;
+	}
+
+	protected void setInitializeDefault(boolean init) {
+		fInitDefaults = init;
+	}
+
+	protected boolean initDefaults() {
+		return fInitDefaults;
 	}

 }
Index: src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java,v
retrieving revision 1.18
diff -u -r1.18 CDebuggerTab.java
--- src/org/eclipse/cdt/launch/ui/CDebuggerTab.java	13 Nov 2002 16:37:51 -0000	1.18
+++ src/org/eclipse/cdt/launch/ui/CDebuggerTab.java	16 Jan 2003 19:22:33 -0000
@@ -132,6 +132,9 @@
 				}
 			}
 		}
+		// if no selection meaning nothing in config the force initdefault on tab
+		setInitializeDefault(selection.equals("") ? true : false);
+		
 		fDCombo.select(selndx == -1 ? 0 : selndx);
 		//The behaviour is undefined for if the callbacks should be triggered for this,
 		//so to avoid unnecessary confusion, we force an update.
Index: src/org/eclipse/cdt/launch/ui/CorefileDebuggerTab.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CorefileDebuggerTab.java,v
retrieving revision 1.5
diff -u -r1.5 CorefileDebuggerTab.java
--- src/org/eclipse/cdt/launch/ui/CorefileDebuggerTab.java	13 Nov 2002 14:01:09 -0000	1.5
+++ src/org/eclipse/cdt/launch/ui/CorefileDebuggerTab.java	16 Jan 2003 19:22:33 -0000
@@ -99,6 +99,9 @@
 				}
 			}
 		}
+		// if no selection meaning nothing in config the force initdefault on tab
+		setInitializeDefault(selection.equals("") ? true : false);
+
 		fDCombo.select(selndx == -1 ? 0 : selndx);
 		//The behaviour is undefined for if the callbacks should be triggered for this,
 		//so to avoid unnecessary confusion, we force an update.



Back to the top