Bug 3063 - Ant: Cancelation of Ant task hard to test. (1GF95GS)
Summary: Ant: Cancelation of Ant task hard to test. (1GF95GS)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Rodrigo Peretti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:48 EDT by Jeff McAffer CLA
Modified: 2002-05-31 04:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2001-10-10 22:48:41 EDT
Currently it is complex to determine if an Ant task has been canceled, and internals are needed.

I find the UIBuildListener in the list of buildlisteners of an ant project, and use fBuildListener.taskFinished(null)
to check if the cancel button has been pressed. The classes UIBuildListener and BuildCanceledException are internal,
so this is not a proper way to check the cancel button when running an Ant task.

My request is: could UIBuildlistener be made 'public', and maybe a more Eclipse-like way of checking for canceled could
be provided.

NOTES:


KH (6/13/2001 8:14:51 AM)
	Moving to Core

JM (6/13/2001 11:59:18 AM)
	Defer.  This is a good idea.
Comment 1 DJ Houghton CLA 2001-10-24 06:42:52 EDT
PRODUCT VERSION:
Eclipse SDK 0.119

Comment 2 Marco Mulder CLA 2002-03-15 10:13:36 EST
In Eclipse 2.0 (build 20020307), this workaround causes an NPE. I see no way in Eclipse 2.0 to check 
if a task is canceled by the user. This is unacceptable in our plugin because we run a long task.
Comment 3 Rodrigo Peretti CLA 2002-05-19 15:12:53 EDT
It seems Ant Core provided this functionality. Will investigate.
Comment 4 Rodrigo Peretti CLA 2002-05-19 15:15:31 EDT
Should look at bug 3103 when fixing this one.
Comment 5 Rodrigo Peretti CLA 2002-05-21 02:32:38 EDT
If calling AntRunner.run(IProgressMonitor monitor), the monitor will be 
available for the current task as an object reference. Just use Task.getProject
().getReferences().get("eclipse.progress.monitor") to get the reference to the 
IProgressMonitor.
Fixed and released.
Comment 6 Marco Mulder CLA 2002-05-29 12:01:30 EDT
20020528

This fix seems to have been lost somewhere.
In my Ant tasks execute() method, getProject().getReferences() has only one
entry. Its key is the name of the Ant project in which a target is executed, its
value is the  Project object. This is the case both when Ant task execution is
triggered form the context menu or from Run -> External Tools -> ...
Where is the code that adds the "eclipse.progress.monitor" entry?
Comment 7 Rodrigo Peretti CLA 2002-05-29 12:07:33 EDT
I was going to send you a message about it but was waiting the code in the UI 
to change (the current code does not pass a progress monitor to the AntRunner -
 see bug 17481). The changes will probably be included in today's (20020529) 
integration build.
Comment 8 Marco Mulder CLA 2002-05-31 04:33:54 EDT
20020530: Verified