Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Refresh local when Program terminates.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/ChangeLog,v
retrieving revision 1.10
diff -u -r1.10 ChangeLog
--- ChangeLog	22 Nov 2002 04:31:05 -0000	1.10
+++ ChangeLog	22 Nov 2002 19:30:24 -0000
@@ -1,6 +1,14 @@
+2002-11-22 Alain Magloire
+
+	* src/.../internal/ui/LaunchUIPlugin.java (startup):
+	On startup add a listener to DebugPlugin for debug events.
+	(shutdown): remove the listener.
+	(handleDebugEvents): For Termination events do a refresh on
+	the project.
+
 2002-11-21 Alain Magloire
 
-	* src/../internal/ui/WorkingDirectoryBlock.java (setDefaultWorkingDir):
+	* src/.../internal/ui/WorkingDirectoryBlock.java (setDefaultWorkingDir):
 	Set the workspace directory default to be the Project.
 	* src/.../internal/LocalCLaunchConfigurationDelegate.java (launch):
 	Use the new function getWorkingDirectory(), it does more check by
Index: src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java,v
retrieving revision 1.5
diff -u -r1.5 LaunchUIPlugin.java
--- src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java	26 Sep 2002 12:57:45 -0000	1.5
+++ src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java	22 Nov 2002 19:30:24 -0000
@@ -1,8 +1,16 @@
 package org.eclipse.cdt.launch.internal.ui;
 
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.model.IProcess;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -12,7 +20,8 @@
  * (c) Copyright QNX Software Systems Ltd. 2002.
  * All Rights Reserved.
  */
-public class LaunchUIPlugin extends AbstractUIPlugin {
+public class LaunchUIPlugin extends AbstractUIPlugin
+	implements IDebugEventSetListener {
 
 	/**
 	 * Launch UI plug-in instance
@@ -133,4 +142,49 @@
 		}
 		return null;
 	}	
+	/**
+	 * @see org.eclipse.core.runtime.Plugin#shutdown()
+	 */
+	public void shutdown() throws CoreException {
+		DebugPlugin.getDefault().removeDebugEventListener(this);		
+		super.shutdown();
+	}
+
+	/**
+	 * @see org.eclipse.core.runtime.Plugin#startup()
+	 */
+	public void startup() throws CoreException {
+		super.startup();
+		DebugPlugin.getDefault().addDebugEventListener(this);
+	}
+	
+	/**
+	 * Notifies this listener of the given debug events.
+	 * All of the events in the given event collection occurred
+	 * at the same location the program be run or debugged.
+	 *
+	 * @param events the debug events
+	 */
+	public void handleDebugEvents(DebugEvent[] events) {
+		for (int i = 0; i < events.length; i++) {
+			if (events[i].getKind() == DebugEvent.TERMINATE) {
+				Object o = events[i].getSource();
+				if (o instanceof IProcess) {
+					IProcess proc = (IProcess)o;
+					ICProject cproject = null;
+					try {
+						cproject = AbstractCLaunchDelegate.getCProject(proc.getLaunch().getLaunchConfiguration());
+					} catch (CoreException e) {
+					}
+					if (cproject != null) {
+						try {
+							cproject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+						} catch (CoreException e) {
+						}
+					}
+				}
+			}
+		}
+	}	
+
 }



Back to the top