fixed executables view merge problems - bug #'s 9562, 9568, 9571.
authorwpaul
Fri, 07 Aug 2009 13:47:27 -0500
changeset 60 3982fab6369e
parent 59 a612e067382b
child 61 ff389f2cc4aa
fixed executables view merge problems - bug #'s 9562, 9568, 9571.
cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ISourceFileRemapping.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/StandardExecutableProvider.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/executables/StandardSourceFileRemapping.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesContentProvider.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesView.java
cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesViewer.java
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java	Fri Aug 07 13:47:27 2009 -0500
@@ -64,55 +64,51 @@
  * @author Ken Ryall
  * 
  */
-public class ExecutablesManager extends PlatformObject implements IResourceChangeListener, ICProjectDescriptionListener { 
+public class ExecutablesManager extends PlatformObject implements IResourceChangeListener, ICProjectDescriptionListener {
 
-	private static final String EXECUTABLES_MANAGER_DEBUG_TRACING = CDebugCorePlugin.PLUGIN_ID + "EXECUTABLES_MANAGER_DEBUG_TRACING"; //$NON-NLS-1$ 
+	private static final String EXECUTABLES_MANAGER_DEBUG_TRACING = CDebugCorePlugin.PLUGIN_ID + "EXECUTABLES_MANAGER_DEBUG_TRACING"; //$NON-NLS-1$
 	
-	private Map<IProject, IProjectExecutablesProvider> executablesProviderMap = new HashMap<IProject, IProjectExecutablesProvider>(); 
-	private Map<IProject, List<Executable>> executablesMap = new HashMap<IProject, List<Executable>>();  
-	private List<IExecutablesChangeListener> changeListeners = Collections.synchronizedList(new ArrayList<IExecutablesChangeListener>());  
-	private List<IProjectExecutablesProvider> executableProviders;  
-	private List<ISourceFilesProvider> sourceFileProviders;  
-	private List<ISourceFileRemapping> sourceFileRemappings;  
-	private List<IExecutableImporter> executableImporters; 
+	private Map<IProject, IProjectExecutablesProvider> executablesProviderMap = new HashMap<IProject, IProjectExecutablesProvider>();
+	private Map<IProject, List<Executable>> executablesMap = new HashMap<IProject, List<Executable>>();
+	private List<IExecutablesChangeListener> changeListeners = Collections.synchronizedList(new ArrayList<IExecutablesChangeListener>());
+	private List<IProjectExecutablesProvider> executableProviders;
+	private List<ISourceFilesProvider> sourceFileProviders;
+	private List<ISourceFileRemapping> sourceFileRemappings;
+	private List<IExecutableImporter> executableImporters;
 	
 	private boolean DEBUG;
 	
-	private final Job refreshJob = new Job("Get Executables") {
+	private Job refreshJob = new Job("Get Executables") {
 
 		@Override
 		public IStatus run(IProgressMonitor monitor) {
+				
+			trace("Get Executables job started at " + getStringFromTimestamp(System.currentTimeMillis()));
+			
+			List<IProject> projects = getProjectsToCheck();
 
-			trace("Get Executables job started at "
-					+ getStringFromTimestamp(System.currentTimeMillis()));
-			List<IProject> projects = getProjectsToCheck();
-			SubMonitor subMonitor = SubMonitor
-					.convert(monitor, projects.size());
+			SubMonitor subMonitor = SubMonitor.convert(monitor, projects.size());
+
 			for (IProject project : projects) {
 				if (subMonitor.isCanceled()) {
-					trace("Get Executables job cancelled at "
-							+ getStringFromTimestamp(System.currentTimeMillis()));
+					trace("Get Executables job cancelled at " + getStringFromTimestamp(System.currentTimeMillis()));
 					return Status.CANCEL_STATUS;
 				}
-
+				
 				subMonitor.subTask("Checking project: " + project.getName());
 
 				// get the executables provider for this project
 				IProjectExecutablesProvider provider = getExecutablesProviderForProject(project);
 				if (provider != null) {
-					trace("Getting executables for project: "
-							+ project.getName() + " using "
-							+ provider.toString());
+					trace("Getting executables for project: " + project.getName() + " using " + provider.toString());
 
 					// store the list of executables for this project
 					synchronized (executablesMap) {
-						executablesMap.put(project, provider.getExecutables(
-								project, subMonitor.newChild(1,
-										SubMonitor.SUPPRESS_NONE)));
+						executablesMap.put(project, provider.getExecutables(project, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)));
 					}
 				}
 			}
-
+			
 			// notify the listeners
 			synchronized (changeListeners) {
 				for (IExecutablesChangeListener listener : changeListeners) {
@@ -120,19 +116,18 @@
 				}
 			}
 
-			trace("Get Executables job finished at "
-					+ getStringFromTimestamp(System.currentTimeMillis()));
+			trace("Get Executables job finished at " + getStringFromTimestamp(System.currentTimeMillis()));
 
 			return Status.OK_STATUS;
 		}
 	};
 
 	private static ExecutablesManager executablesManager = null;
-	
-	/**   
-	 * Get the executables manager instance 
-	 * @return the executables manager 
-	 * */ 
+
+	/**
+	 * Get the executables manager instance
+	 * @return the executables manager
+	 */
 	public static ExecutablesManager getExecutablesManager() {
 		if (executablesManager == null)
 			executablesManager = new ExecutablesManager();
@@ -140,73 +135,88 @@
 	}
 
 	public ExecutablesManager() {
-		// check if debugging is enabled  
-		BundleContext context = CDebugCorePlugin.getDefault().getBundle().getBundleContext();  
-		if (context != null) {  
-			ServiceReference reference = CDebugCorePlugin.getDefault().getBundle().getBundleContext().getServiceReference(  
-					DebugOptions.class.getName());  
-			if (reference != null) {  
-				DebugOptions service = (DebugOptions) context.getService(reference);  
-				if (service != null) {  
-					try {  
-						DEBUG = service.getBooleanOption(EXECUTABLES_MANAGER_DEBUG_TRACING, false);  
-				} finally {  
-					// we have what we want - release the service  
-					context.ungetService(reference);  
-					}  
-				}  
-				}  
-			}  
 		
-		refreshJob.setPriority(Job.SHORT);  
-		
-		// load the extension points  
-		loadExecutableProviderExtensions();  
-		loadSoureFileProviderExtensions();  
-		loadSoureRemappingExtensions();  
-		loadExecutableImporterExtensions();  
+		// check if debugging is enabled
+		BundleContext context = CDebugCorePlugin.getDefault().getBundle().getBundleContext();
+		if (context != null) {
+			ServiceReference reference = CDebugCorePlugin.getDefault().getBundle().getBundleContext().getServiceReference(DebugOptions.class.getName());
+			if (reference != null) {
+				DebugOptions service = (DebugOptions) context.getService(reference);
+				if (service != null) {
+					try {
+						DEBUG = service.getBooleanOption(EXECUTABLES_MANAGER_DEBUG_TRACING, false);
+					} finally {
+						// we have what we want - release the service
+						context.ungetService(reference);
+					}
+				}
+			}
+		}
+
+		refreshJob.setPriority(Job.SHORT);
 		
-		// add the standard providers  
-		executableProviders.add(0, new StandardExecutableProvider());  
-		sourceFileProviders.add(0, new StandardSourceFilesProvider());  
-		sourceFileRemappings.add(0, new StandardSourceFileRemapping());  
-		executableImporters.add(0, new StandardExecutableImporter());  
+		// load the extension points
+		loadExecutableProviderExtensions();
+		loadSoureFileProviderExtensions();
+		loadSoureRemappingExtensions();
+		loadExecutableImporterExtensions();
 		
-		// listen for events we're interested in  
-		ResourcesPlugin.getWorkspace().addResourceChangeListener(  
-				this,  IResourceChangeEvent.POST_CHANGE  | IResourceChangeEvent.POST_BUILD);  
-		CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this, CProjectDescriptionEvent.DATA_APPLIED);  
+		// add the standard providers
+		executableProviders.add(0, new StandardExecutableProvider());
+		sourceFileProviders.add(0, new StandardSourceFilesProvider());
+		sourceFileRemappings.add(0, new StandardSourceFileRemapping());
+		executableImporters.add(0, new StandardExecutableImporter());
 		
-		// schedule a refresh so we get up to date  
+		// listen for events we're interested in
+		ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.POST_BUILD);
+		CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this,
+				CProjectDescriptionEvent.DATA_APPLIED);
+		
+		// schedule a refresh so we get up to date
 		scheduleRefresh();
 	}
