merged
authorfturovic <frank.turovich@nokia.com>
Fri, 05 Jun 2009 14:32:14 -0500
changeset 21 414098b7d47d
parent 20 f2052eb98ec7 (current diff)
parent 19 89d3c8eb71dd (diff)
child 22 15beacfadfc7
merged
--- a/cdt/cdt_5_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java	Fri Jun 05 14:27:56 2009 -0500
+++ b/cdt/cdt_5_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java	Fri Jun 05 14:32:14 2009 -0500
@@ -261,6 +261,7 @@
 	 */
 	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>() {
@@ -276,14 +277,15 @@
 				}});
 
 			for (IExecutableImporter importer : executableImporters) {
-				boolean handled = importer.importExecutables(fileNames, new SubProgressMonitor(monitor, 1));
+				handled = importer.importExecutables(fileNames, new SubProgressMonitor(monitor, 1));
 				if (handled || monitor.isCanceled()) {
 					break;
 				}
 			}
 		}
 		
-		scheduleRefresh();
+		if (handled)
+			scheduleRefresh();
 	}
 
 	/**
--- a/cdt/cdt_5_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesView.java	Fri Jun 05 14:27:56 2009 -0500
+++ b/cdt/cdt_5_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesView.java	Fri Jun 05 14:32:14 2009 -0500
@@ -225,6 +225,8 @@
 	private Action configureColumnsAction;
 
 	private IMemento memento;
+	
+	private IStructuredSelection oldSelection;
 
 	/**
 	 * Create contents of the Executables View
@@ -272,33 +274,38 @@
 				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) {
+					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);
-							}
-							// 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();
+							@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);
+								}
+								// 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;
+					}
+					
 				}
 			}
 		});