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 52128 - Editor Refactoring actions enabled/disabled state delayed
Summary: Editor Refactoring actions enabled/disabled state delayed
Status: CLOSED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Rudolf Bock
URL:
Keywords:
: 53434 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-06 18:29 UTC by zikmund
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zikmund 2004-12-06 18:29:34 UTC
Build 200412011810 (RC2)

1) Create new userdir, new JavaProject, edit Main.java
2) Add a property (private int value;)
3) Invoke context menu on 'value' | Refactoring
ERROR: 'Encapsulate Fields' disabled.
4) Invoke refactoring context menu on 'main'
(method name)
ERROR: 'Encapsulate Fields' enabled
5) Repeat 3,4 ... same wrong 'Encapsulate Fields'
enabled/disabled state.

Notice: similar with 'Move Class' action in menu
on a property vs. in class definition.
Comment 1 Martin Matula 2004-12-07 09:02:31 UTC
Enable/disable state of the refactoring action is controlled by the
active node (for performance reasons). Setting of active nodes is
delayed by design (in java module) - there is a 200ms timeout. I don't
think this is a P2, since an easy workaround exists (just wait a
little more time).
We should redesign the actions so that they would be always enabled.
This would solve the problem. It is too expensive to compute
enabling/disabling of the action immediately based on the cursor
position. Reassigning to Dusan to come up with a consistent scheme for
disabling and enabling actions, since we already have other issues
filed for various inconsistencies in this behavior.
Comment 2 zikmund 2004-12-07 09:16:02 UTC
I don't see any waiting 200ms workaround - the only workaround is
close the context menu and open it again (quite painful).
Opening/focusing only other context submenu (e.g. 'Go To') doesn't
help too. Did I miss something?
Comment 3 Martin Matula 2004-12-07 10:01:01 UTC
You need to wait *before* you open the menu. You can see in the
navigation view what node is active - when it switches the active
node, you are safe to assume that the active node was set.
Comment 4 Jan Becicka 2005-01-14 13:30:10 UTC
Rudolfe, please evaluate. Thanks
Comment 5 Jan Becicka 2005-01-18 10:17:12 UTC
*** Issue 53434 has been marked as a duplicate of this issue. ***
Comment 6 ddevore 2005-01-18 17:03:31 UTC
I have also noticed that once the encapsulate is enabled if you move
the mouse sometimes the option will still not be enabled and depending
on where you are in the file it may or may not be enabled.
Comment 7 Jan Becicka 2005-01-27 16:37:47 UTC
Should be fixed together with issue 40390
Comment 8 Jan Becicka 2005-02-03 08:15:47 UTC
Checking in
org/netbeans/modules/refactoring/ui/ChangeParametersAction.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/ChangeParametersAction.java,v
 <--  ChangeParametersAction.java
new revision: 1.13; previous revision: 1.12
done
Checking in
org/netbeans/modules/refactoring/ui/EncapsulateFieldAction.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/EncapsulateFieldAction.java,v
 <--  EncapsulateFieldAction.java
new revision: 1.11; previous revision: 1.10
done
Checking in org/netbeans/modules/refactoring/ui/MoveClassAction.java;
/cvs/refactoring/src/org/netbeans/modules/refactoring/ui/MoveClassAction.java,v
 <--  MoveClassAction.java
new revision: 1.13; previous revision: 1.12
done
Comment 9 zikmund 2005-02-16 10:01:52 UTC
Verified.
Encapsulate Fields action is still enabled.