-				
 
-	/**  
-	 * Adds an executable listener  
+	/**
+	 * Adds an executable listener
 	 * @param listener the listener to add
-	 */ 
+	 */
 	public void addExecutablesChangeListener(IExecutablesChangeListener listener) {
 		changeListeners.add(listener);
 	}
 
-	/**  
-	 * Removes an executable listener  
-	 * @param listener the listener to remove  
-	 */ 
+	/**
+	 * Removes an executable listener
+	 * @param listener the listener to remove
+	 */
 	public void removeExecutablesChangeListener(IExecutablesChangeListener listener) {
 		changeListeners.remove(listener);
 	}
 
 	/**
-	 * Gets the list of executables in the workspace. 
-	 * @return the list of executables which may be empty 
+	 * Gets the list of executables in the workspace.
+	 * @param wait whether or not to wait if the list is being refreshed when this
+	 * method is called.  when true, this call will not return until the list is
+	 * complete.  when false, it will return with the last known list.  if calling
+	 * from any UI, you should not block the UI waiting for this to return, but rather
+	 * register as an {@link IExecutablesChangeListener} to get notifications when the
+	 * list changes.
+	 * @return the list of executables which may be empty
 	 */
-	public Collection<Executable> getExecutables() {
-		trace("getExecutables called at "
-				+ getStringFromTimestamp(System.currentTimeMillis()));
+	public Collection<Executable> getExecutables(boolean wait) {
+		
+		trace("getExecutables called at " + getStringFromTimestamp(System.currentTimeMillis()));
+
 		List<Executable> executables = new ArrayList<Executable>();
 
+		if (wait && refreshJob.getState() != Job.NONE) {
+			trace("waiting for refresh job to finish at " + getStringFromTimestamp(System.currentTimeMillis()));
+			try {
+				refreshJob.join();
+			} catch (InterruptedException e) {
+			}
+			trace("refresh job finished at " + getStringFromTimestamp(System.currentTimeMillis()));
+		}
+		
 		synchronized (executablesMap) {
 			for (List<Executable> exes : executablesMap.values()) {
 				for (Executable exe : exes) {
@@ -216,19 +226,30 @@
 				}
 			}
 		}
-		trace("getExecutables returned at "
-				+ getStringFromTimestamp(System.currentTimeMillis()));
+
+		trace("getExecutables returned at " + getStringFromTimestamp(System.currentTimeMillis()));
+
 		return executables;
 	}
 
 	/**
-	* @since 6.0
-	* Gets the collection of executables for the given project  
-	* @param project the project  
-	* @return collection of executables which may be empty  
-	* */  
+	 * Gets the list of executables in the workspace.  Equivalent to {@link ExecutablesManager}{@link #getExecutables(false)}.
+	 * Just kept for older API compatibility.
+	 * @return the list of executables which may be empty
+	 */
+	public Collection<Executable> getExecutables() {
+		return getExecutables(false);
+	}
+	
+	/**
+	 * @since 6.0
+	 * Gets the collection of executables for the given project
+	 * @param project the project
+	 * @return collection of executables which may be empty
+	 */
 	public Collection<Executable> getExecutablesForProject(IProject project) {
 		List<Executable> executables = new ArrayList<Executable>();
+
 		synchronized (executablesMap) {
 			List<Executable> exes = executablesMap.get(project);
 			if (exes != null) {
@@ -239,90 +260,93 @@
 				}
 			}
 		}
+
 		return executables;
-	} 
-	
-	/**  Attempt to remap the path to the given source file in the given executable using  
-	 * source file mapping extensions  
-	 * @param executable the executable  
-	 * @param filePath the absolute path to the source file  
-	 * @return the new path to the source file, which was remapped if possible  
+	}
+
+	/**
+	 * Attempt to remap the path to the given source file in the given executable using
+	 * source file mapping extensions
+	 * @param executable the executable
+	 * @param filePath the absolute path to the source file
+	 * @return the new path to the source file, which was remapped if possible
 	 * 
 	 * @since 6.0  
-	 */ 
+	 */
 	public String remapSourceFile(Executable executable, String filePath) {
 		synchronized (sourceFileRemappings) {
 			for (ISourceFileRemapping remapping : sourceFileRemappings) {
-				String remappedPath = remapping.remapSourceFile(executable, filePath);
+				String remappedPath = remapping.remapSourceFile(executable.getPath(), filePath);
 				if (!remappedPath.equals(filePath))
 					return remappedPath;
 			}
 		}
 		return filePath;
 	}
-	/**  
-	 * Import the given executables into the manager  
-	 * @param fileNames the absolute paths of the executables to import  
-	 * @param monitor progress monitor  
-	 */ 
+
+	/**
+	 * Import the given executables into the manager
+	 * @param fileNames the absolute paths of the executables to import
+	 * @param monitor progress monitor
+	 */
 	public void importExecutables(final String[] fileNames, IProgressMonitor monitor) {
+
 		boolean handled = false;
-		
-		monitor.beginTask("Import Executables", executableImporters.size()); 
-		synchronized (executableImporters) {  
-			Collections.sort(executableImporters,  
-					new Comparator<IExecutableImporter>() { 
+		monitor.beginTask("Import Executables", executableImporters.size());
+		synchronized (executableImporters) {
+			Collections.sort(executableImporters, new Comparator<IExecutableImporter>() {
 
-				public int compare(IExecutableImporter arg0,  
-						IExecutableImporter arg1) {  
-					int p0 = arg0.getPriority(fileNames);  
-					int p1 = arg1.getPriority(fileNames);  
-					if (p0 < p1)  
-						return 1;  
-					if (p0 > p1)  
-						return -1;  
-					return 0;  
-					}  
-				}); 	
+				public int compare(IExecutableImporter arg0, IExecutableImporter arg1) {
+					int p0 = arg0.getPriority(fileNames);
+					int p1 = arg1.getPriority(fileNames);
+					if (p0 < p1)
+						return 1;
+					if (p0 > p1)
+						return -1;
+					return 0;
+				}});
 
-			for (IExecutableImporter importer : executableImporters) {  
-				if (handled || monitor.isCanceled()) {  
-					break;  
-					}  
-				}  
+			for (IExecutableImporter importer : executableImporters) {
+				handled = importer.importExecutables(fileNames, new SubProgressMonitor(monitor, 1));
+				if (handled || monitor.isCanceled()) {
+					break;
+				}
+			}
 		}
-		scheduleRefresh(); 		
+		
+		if (handled)
+			scheduleRefresh();
 	}
-	
-		/**  
-		 * Determines if the given executable is currently known by the manager  
-		 * * @param exePath  
-		 * the absolute path to the executable  
-		 * @return true if the manager knows about it, false otherwise  
-		 */  
-		public boolean executableExists(IPath exePath) {  
-			synchronized (executablesMap) {  
-				for (List<Executable> exes : executablesMap.values()) {  
-					for (Executable exe : exes) {  
-						if (exe.getPath().equals(exePath)) {  
-							return true;  }  
-						} 
-					} 
+
+	/**
+	 * Determines if the given executable is currently known by the manager
+	 * @param exePath the absolute path to the executable
+	 * @return true if the manager knows about it, false otherwise
+	 */
+	public boolean executableExists(IPath exePath) {
+		synchronized (executablesMap) {
+			for (List<Executable> exes : executablesMap.values()) {
+				for (Executable exe : exes) {
+					if (exe.getPath().equals(exePath)) {
+						return true;
+					}
 				}
-			return false;
 			}
+		}
+		
+		return false;
+	}
 
-	
-		/**
-		* Get the list of source files for the given executable
-		* @param executable the executable
-		* @param monitor progress monitor
-		* @return an array of source files which may be empty
-		*/
-		public String[] getSourceFiles(final Executable executable, IProgressMonitor monitor) {
-			String[] result = new String[0];
-			
-			trace("getSourceFiles called at " + getStringFromTimestamp(System.currentTimeMillis()) + " for " + executable.getPath().toOSString());
+	/**
+	 * Get the list of source files for the given executable
+	 * @param executable the executable
+	 * @param monitor progress monitor
+	 * @return an array of source files which may be empty
+	 */
+	public String[] getSourceFiles(final Executable executable, IProgressMonitor monitor) {
+		String[] result = new String[0];
+
+		trace("getSourceFiles called at " + getStringFromTimestamp(System.currentTimeMillis()) + " for " + executable.getPath().toOSString());
 
 		synchronized (sourceFileProviders) {
 			Collections.sort(sourceFileProviders, new Comparator<ISourceFilesProvider>() {
@@ -342,43 +366,40 @@
 				String[] sourceFiles = provider.getSourceFiles(executable, new SubProgressMonitor(monitor, 1));
 				if (sourceFiles.length > 0) {
 					result = sourceFiles;
-					
+
 					trace("getSourceFiles got " + sourceFiles.length + " files from " + provider.toString());
-					
+
 					break;
 				}
 			}
 			monitor.done();
 		}
-		
+
 		trace("getSourceFiles returned at " + getStringFromTimestamp(System.currentTimeMillis()));
-		
+
 		return result;
 	}
 
-		/**
-		* Removes the given executables
-		* @param executables the array of executables to be removed
-		* @param monitor progress monitor
-		* @return IStatus of the operation
-		* 
-		* @since 6.0
-		*/
-		public IStatus removeExecutables(Executable[] executables, IProgressMonitor monitor) {
+	/**
+	 * Removes the given executables
+	 * @param executables the array of executables to be removed
+	 * @param monitor progress monitor
+	 * @return IStatus of the operation
+	 * 
+	 * @since 6.0
+	 */
+	public IStatus removeExecutables(Executable[] executables, IProgressMonitor monitor) {
+		MultiStatus status = new MultiStatus(CDebugCorePlugin.PLUGIN_ID, IStatus.WARNING, "Couldn't remove all of the selected executables", null);
 		
-		MultiStatus status = new MultiStatus(CDebugCorePlugin.PLUGIN_ID, IStatus.WARNING, "Couldn't remove all of the selected executables", null);
-	 		
 		monitor.beginTask("Remove Executables", executables.length);
 		for (Executable executable : executables) {
-			IProjectExecutablesProvider provider = getExecutablesProviderForProject(executable
-					.getProject());
+			
+			IProjectExecutablesProvider provider = getExecutablesProviderForProject(executable.getProject());
 			if (provider != null) {
-				IStatus result = provider.removeExecutable(executable,
-						new SubProgressMonitor(monitor, 1));
+				IStatus result = provider.removeExecutable(executable, new SubProgressMonitor(monitor, 1));
 				if (result.isOK()) {
 					// remove the exe from the list
-					List<Executable> exes = executablesMap.get(executable
-							.getProject());
+					List<Executable> exes = executablesMap.get(executable.getProject());
 					if (exes != null) {
 						exes.remove(executable);
 					}
@@ -387,6 +408,7 @@
 				}
 			}
 		}
+
 		// notify listeners that the list has changed.  only do this if at least one delete succeeded.
 		if (status.getChildren().length != executables.length) {
 			synchronized (changeListeners) {
@@ -395,16 +417,14 @@
 				}
 			}
 		}
-
+		
 		return status;
 	}
 
 	/**
 	 * Refresh the list of executables for the given projects
-	 * 
-	 * @param projects
-	 *            the list of projects, or null. if null or the list is empty,
-	 *            all projects will be refreshed.
+	 * @param projects the list of projects, or null.  if null or the list
+	 * is empty, all projects will be refreshed.
 	 */
 	public void refresh(List<IProject> projects) {
 		if (projects == null || projects.size() == 0) {
@@ -415,48 +435,50 @@
 				executablesMap.remove(project);
 			}
 		}
-
+		
 		scheduleRefresh();
 	}
-		
+
 	public void resourceChanged(IResourceChangeEvent event) {
 
 		synchronized (executablesMap) {
-			// project needs to be refreshed after a build/clean as the binary
-			// may
+			// project needs to be refreshed after a build/clean as the binary may
 			// be added/removed/renamed etc.
 			if (event.getType() == IResourceChangeEvent.POST_BUILD) {
 				Object obj = event.getSource();
 				if (obj != null && obj instanceof IProject) {
-					if (executablesMap.containsKey(obj)) {
-						List<Executable> executables = executablesMap
-								.remove(obj);
-
-						trace("Scheduling refresh because project "
-								+ ((IProject) obj).getName()
-								+ " built or cleaned");
+					try {
+						// make sure there's at least one builder for the project.  this gets called even
+						// when there are no builder (e.g. the Executables project for imported executables).
+						IProject project = (IProject)obj;
+						if (project.getDescription().getBuildSpec().length > 0) {
+							if (executablesMap.containsKey(obj)) {
+								List<Executable> executables = executablesMap.remove(obj);
 
-						scheduleRefresh();
+								trace("Scheduling refresh because project " + ((IProject)obj).getName() + " built or cleaned");
+								
+								scheduleRefresh();
 
-						// notify the listeners that these executables have
-						// possibly changed
-						if (executables != null && executables.size() > 0) {
-							synchronized (changeListeners) {
-								for (IExecutablesChangeListener listener : changeListeners) {
-									listener.executablesChanged(executables);
+								// notify the listeners that these executables have possibly changed
+								if (executables != null && executables.size() > 0) {
+									synchronized (changeListeners) {
+										for (IExecutablesChangeListener listener : changeListeners) {
+											listener.executablesChanged(executables);
+										}
+									}
 								}
 							}
 						}
+					} catch (CoreException e) {
+						e.printStackTrace();
 					}
 				}
 				return;
 			}
-
+			
 			// refresh when projects are opened or closed. note that deleted
-			// projects are handled later in this method. new projects are
-			// handled
-			// in handleEvent. resource changed events always start at the
-			// workspace
+			// projects are handled later in this method. new projects are handled
+			// in handleEvent.  resource changed events always start at the workspace
 			// root, so projects are the next level down
 			boolean refreshNeeded = false;
 			IResourceDelta[] projects = event.getDelta().getAffectedChildren();
@@ -464,15 +486,14 @@
 				if ((projectDelta.getFlags() & IResourceDelta.OPEN) != 0) {
 					if (projectDelta.getKind() == IResourceDelta.CHANGED) {
 						// project was opened or closed
-						if (executablesMap.containsKey(projectDelta
-								.getResource())) {
+						if (executablesMap.containsKey(projectDelta.getResource())) {
 							executablesMap.remove(projectDelta.getResource());
 						}
 						refreshNeeded = true;
 					}
 				}
 			}
-
+			
 			if (refreshNeeded) {
 				trace("Scheduling refresh because project(s) opened or closed");
 
@@ -483,37 +504,25 @@
 			try {
 				event.getDelta().accept(new IResourceDeltaVisitor() {
 
-					public boolean visit(IResourceDelta delta)
-							throws CoreException {
-						if (delta.getKind() == IResourceDelta.ADDED
-								|| delta.getKind() == IResourceDelta.REMOVED) {
+					public boolean visit(IResourceDelta delta) throws CoreException {
+						if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) {
 							IResource deltaResource = delta.getResource();
 							if (deltaResource != null) {
 								boolean refresh = false;
-								if (delta.getKind() == IResourceDelta.REMOVED
-										&& deltaResource instanceof IProject) {
+								if (delta.getKind() == IResourceDelta.REMOVED && deltaResource instanceof IProject) {
 									// project deleted
-									if (executablesMap
-											.containsKey(deltaResource)) {
+									if (executablesMap.containsKey(deltaResource)) {
 										executablesMap.remove(deltaResource);
 										refresh = true;
 
-										trace("Scheduling refresh because project "
-												+ deltaResource.getName()
-												+ " deleted");
+										trace("Scheduling refresh because project " + deltaResource.getName() + " deleted");
 									}
 								} else {
 									// see if a binary has been added/removed
-									IPath resourcePath = deltaResource
-											.getLocation();
-									if (resourcePath != null
-											&& Executable
-													.isExecutableFile(resourcePath)) {
-										if (executablesMap
-												.containsKey(deltaResource
-														.getProject())) {
-											executablesMap.remove(deltaResource
-													.getProject());
+									IPath resourcePath = deltaResource.getLocation();
+									if (resourcePath != null && Executable.isExecutableFile(resourcePath)) {
+										if (executablesMap.containsKey(deltaResource.getProject())) {
+											executablesMap.remove(deltaResource.getProject());
 											refresh = true;
 
 											trace("Scheduling refresh because a binary was added/removed");
@@ -534,7 +543,7 @@
 			}
 		}
 	}
-		
+
 	public void handleEvent(CProjectDescriptionEvent event) {
 		// this handles the cases where the active build configuration changes,
 		// and when new projects are created or loaded at startup.
@@ -543,18 +552,14 @@
 		int eventType = event.getEventType();
 
 		if (eventType == CProjectDescriptionEvent.DATA_APPLIED) {
-
+			
 			synchronized (executablesMap) {
 				// see if the active build config has changed
-				ICProjectDescription newDesc = event
-						.getNewCProjectDescription();
-				ICProjectDescription oldDesc = event
-						.getOldCProjectDescription();
+				ICProjectDescription newDesc = event.getNewCProjectDescription();
+				ICProjectDescription oldDesc = event.getOldCProjectDescription();
 				if (oldDesc != null && newDesc != null) {
-					String newConfigName = newDesc.getActiveConfiguration()
-							.getName();
-					String oldConfigName = oldDesc.getActiveConfiguration()
-							.getName();
+					String newConfigName = newDesc.getActiveConfiguration().getName();
+					String oldConfigName = oldDesc.getActiveConfiguration().getName();
 					if (!newConfigName.equals(oldConfigName)) {
 						if (executablesMap.containsKey(newDesc.getProject())) {
 							executablesMap.remove(newDesc.getProject());
@@ -567,8 +572,7 @@
 					// project just created
 					refresh = true;
 
-					trace("Scheduling refresh because project "
-							+ newDesc.getProject().getName() + " created");
+					trace("Scheduling refresh because project " + newDesc.getProject().getName() + " created");
 				}
 			}
 		}
@@ -581,11 +585,10 @@
 	private List<IProject> getProjectsToCheck() {
 
 		List<IProject> projects = new ArrayList<IProject>();
-
+		
 		synchronized (executablesMap) {
 			// look for any CDT projects not in our cache
-			for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
-					.getProjects()) {
+			for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
 				if (!executablesMap.containsKey(project)) {
 					if (CoreModel.hasCNature(project)) {
 						projects.add(project);
@@ -598,20 +601,16 @@
 	}
 
 	private void scheduleRefresh() {
-		trace("scheduleRefresh called at "
-				+ getStringFromTimestamp(System.currentTimeMillis()));
+		trace("scheduleRefresh called at " + getStringFromTimestamp(System.currentTimeMillis()));
 
 		refreshJob.cancel();
 		refreshJob.schedule();
 	}
 
-	private IProjectExecutablesProvider getExecutablesProviderForProject(
-			IProject project) {
-		IProjectExecutablesProvider provider = executablesProviderMap
-				.get(project);
+	private IProjectExecutablesProvider getExecutablesProviderForProject(IProject project) {
+		IProjectExecutablesProvider provider = executablesProviderMap.get(project);
 		if (provider == null) {
-			// not cached yet. get the list of project natures from the
-			// providers and
+			// not cached yet.  get the list of project natures from the providers and
 			// pick the one with the closest match
 			try {
 				IProjectDescription description = project.getDescription();
@@ -625,7 +624,7 @@
 							naturesMatched++;
 						}
 					}
-
+					
 					if (naturesMatched > mostNaturesMatched) {
 						provider = exeProvider;
 						mostNaturesMatched = naturesMatched;
@@ -639,151 +638,130 @@
 				e.printStackTrace();
 			}
 		}
-
+		
 		return provider;
 	}
 
 	private void loadExecutableProviderExtensions() {
-		executableProviders = Collections
-				.synchronizedList(new ArrayList<IProjectExecutablesProvider>());
+		executableProviders = Collections.synchronizedList(new ArrayList<IProjectExecutablesProvider>());
 
 		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-		IExtensionPoint extensionPoint = extensionRegistry
-				.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID
-						+ ".ExecutablesProvider"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID + ".ExecutablesProvider"); //$NON-NLS-1$
 		IExtension[] extensions = extensionPoint.getExtensions();
-
+		
 		for (int i = 0; i < extensions.length; i++) {
 			IExtension extension = extensions[i];
-			IConfigurationElement[] elements = extension
-					.getConfigurationElements();
+			IConfigurationElement[] elements = extension.getConfigurationElements();
 			IConfigurationElement element = elements[0];
-
+			
 			boolean failed = false;
 			try {
 				Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
 				if (extObject instanceof IProjectExecutablesProvider) {
-					executableProviders
-							.add((IProjectExecutablesProvider) extObject);
+					executableProviders.add((IProjectExecutablesProvider)extObject);
 				} else {
 					failed = true;
 				}
-			} catch (CoreException e) {
+			} 
+			catch (CoreException e) {
 				failed = true;
 			}
-
+			
 			if (failed) {
-				CDebugCorePlugin
-						.log("Unable to load ExecutablesProvider extension from "
-								+ extension.getContributor().getName());
+				CDebugCorePlugin.log("Unable to load ExecutablesProvider extension from " + extension.getContributor().getName());
 			}
 		}
 	}
-
+	
 	private void loadSoureFileProviderExtensions() {
-		sourceFileProviders = Collections
-				.synchronizedList(new ArrayList<ISourceFilesProvider>());
+		sourceFileProviders = Collections.synchronizedList(new ArrayList<ISourceFilesProvider>());
 
 		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-		IExtensionPoint extensionPoint = extensionRegistry
-				.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID
-						+ ".SourceFilesProvider"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID + ".SourceFilesProvider"); //$NON-NLS-1$
 		IExtension[] extensions = extensionPoint.getExtensions();
-
+		
 		for (int i = 0; i < extensions.length; i++) {
 			IExtension extension = extensions[i];
-			IConfigurationElement[] elements = extension
-					.getConfigurationElements();
+			IConfigurationElement[] elements = extension.getConfigurationElements();
 			IConfigurationElement element = elements[0];
-
+			
 			boolean failed = false;
 			try {
 				Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
 				if (extObject instanceof ISourceFilesProvider) {
-					sourceFileProviders.add((ISourceFilesProvider) extObject);
+					sourceFileProviders.add((ISourceFilesProvider)extObject);
 				} else {
 					failed = true;
 				}
-			} catch (CoreException e) {
+			} 
+			catch (CoreException e) {
 				failed = true;
 			}
-
+			
 			if (failed) {
-				CDebugCorePlugin
-						.log("Unable to load SourceFilesProvider extension from "
-								+ extension.getContributor().getName());
+				CDebugCorePlugin.log("Unable to load SourceFilesProvider extension from " + extension.getContributor().getName());
 			}
 		}
 	}
 
 	private void loadSoureRemappingExtensions() {
-		sourceFileRemappings = Collections
-				.synchronizedList(new ArrayList<ISourceFileRemapping>());
+		sourceFileRemappings = Collections.synchronizedList(new ArrayList<ISourceFileRemapping>());
 
 		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-		IExtensionPoint extensionPoint = extensionRegistry
-				.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID
-						+ ".SourceRemappingProvider"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID + ".SourceRemappingProvider"); //$NON-NLS-1$
 		IExtension[] extensions = extensionPoint.getExtensions();
-
+		
 		for (int i = 0; i < extensions.length; i++) {
 			IExtension extension = extensions[i];
-			IConfigurationElement[] elements = extension
-					.getConfigurationElements();
+			IConfigurationElement[] elements = extension.getConfigurationElements();
 			IConfigurationElement element = elements[0];
-
+			
 			boolean failed = false;
 			try {
 				Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
 				if (extObject instanceof ISourceFileRemapping) {
-					sourceFileRemappings.add((ISourceFileRemapping) extObject);
+					sourceFileRemappings.add((ISourceFileRemapping)extObject);
 				} else {
 					failed = true;
 				}
-			} catch (CoreException e) {
+			} 
+			catch (CoreException e) {
 				failed = true;
 			}
-
+			
 			if (failed) {
-				CDebugCorePlugin
-						.log("Unable to load SourceRemappingProvider extension from "
-								+ extension.getContributor().getName());
+				CDebugCorePlugin.log("Unable to load SourceRemappingProvider extension from " + extension.getContributor().getName());
 			}
 		}
 	}
 
 	private void loadExecutableImporterExtensions() {
-		executableImporters = Collections
-				.synchronizedList(new ArrayList<IExecutableImporter>());
+		executableImporters = Collections.synchronizedList(new ArrayList<IExecutableImporter>());
 
 		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
-		IExtensionPoint extensionPoint = extensionRegistry
-				.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID
-						+ ".ExecutablesImporter"); //$NON-NLS-1$
+		IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(CDebugCorePlugin.PLUGIN_ID + ".ExecutablesImporter"); //$NON-NLS-1$
 		IExtension[] extensions = extensionPoint.getExtensions();
-
+		
 		for (int i = 0; i < extensions.length; i++) {
 			IExtension extension = extensions[i];
-			IConfigurationElement[] elements = extension
-					.getConfigurationElements();
+			IConfigurationElement[] elements = extension.getConfigurationElements();
 			IConfigurationElement element = elements[0];
-
+			
 			boolean failed = false;
 			try {
 				Object extObject = element.createExecutableExtension("class"); //$NON-NLS-1$
 				if (extObject instanceof IExecutableImporter) {
-					executableImporters.add((IExecutableImporter) extObject);
+					executableImporters.add((IExecutableImporter)extObject);
 				} else {
 					failed = true;
 				}
-			} catch (CoreException e) {
+			} 
+			catch (CoreException e) {
 				failed = true;
 			}
-
+			
 			if (failed) {
-				CDebugCorePlugin
-						.log("Unable to load ExecutablesImporter extension from "
-								+ extension.getContributor().getName());
+				CDebugCorePlugin.log("Unable to load ExecutablesImporter extension from " + extension.getContributor().getName());
 			}
 		}
 	}
@@ -794,9 +772,8 @@
 			System.out.println(msg);
 		}
 	}
-
+	
 	private String getStringFromTimestamp(long timestamp) {
-		return DateFormat.getTimeInstance(DateFormat.MEDIUM).format(
-				new Date(timestamp));
+		return DateFormat.getTimeInstance(DateFormat.MEDIUM).format(new Date(timestamp));
 	}
 }
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ISourceFileRemapping.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ISourceFileRemapping.java	Fri Aug 07 13:47:27 2009 -0500
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.cdt.debug.core.executables;
 
+import org.eclipse.core.runtime.IPath;
 
 /**
  * ISourceFileRemapping is used by the Executables Manager when finding missing
@@ -20,9 +21,6 @@
  */
 public interface ISourceFileRemapping {
 
-	/**
-	 * @since 6.0
-	 */
-	String remapSourceFile(Executable executable, String filePath);
+	String remapSourceFile(IPath executable, String filePath);
 
-}
\ No newline at end of file
+}
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/StandardExecutableProvider.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/StandardExecutableProvider.java	Fri Aug 07 13:47:27 2009 -0500
@@ -34,21 +34,19 @@
 public class StandardExecutableProvider implements IProjectExecutablesProvider {
 
 	List<String> supportedNatureIds = new ArrayList<String>();
-
+	
 	public StandardExecutableProvider() {
 		supportedNatureIds.add(CProjectNature.C_NATURE_ID);
 		supportedNatureIds.add(CCProjectNature.CC_NATURE_ID);
 	}
-
+	
 	public List<String> getProjectNatures() {
 		return supportedNatureIds;
- 	}
+	}
 
-	
-	public List<Executable> getExecutables(IProject project,
-			IProgressMonitor monitor) {
+	public List<Executable> getExecutables(IProject project, IProgressMonitor monitor) {
 		List<Executable> executables = new ArrayList<Executable>();
-
+		
 		ICProject cproject = CModelManager.getDefault().create(project);
 		try {
 			IBinary[] binaries = cproject.getBinaryContainer().getBinaries();
@@ -64,12 +62,10 @@
 					IPath exePath = binary.getResource().getLocation();
 					if (exePath == null)
 						exePath = binary.getPath();
-					executables.add(new Executable(exePath, project, binary
-							.getResource()));
+					executables.add(new Executable(exePath, project, binary.getResource()));
 				}
-
+				
 				progress.worked(1);
-
 			}
 		} catch (CModelException e) {
 		}
@@ -77,22 +73,16 @@
 		return executables;
 	}
 
-	public IStatus removeExecutable(Executable executable,
-			IProgressMonitor monitor) {
+	public IStatus removeExecutable(Executable executable, IProgressMonitor monitor) {
 		IResource exeResource = executable.getResource();
 		if (exeResource != null) {
 			try {
 				exeResource.delete(true, monitor);
 			} catch (CoreException e) {
-				DebugPlugin.log(e);
-
+				DebugPlugin.log( e );
 			}
 			return Status.OK_STATUS;
 		}
-		return new Status(IStatus.WARNING, CDebugCorePlugin.PLUGIN_ID,
-				"Can't remove " + executable.getName()
-						+ ": it is built by project \""
-						+ executable.getProject().getName() + "\"");
+		return new Status(IStatus.WARNING, CDebugCorePlugin.PLUGIN_ID, "Can't remove " + executable.getName() + ": it is built by project \"" + executable.getProject().getName() + "\"");
 	}
-
-}
\ No newline at end of file
+}
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/executables/StandardSourceFileRemapping.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/executables/StandardSourceFileRemapping.java	Fri Aug 07 13:47:27 2009 -0500
@@ -12,11 +12,11 @@
 package org.eclipse.cdt.debug.internal.core.executables;
 
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
-import org.eclipse.cdt.debug.core.executables.Executable;
 import org.eclipse.cdt.debug.core.executables.ISourceFileRemapping;
 import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
 import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchManager;
@@ -25,7 +25,7 @@
 
 public class StandardSourceFileRemapping implements ISourceFileRemapping {
 
-	public String remapSourceFile(Executable executable, String filePath) {
+	public String remapSourceFile(IPath executable, String filePath) {
 
 		try {
 			Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath);
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesContentProvider.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesContentProvider.java	Fri Aug 07 13:47:27 2009 -0500
@@ -100,4 +100,4 @@
 		return new Object[] {};
 	}
 
-}
\ No newline at end of file
+}
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesView.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesView.java	Fri Aug 07 13:47:27 2009 -0500
@@ -225,6 +225,8 @@
 	private Action configureColumnsAction;
 
 	private IMemento memento;
+	
+	private IStructuredSelection oldSelection;
 
 	/**
 	 * Create contents of the Executables View
@@ -239,9 +241,9 @@
 		final SashForm sashForm = new SashForm(container, SWT.NONE);
 
 		// Create the two sub viewers.
-		executablesViewer = new ExecutablesViewer(this, sashForm, SWT.FULL_SELECTION + SWT.BORDER + SWT.MULTI);
+		executablesViewer = new ExecutablesViewer(this, sashForm, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI);
 		ExecutablesManager.getExecutablesManager().addExecutablesChangeListener(executablesViewer);
-		sourceFilesViewer = new SourceFilesViewer(this, sashForm, SWT.BORDER);
+		sourceFilesViewer = new SourceFilesViewer(this, sashForm, SWT.BORDER | SWT.MULTI);
 
 		sashForm.setWeights(new int[] { 1, 1 });
 
@@ -268,48 +270,45 @@
 		// update the source files viewer
 		executablesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
 
-					public void selectionChanged(SelectionChangedEvent event) {
-						ISelection newSelection = event.getSelection();
-						if (newSelection instanceof IStructuredSelection) {
-
-							// update the remove action
-							removeAction.setEnabled(!newSelection.isEmpty());
-
-							final Object firstElement = ((IStructuredSelection) newSelection)
-									.getFirstElement();
-
-							Job setectExeJob = new Job(
-									Messages.ExecutablesView_Select_Executable) {
+			public void selectionChanged(SelectionChangedEvent event) {
+				ISelection newSelection = event.getSelection();
+				if (newSelection instanceof IStructuredSelection) {
+					
+					if (oldSelection == null || !oldSelection.equals(newSelection))
+					{
+						// update the remove action
+						removeAction.setEnabled(!newSelection.isEmpty());
+						
+						final Object firstElement = ((IStructuredSelection) newSelection).getFirstElement();
+						
+						Job setectExeJob = new Job(Messages.ExecutablesView_Select_Executable) {
 
-								@Override
-								protected IStatus run(IProgressMonitor monitor) {
-									if (firstElement instanceof Executable) {
-										Executable executable = (Executable) firstElement;
-										this
-												.setName(Messages.ExecutablesView_Finding_Sources_Job_Name
-														+ executable.getName());
-										executable.getSourceFiles(monitor);
-										UIJob selectExeUIJob = new UIJob(
-												Messages.ExecutablesView_Select_Executable) {
-											@Override
-											public IStatus runInUIThread(
-													IProgressMonitor monitor) {
-												sourceFilesViewer
-														.setInput(firstElement);
-												sourceFilesViewer.packColumns();
-												return Status.OK_STATUS;
-											}
-										};
-										selectExeUIJob.schedule();
-									}
-
-									return Status.OK_STATUS;
+							@Override
+							protected IStatus run(IProgressMonitor monitor) {
+								if (firstElement instanceof Executable) {
+									Executable executable = (Executable)firstElement;
+									this.setName(Messages.ExecutablesView_Finding_Sources_Job_Name + executable.getName());
+									executable.getSourceFiles(monitor);
 								}
-							};
-							setectExeJob.schedule();
-						}
+								// selection could be empty, so do this no matter what to update the source
+								// files viewer
+								UIJob selectExeUIJob = new UIJob(Messages.ExecutablesView_Select_Executable){
+									@Override
+									public IStatus runInUIThread(IProgressMonitor monitor) {
+										sourceFilesViewer.setInput(firstElement);
+										sourceFilesViewer.packColumns();
+										return Status.OK_STATUS;
+									}};
+								selectExeUIJob.schedule();								
+								return Status.OK_STATUS;
+							}};
+						setectExeJob.schedule();
+						oldSelection = (IStructuredSelection) newSelection;
 					}
-				});
+					
+				}
+			}
+		});
 
 		executablesViewer.packColumns();
 		sourceFilesViewer.packColumns();
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesViewer.java	Fri Aug 07 12:47:00 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesViewer.java	Fri Aug 07 13:47:27 2009 -0500
@@ -11,6 +11,7 @@
 package org.eclipse.cdt.debug.internal.ui.views.executables;
 
 import java.util.List;
+
 import org.eclipse.cdt.debug.core.executables.Executable;
 import org.eclipse.cdt.debug.core.executables.ExecutablesManager;
 import org.eclipse.cdt.debug.core.executables.IExecutablesChangeListener;
@@ -166,7 +167,6 @@
 		return new ExecutablesViewerComparator(sortType, column_sort_order[sortType]);
 	}
 
-	
 	@Override
 	protected String getColumnOrderKey() {
 		return P_COLUMN_ORDER_KEY_EXE;
@@ -192,21 +192,20 @@
 		// default visible columns
 		return "1,1,1,0,0,0"; //$NON-NLS-1$
 	}
-	
+
 	public void executablesChanged(final List<Executable> executables) {
-		// some executables have been updated. if one of them is currently
+		// some executables have been updated.  if one of them is currently
 		// selected, we need to update the source file list
-		UIJob refreshJob = new UIJob(
-				Messages.ExecutablesViewer_RefreshExecutablesView) {
+		UIJob refreshJob = new UIJob(Messages.ExecutablesViewer_RefreshExecutablesView) {
 
 			@Override
 			public IStatus runInUIThread(IProgressMonitor monitor) {
 				// if the user has selected an executable, they expect its
 				// list of source files to be refreshed automatically
-				if (getSelection() != null
-						&& getSelection() instanceof IStructuredSelection) {
-					IStructuredSelection selection = (IStructuredSelection) getSelection();
-
+				if (getSelection() != null &&
+					getSelection() instanceof IStructuredSelection) {
+					IStructuredSelection selection = (IStructuredSelection)getSelection();
+					
 					Object firstElement = selection.getFirstElement();
 					if (firstElement instanceof Executable) {
 						Executable executable = (Executable) firstElement;
@@ -224,8 +223,7 @@
 
 	public void executablesListChanged() {
 		// Executables list has changed so refresh the view.
-		UIJob refreshJob = new UIJob(
-				Messages.ExecutablesViewer_RefreshExecutablesView) {
+		UIJob refreshJob = new UIJob(Messages.ExecutablesViewer_RefreshExecutablesView) {
 
 			@Override
 			public IStatus runInUIThread(IProgressMonitor monitor) {
@@ -236,4 +234,4 @@
 		};
 		refreshJob.schedule();
 	}
-}
\ No newline at end of file
+}