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 198705

Summary: Duplicated nodes in NavigatorTC's lookup
Product: platform Reporter: Jan Stola <jstola>
Component: NavigatorAssignee: Tomas Stupka <tstupka>
Status: VERIFIED FIXED    
Severity: normal CC: tpavek
Priority: P2    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jan Stola 2011-05-18 13:53:11 UTC
Component Inspector of GUI Builder was removed/rewritten to use Navigator. Unfortunately, several actions don't work correctly now because of duplicated nodes in NavigatorTC's lookup. Consider, for example, the following test-case:

1. Create new JFrame form.
2. Insert JButton into the form.
3. Right-click on jButton1 in Navigator. Context menu is displayed.
   => some actions (Edit Text, Change Variable Name ...) are disabled,
   but should be enabled
   => some actions (Align, Same Size) are enabled, but should be disabled

Try to right-click on jButton1 in the designer area to see actions enabled/disabled correctly.

The root of the problem seems to be in lookup of NavigatorTC. It overrides getLookup() incorrectly. When you try to lookup Node.class in this lookup then you obtain the activated nodes two times (once from the default lookup and once from the navigator's panel lookup). This corrupts the logic of GUI Builder's actions that are enabled for single (or multiple) node selection only.

Suggested fix: Do not override getLookup() in NavigatorTC. Use TopComponent.associateLookup() instead, i.e., put something like the following code into the constructor of NavigatorTC:

    ProxyLookup lookup = new ProxyLookup(
        getController().getPanelLookup(),
        Lookups.singleton(getActionMap()));
    associateLookup(lookup);
Comment 1 Tomas Stupka 2011-05-18 14:02:40 UTC
a bug report just the way i like it!
Comment 2 Tomas Stupka 2011-05-19 13:41:59 UTC
Changeset: 41a61a4cf736
Author:    Tomas Stupka <tstupka@netbeans.org>
Date:      2011-05-19 15:32
Message:   
Issue #198705 - Duplicated nodes in NavigatorTC's lookup
Comment 3 Quality Engineering 2011-05-20 08:56:36 UTC
Integrated into 'main-golden', will be available in build *201105200400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/41a61a4cf736
User: Tomas Stupka <tstupka@netbeans.org>
Log: Issue #198705 - Duplicated nodes in NavigatorTC's lookup