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.
Summary: | Paste action always enabled in editor (regardless whether Text DataFlavor is present in clipboard) | ||
---|---|---|---|
Product: | editor | Reporter: | stelt <stelt> |
Component: | -- Other -- | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED WONTFIX | ||
Severity: | blocker | CC: | issues, jtulach, ttran |
Priority: | P4 | ||
Version: | 3.x | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Test for the proper behaviour of actions |
Description
stelt
2004-02-06 04:09:01 UTC
Yes, I can reproduce it. You meant Edit/Copy and Edit/Paste actions from main menu, right? I tried it to reproduce in editor context menu, that is popped up after right mouse click in editor area, but it seems, it works there... We should fix it to NB 3.6 How to reproduce: 1. you need to startup IDE with already open (deserialized) editor pane, the cursor is initially in editor pane. 2. try to copy something to clipboard, in Edit menu you will see Paste action disabled, what is wrong. 3. Paste action will start working if, you click on some file in explorer, or click to guarded block and then retun to editable area (in both cases Paste action property change support is fired, action status is updated) Editor module's paste action behaves correctly, it updates the state of disabing/enabling properly. The problem seems to be in openide. Reassigning. testing on win2k, last dev build, jdk 141 Ok, let's try. Because the problem appears only in the deserialized editor before switching to another one, I do not believe this deserves to be P2. Created attachment 13354 [details]
Test for the proper behaviour of actions
I tried to emulate the behaviour and wrote a test that opens CloneableEditor and checks state of actions. It really fails, but there is likely no reason why it should work! As EditorKit actions are completely broken. Paste is enabled even if there is nothing to paste and neither copy, cut or paste seem to fire anything in case someone selects, unselects some text or clipboard changes. Is not the bug in editor actions? OK. I will fix the problem of an enabled paste action even there is nothing to paste... (but I am a little bit sceptic whether it will help) As for the other actions I do not think they are completely broken, they work 'as expected' for me. fixed in [maintrunk] /cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v <-- EditorUI.java new revision: 1.57; previous revision: 1.56 I have fixed the problem of the enabled paste action, if there wasn't anything to paste in clipboard. Now the action is disabled in this case. During testing I have noticed, that if I copy to clipboard, paste action became enabled also in Edit submenu. It is because the state of action has been changed from false to true and change event has been fired. Note, that before the fix no change event was fired. Action has been always enabled. Because there was no event fired, the openide's paste action didn't know about editor paste action initial state. (This is not relevant to copy, cut actions - they are disabled by default and during selecting, the event is firing... so everythink works as expected) The fix changes the state of the paste action to and fro during initialization - event is fired, openide's paste action knows the state... Yarda, sorry for the confusion and my wrong reassigning to openide. Reopening as the clipboard contents are checked in ChangeListener for the caret so BTW after each typed char. If the clipboard contents are large the editor becomes unusable. We have to delegate to NbClipboard that contains a hack that the real system clipboard is checked less frequently. Implemented as Mila suggested. Fixed in [maintrunk]. /cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v <-- EditorUI.java new revision: 1.59; previous revision: 1.58 done /cvs/editor/libsrc/org/netbeans/editor/ImplementationProvider.java,v <-- ImplementationProvider.java new revision: 1.5; previous revision: 1.4 done /cvs/editor/src/org/netbeans/modules/editor/NbImplementationProvider.java,v <-- NbImplementationProvider.java new revision: 1.5; previous revision: 1.4 done Previous fix modified to check the Paste action status only when editor gets focus and when the cut or copy operation is invoked. /cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v <-- BaseKit.java new revision: 1.108; previous revision: 1.107 done /cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v <-- EditorUI.java new revision: 1.60; previous revision: 1.59 done /cvs/editor/libsrc/org/netbeans/editor/ImplementationProvider.java,v <-- ImplementationProvider.java new revision: 1.6; previous revision: 1.5 done /cvs/editor/src/org/netbeans/modules/editor/NbImplementationProvider.java,v <-- NbImplementationProvider.java new revision: 1.7; previous revision: 1.6 done Reopening because fix for this issue was rollbacked because of the deadlock in issue 40346. Dusane, please ensure that the Paste action is not errorneously disabled so that this issue can be downgraded to P3. Fixed in [maintrunk] without checking the clipboard content. Paste action is always enabled since the original fix with clipboard checking in order to update the Paste action status had a negative impact on editor perfomance and it also caused deadlocks described in issue 40346. /cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v <-- EditorUI.java new revision: 1.62; previous revision: 1.61 done Mila, could you please review the fix for release36. Thanks. Visual diffs - release36 vs. maintrunk: http://editor.netbeans.org/source/browse/editor/libsrc/org/netbeans/editor/EditorUI.java.diff?r1=1.60&r2=1.62 http://editor.netbeans.org/source/browse/editor/libsrc/org/netbeans/editor/BaseKit.java.diff?r1=1.108&r2=1.109 Approved. I tried copy/paste actions from menu, toolbar and editor. It works as expected. But, i discovered that the caret is not presented in editor after restart IDE. Should be it caused by the fix ? Integrated into release36 branch. /cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v <-- EditorUI.java new revision: 1.60.2.1; previous revision: 1.60 done /cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v <-- BaseKit.java new revision: 1.108.2.1; previous revision: 1.108 done > Fixed in [maintrunk] without checking the clipboard content.
> Paste action is always enabled since the original fix with clipboard
> checking in order to update the Paste action status had a negative
> impact on editor perfomance and it also caused deadlocks described in
> issue 40346.
the reason mentioned above (deadlock) is not relevant anymore after
the fix for issue 40693 and issue 40346 is a special case of 40693.
Reopen to consider if we want to enable/disable Paste according to the
content of the clipboard.
Changed description and downgraded to P4 as the original more serious problem was fixed and integrated into 3.6. Also removed REGRESSION keyword as there is no longer regression. We will fix this in promoD. Congrats to trung & yarda for fixing issue 40346 ;) Changing subcomponent to "clipboard" Changed target milestone to TBD. Ruda, what do you think? Is it reasonable to check the content of the clipboard and disable/enable Paste action? I checked two other editors and they don't seem to have such behaviour... Paste action is always enabled. *** Issue 57340 has been marked as a duplicate of this issue. *** There should be proceed only basic checks for the right clipboard content in the proper IDE state/place (e.g. alphanumeric content for the editor...) *** Issue 81483 has been marked as a duplicate of this issue. *** To summarize: Currently the editor does not check for clipboard content type. The paste action is enabled even in case someone copies e.g. a file in the explorer into clipboard. In such case the paste action in the editor does not paste anything. Personally I understand that someone might find this problematic but OTOH fixing this may affect performance negatively. Not sure whether the system clipboard or our wrapper around it is able to check for the transferable's supported mime types efficiently (would likely be done after each keystroke or at least on focus switch). Jardo don't you know? Marking for future preliminarily. Moving to the 'other' subcomponent. Later. NetBeans.org Migration: changing resolution from LATER to WONTFIX |