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 121944 - Loss of Navigator view for VW projects after drag in Navigator
Summary: Loss of Navigator view for VW projects after drag in Navigator
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Navigator (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: David Simonek
URL:
Keywords:
: 121668 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-14 21:18 UTC by _ krystyna
Modified: 2008-12-22 11:09 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages log (34.86 KB, text/plain)
2007-11-14 21:19 UTC, _ krystyna
Details
Correct messages.log showing error (40.05 KB, text/plain)
2007-11-14 21:34 UTC, _ krystyna
Details
patch diff (1.28 KB, patch)
2007-11-15 16:12 UTC, David Simonek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ krystyna 2007-11-14 21:18:06 UTC
NetBeans IDE 6.0 RC1 (Build 200711131200)
Java: 1.5.0_12
WinXP


A scenario of dragging components in the Navigator causes the loss of Navigator
view for all the VW projects in multi-view. Cannot get the view back without IDE 
restart. It is reliably reproduced with jdk1.5.0_12. There is usually an 
ArrayIndexOutofBoundsException but not always. (See messages.log)

Follow these steps:

1. Create a VW ee5 project
2. From the palette's Layout section, first drag a Grid Panel component and drop it on the designer
   surface's left corner
3. From the palette's Basic section, drag a TextArea component and drop it on the designer surface's 
   right corner
4. From the palette's Basic section, drag a Listbox component and drop it on the designer's surface lower 
   right corner.
5. From the Navigator view, mouse click down on the listbox1 component and drag it "up" onto the gridPanel1 and
   wait until the default cursor is squarely pointing on "gridPanel1" before releasing mouse. The idea is 
   to make it a child of gridPanel1.
>Navigator view either becomes completely blank OR will show "f:view" artifact which I believe is from JSP.
   yet we have not changed view.
6. Now in attempt to recover, click in Navigator window and then click the designer screen, 
   attempting to re-select a component and thus to regain the view will fail. 
>Any project loaded in multiviewer will not be able to regain Navigator view and creating any new project
    will also not have a Navigator view. The only workaround is to restart the IDE.


Use of the Navigator to position components is essential and critical to the usage of the 
layout components.


Using 1.6.0_03 I have only seen the loss of the Navigator window momentarily -- it always seems
to recover, but it will show f:view briefly in the Navigator window then return to showing
the 3 components as expected after clicking in either Navigator or Designer surface.


The above scenario is about 75% reproducible even with jdk1.5.0_12 and may have a timing issue in the drop.
Re-try and you should be able to see the problem.
Comment 1 _ krystyna 2007-11-14 21:19:11 UTC
Created attachment 53010 [details]
messages log
Comment 2 _ krystyna 2007-11-14 21:34:42 UTC
Created attachment 53011 [details]
Correct messages.log showing error
Comment 3 David Simonek 2007-11-15 16:11:22 UTC
reproduced, fixed in main trunk:

Checking in NavigatorController.java;
/cvs/core/navigator/src/org/netbeans/modules/navigator/NavigatorController.java,v  <--  NavigatorController.java
new revision: 1.34; previous revision: 1.33
done
Comment 4 David Simonek 2007-11-15 16:12:12 UTC
Created attachment 53058 [details]
patch diff
Comment 5 David Simonek 2007-11-15 16:20:54 UTC
Stando, please review attached patch, thank you.
Patch is simple, it just adds check to not react on node destroy event if navigator is active. Navigator already ignores
activated node changes if navigator TC is active in winsys, so this makes things synchronized.

Background, what happened: After dragging listbox item under grid, listbox node was destroyed, event came and navigator
tried to update its providers, which it shoudn't at that time.
Comment 6 Stanislav Aubrecht 2007-11-15 16:26:56 UTC
i think that a safer variant of the same patch would be:

     public void nodeDestroyed(NodeEvent ev) {
         final TopComponent activated = WindowManager.getDefault().getRegistry().getActivated();
         if (EventQueue.isDispatchThread()) {
             forceUpdate( activated );
         } else {
             EventQueue.invokeLater(new Runnable() {
                 public void run() {
                     forceUpdate( activated );
                 }
             });
         }
     }

     /** Forces navigator content update.
      * Does nothing in case navigator TC is active */
     private void forceUpdate ( TopComponent activated ) {
         if (!navigatorTC.equals(activated)) {
             updateContext(true);
         }
     }


otherwise the patch looks ok to me
Comment 7 _ krystyna 2007-11-15 23:29:03 UTC
Tested the fix in trunk build #4450 (Build 20071115173012)
and it looks AOK. Thanks to Gowri who helped in reporting
bug as well as verifying this fix.
Comment 8 David Simonek 2007-11-16 10:44:27 UTC
saubrecht, you are right, testing for activated state should be done at the time of when nodeDestroyed is called, not
later in invokeLater. I modified your version, using the fact that updateContext(true) is already called from Runnable
impl, so that patch is simpler and don't need extra new Runnable()... inner class.

Checking in NavigatorController.java;
/cvs/core/navigator/src/org/netbeans/modules/navigator/NavigatorController.java,v  <--  NavigatorController.java
new revision: 1.35; previous revision: 1.34
done
Comment 9 David Simonek 2007-11-16 10:51:13 UTC
patch is now simple added check:

Index: NavigatorController.java
*** F:\Sources\Pokus\core\navigator\src\org\netbeans\modules\navigator\NavigatorController.java Base (1.33)
--- F:\Sources\Pokus\core\navigator\src\org\netbeans\modules\navigator\NavigatorController.java Locally Modified (Based
On 1.33)
***************
*** 523,528 ****
--- 523,532 ----
      /****** NodeListener implementation *****/
      
      public void nodeDestroyed(NodeEvent ev) {
+         // #121944: don't react on node destroy when we are active 
+         if (navigatorTC.equals(WindowManager.getDefault().getRegistry().getActivated())) {
+             return;
+         }
          if (EventQueue.isDispatchThread()) {
              run();
          } else {
Comment 10 Lukas Hasik 2007-11-16 11:11:38 UTC
tested with trunk daily build. It works - verified in trunk by QE.

Product Version: NetBeans IDE Dev (Build 200711160000)
Java: 1.5.0_12; Java HotSpot(TM) Client VM 1.5.0_12-b04
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 11 David Simonek 2007-11-16 11:28:48 UTC
*** Issue 121668 has been marked as a duplicate of this issue. ***
Comment 12 David Simonek 2007-11-16 17:10:30 UTC
fix merged into release60 branch:

Checking in NavigatorController.java;
/cvs/core/navigator/src/org/netbeans/modules/navigator/NavigatorController.java,v  <--  NavigatorController.java
new revision: 1.33.2.1; previous revision: 1.33
Comment 13 _ krystyna 2007-11-16 22:41:11 UTC
Tested the revised fix in trun (Build 20071116125734) with jdk1.5.0_12 and looks good;
also tested scenario from #121668.
Comment 14 Petr Chytil 2007-11-19 16:56:55 UTC
ok, verified in:

Product Version: NetBeans IDE 6.0 RC2 (Build 200711190000)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-b02
System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/petr/.netbeans/6.0rc2