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 179548 - Slow UI when creating New Window Component for RCP Platform
Summary: Slow UI when creating New Window Component for RCP Platform
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2010-01-15 07:57 UTC by mvfranz
Modified: 2010-02-11 21:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Profiler snapshop (36.74 KB, application/octet-stream)
2010-01-15 07:58 UTC, mvfranz
Details
Patch locking UI by threading the disk I/O to a worker thread (4.66 KB, patch)
2010-02-06 10:58 UTC, mvfranz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mvfranz 2010-01-15 07:57:36 UTC
While creating UI components for the platform, selecting the new Window Component is slow and provides no feedback.  The IDE appears to lock up.

Steps followed:
1. starting with a RCP module right click
2. Select New -> Window Component
3. Wait for unspecified amount of time wondering what is going on.

Doing this multiple times does not speed up the process.
Comment 1 mvfranz 2010-01-15 07:58:24 UTC
Created attachment 93326 [details]
Profiler snapshop
Comment 2 Peter Pis 2010-01-18 03:35:18 UTC
Reassigning. Profiler snapshot was taken manually.
Comment 3 mvfranz 2010-02-03 05:15:11 UTC
I did some investigating, it seems that the org.netbeans.modules.apisupport.project.ui.wizard.winsys.BasicSettingsPanel.setupCombo 
method is the main slow point in this process.  On my dual core laptop it takes 5.7 seconds on initial setup.  Probably the easiest way to fix this is to use SwingWorker (or the NetBeans equivalent for Java 5) to thread the process.
Comment 4 mvfranz 2010-02-04 09:46:24 UTC
I put together a patch that use AsyncGUIJob but am not happy with the results.  The panel now appears quickly, but the combo box still takes a while to load - which is expected - and the UI gives no indication that the user needs to wait.  Is there an example of this in the current code base?  I have look (briefly) at the 'New File' wizard, is there a simpler example?
Comment 5 Jesse Glick 2010-02-04 13:01:02 UTC
Usually Utilities.waitCursor (I think) is used to indicate that the user should wait for something. I'm afraid I don't have experience with AsyncGUIJob.
Comment 6 mvfranz 2010-02-05 08:23:40 UTC
I implemented logic following this example http://performance.netbeans.org/howto/wait-cursors.html 

currentComponent.setCursor(Utilities.createProgressCursor(currentComponent));

The formatting of the document needs fixing.

I tried to use the markInvalid and markValid to get the 'next' button to only activate once the UI is ready but that did not work.  I will have to investigate.
Comment 7 mvfranz 2010-02-06 10:55:06 UTC
Here is my first attempt to solve this issue.  Hopefully it meets the necessary requirements.

This does not make the process run faster, it just improves the user experience.  There are odd times when figuring out the dock modes take a long time (more than 20 seconds), this patch allows the user to cancel immediately and try the process again.

The dock modes is spun off into a thread and the panel/form set as invalid (disables the 'next') once the dock modes are read, the combo box is populated and the panel is marked as valid.
Comment 8 mvfranz 2010-02-06 10:58:25 UTC
Created attachment 93932 [details]
Patch locking UI by threading the disk I/O to a worker thread
Comment 9 Jesse Glick 2010-02-10 12:43:12 UTC
Thanks, applied:

http://hg.netbeans.org/core-main/rev/021c53600f47

It seems to work, though I am not personally able to reproduce a pause of more than a fraction of a second so it is hard to tell.
Comment 10 mvfranz 2010-02-10 12:54:12 UTC
You are lucky!  This happens to me on my Work PC and my MacBook and MacPro (both snow leopard).  I did find that it was less likely to happen under linux even when linux was running in vmware on my macpro.

Thanks for committing.
Comment 11 Quality Engineering 2010-02-11 21:18:55 UTC
Integrated into 'main-golden', will be available in build *201002120200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/021c53600f47
User: mvfranz@netbeans.org
Log: #179548: UI blocked in Window wizard.
(applied by jglick)