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 39678 - Paste action always enabled in editor (regardless whether Text DataFlavor is present in clipboard)
Summary: Paste action always enabled in editor (regardless whether Text DataFlavor is ...
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 57340 81483 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-06 04:09 UTC by stelt
Modified: 2009-11-02 11:02 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test for the proper behaviour of actions (9.04 KB, patch)
2004-02-10 16:53 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description stelt 2004-02-06 04:09:01 UTC
with ctrl-C ctrl-V it does work though
Comment 1 Martin Roskanin 2004-02-06 07:10:08 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
Comment 2 Martin Roskanin 2004-02-06 10:10:14 UTC
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

Comment 3 Jaroslav Tulach 2004-02-06 16:10:30 UTC
Ok, let's try.
Comment 4 Jaroslav Tulach 2004-02-10 13:47:45 UTC
Because the problem appears only in the deserialized editor before
switching to another one, I do not believe this deserves to be P2.
Comment 5 Jaroslav Tulach 2004-02-10 16:53:16 UTC
Created attachment 13354 [details]
Test for the proper behaviour of actions
Comment 6 Jaroslav Tulach 2004-02-10 16:56:38 UTC
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?
Comment 7 Martin Roskanin 2004-02-16 16:37:12 UTC
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. 
Comment 8 Martin Roskanin 2004-02-17 13:11:23 UTC
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.
Comment 9 Miloslav Metelka 2004-02-23 15:28:35 UTC
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.
Comment 10 Dusan Balek 2004-02-24 15:28:03 UTC
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
Comment 11 Dusan Balek 2004-02-27 11:25:42 UTC
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
Comment 12 Miloslav Metelka 2004-03-02 19:41:26 UTC
Reopening because fix for this issue was rollbacked because of the
deadlock in issue 40346.
Comment 13 Miloslav Metelka 2004-03-02 19:43:22 UTC
Dusane, please ensure that the Paste action is not errorneously
disabled so that this issue can be downgraded to P3.
Comment 14 Dusan Balek 2004-03-03 09:37:58 UTC
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
Comment 16 Miloslav Metelka 2004-03-03 14:29:39 UTC
Approved.
Comment 17 pfelenda 2004-03-04 11:11:37 UTC
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 ?
Comment 18 Dusan Balek 2004-03-05 08:20:24 UTC
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
Comment 19 _ ttran 2004-03-05 08:57:44 UTC
> 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.
Comment 20 Miloslav Metelka 2004-03-05 09:36:11 UTC
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 ;)
Comment 21 psuk 2004-03-23 18:32:22 UTC
Changing subcomponent to "clipboard"
Comment 22 Roman Strobl 2005-01-10 13:17:06 UTC
Changed target milestone to TBD.
Comment 23 Martin Roskanin 2005-03-22 15:16:06 UTC
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.
Comment 24 Martin Roskanin 2005-04-04 09:43:16 UTC
*** Issue 57340 has been marked as a duplicate of this issue. ***
Comment 25 Rudolf Bock 2005-04-05 14:43:49 UTC
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...)
Comment 26 Nathan Fiedler 2006-07-31 19:30:52 UTC
*** Issue 81483 has been marked as a duplicate of this issue. ***
Comment 27 Miloslav Metelka 2007-03-20 14:45:47 UTC
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.
Comment 28 Vitezslav Stejskal 2007-11-05 13:31:18 UTC
Moving to the 'other' subcomponent.
Comment 29 Dusan Balek 2008-12-01 20:35:16 UTC
Later.
Comment 30 Quality Engineering 2009-11-02 11:02:11 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX