Bug 63604 - Modal progress improvements round two
Summary: Modal progress improvements round two
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Kevin Barnes CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2004-05-23 16:03 EDT by Erich Gamma CLA
Modified: 2004-05-27 12:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erich Gamma CLA 2004-05-23 16:03:31 EDT
There is new support to handle the case of running a runnable with fork=false.
The method is IProgressService.runInUI(). See the javadoc for this method for 
more details. 

If you are not sure about which scheduling rule to use then use the workspace 
root.
Comment 1 Erich Gamma CLA 2004-05-23 16:07:08 EDT
There is actually just one use of false, false in the class AntTargetTab.
Comment 2 Darin Swanson CLA 2004-05-24 17:44:43 EDT
Set to only lock on the particular Ant buildfile that we are getting the 
targets for.

Changes in AntTargetsTab.
Comment 3 Darin Swanson CLA 2004-05-24 17:46:32 EDT
Please verify Kevin.
Comment 4 Erich Gamma CLA 2004-05-25 07:18:40 EDT
I've verified the fix since issues got uncovered when using runInUI while 
there is a modal dialog up. In the case of AntTargetsTab there is no modal 
dialog up, the operation is executed before the dialog shows up. Therefore 
runInUI works fine.
Comment 5 Erich Gamma CLA 2004-05-25 07:35:13 EDT
There is one improvement with the code below you are using the workbenchwindow 
as the runnable context. This avoids that a progress dialog briefly shows up 
before the launch config dialog:
IRunnableContext context= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (context == null)
    context= getLaunchConfigurationDialog();
PlatformUI.getWorkbench().getProgressService().runInUI(context, operation, 
AntUtil.getFileForLocation(expandedLocation, null));

Here is the full patch:
Index: AntTargetsTab.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ant.ui/Ant Tools 
Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTargetsTab.java,v
retrieving revision 1.30
diff -u -r1.30 AntTargetsTab.java
--- AntTargetsTab.java	24 May 2004 21:31:20 -0000	1.30
+++ AntTargetsTab.java	25 May 2004 11:19:06 -0000
@@ -35,6 +35,7 @@
 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableContext;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.CheckStateChangedEvent;
 import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -61,6 +62,7 @@
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants;
 import org.eclipse.ui.help.WorkbenchHelp;
@@ -486,8 +488,10 @@
 						}
 					}
 				};
-				
-				PlatformUI.getWorkbench().getProgressService
().runInUI(getLaunchConfigurationDialog(), operation, 
AntUtil.getFileForLocation(expandedLocation, null));
+				IRunnableContext context= 
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+				if (context == null)
+					context= getLaunchConfigurationDialog
();
+				PlatformUI.getWorkbench().getProgressService
().runInUI(context, operation, AntUtil.getFileForLocation(expandedLocation, 
null));
 			} catch (CoreException ce) {
 				exceptions[0]= ce;
 			} catch (InvocationTargetException e) {
Comment 6 Darin Swanson CLA 2004-05-25 08:42:15 EDT
Thanks Erich.
Patch applied and released.
Comment 7 Kevin Barnes CLA 2004-05-27 11:59:37 EDT
verified,
DarinS please update build notes
Comment 8 Darin Swanson CLA 2004-05-27 12:11:34 EDT
Build notes updated. Thanks.