This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 191951 - Wizard remains open while processing archetype
Summary: Wizard remains open while processing archetype
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: API, API_REVIEW_FAST, PERFORMANCE, PLAN
: 103457 196162 (view as bug list)
Depends on: 201817 201996 202077 203011 204327 206369 211842
Blocks:
  Show dependency tree
 
Reported: 2010-11-15 07:23 UTC by hantsy
Modified: 2012-06-01 16:06 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screen of the wizard, I waited several munites and the window was closed. (83.16 KB, image/png)
2010-11-15 07:24 UTC, hantsy
Details
Patch to time out after ten seconds (3.75 KB, patch)
2011-08-31 15:49 UTC, Jesse Glick
Details | Diff
Proposed patch (minus API changes) (34.96 KB, patch)
2011-08-31 21:02 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description hantsy 2010-11-15 07:23:07 UTC
In last step of the wizard, the UI is frozend and waiting for background work...
I think it is better to close the wizard window firstly and make a schecule  for the job to run in backgroud.
Comment 1 hantsy 2010-11-15 07:24:53 UTC
Created attachment 102974 [details]
screen of the wizard, I waited several munites and the window was closed.
Comment 2 Jesse Glick 2010-11-16 17:29:52 UTC
True for any Maven archetype, not specific to NBM development (which the screenshot does not even show!).

Not solvable in isolation in the Maven module; this is just what ProgressInstantiatingIterator (platform/dialogs) is documented to do. *Any* project (or file) template keeps the wizard open until complete, though in the case of Maven archetypes it is possible for this to take longer than usual. ("Several minutes" sounds pathological - what precisely was taking so long?)

Undesirable to just run the project creation asynch and return an empty set from the instantiate method, as New Project uses the return values for other UI purposes such as selecting the newly created projects. Perhaps there could be a new interface

public interface BackgroundInstantiatingIterator<Data> extends AsynchronousInstantiatingIterator<Data> {
  Set/*<?>*/ instantiate() throws IOException;
}

whereby WizardDescriptor would close the dialog, permitting the user to continue other work, before calling instantiate. (The implementor would typically choose to show some manner of progress handle, but this could be just the regular handle shown during Maven execution; the infrastructure does not need to know about it, unlike with ProgressInstantiatingIterator.)

A small improvement to the existing UI would be to enable the Cancel button in case the progress handle was created with a Cancellable. Probably would require changes in the impl of ProgressHandleFactory.createProgressComponent.
Comment 3 Antonin Nebuzelsky 2010-11-25 11:47:45 UTC
The complex change outlined by Jesse seems to be the only option, but at the same time the user still needs to wait for the project creation to be completed before she can start working with it. And I personally did not encounter times longer than several tens of seconds and most of the time just a few seconds.

Closing as wontfix. This is not an issue worth the change, time fixing it, and catching and fixing any regressions the async change would definitely cause.
Comment 4 Jesse Glick 2011-03-01 15:45:18 UTC
*** Bug 103457 has been marked as a duplicate of this bug. ***
Comment 5 Jesse Glick 2011-03-01 15:45:19 UTC
*** Bug 196162 has been marked as a duplicate of this bug. ***
Comment 6 Jiri Kovalsky 2011-03-09 12:58:21 UTC
I understand Tondo but this issue becomes a blocker for users who experience a network outage and can't do anything with the IDE in such situation.
Comment 7 Jesse Glick 2011-03-09 13:31:36 UTC
Something we would like to fix, though probably not for 7.0.

Possible amelioration which seems pretty safe: if the Maven process has not finished after ten seconds or so, just return an empty set from the iterator. So the wizard will close, but the Output Window will continue to show whatever is happening. If and when the process successfully completes, can open the resulting projects then.
Comment 8 Jesse Glick 2011-08-31 15:49:19 UTC
Created attachment 110304 [details]
Patch to time out after ten seconds

(In reply to comment #7)
> Possible amelioration which seems pretty safe: if the Maven process has not
> finished after ten seconds or so, just return an empty set from the iterator.

This patch seems to work fine for simple archetypes. It would probably not work, however, for wizards which process multiple archetypes (EAR, NBM app), or which perform some postprocessing on the project after creation.
Comment 9 Jesse Glick 2011-08-31 21:02:27 UTC
Created attachment 110305 [details]
Proposed patch (minus API changes)

(In reply to comment #2)
> Perhaps there could be a new interface ...
> whereby WizardDescriptor would close the dialog, permitting the user to
> continue other work, before calling instantiate.

The attached patch implements this design and uses it for the wizards based on Maven archetypes.

(to refresh: cd core-main && hg pdiff BackgroundInstantiatingIterator_191951)
Comment 10 Jesse Glick 2011-08-31 21:03:01 UTC
Please review.
Comment 11 Jesse Glick 2011-09-07 14:56:22 UTC
core-main #1b71dee63500
Comment 12 Quality Engineering 2011-09-08 14:28:16 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/1b71dee63500
User: Jesse Glick <jglick@netbeans.org>
Log: #191951: introduce BackgroundInstantiatingIterator to perform work after the wizard has been closed.