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 17506 - Cut and Paste does not work in Java Source Editor
Summary: Cut and Paste does not work in Java Source Editor
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Peter Zavadsky
URL:
Keywords:
: 17763 (view as bug list)
Depends on: 18066
Blocks:
  Show dependency tree
 
Reported: 2001-11-11 05:40 UTC by Sam
Modified: 2008-12-22 18:53 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Jesse's patch = fix (from #18066) (1.58 KB, patch)
2001-11-28 07:53 UTC, Peter Zavadsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam 2001-11-11 05:40:56 UTC
When I cut some text in the Java source editor using the pop-up menu bar, 
the "paste" menu item is still disabled. So I can't cut-and-paste text in 
the editor.

Sometime, I can recover the problem by click the output window, click on 
"Clear output" and the cut-and-paste works again in the source editor.
Comment 1 Jaroslav Tulach 2001-11-13 09:03:48 UTC
Peter, is not this similar to what you have solved in CloneableEditor?
Comment 2 Martin Roskanin 2001-11-14 14:04:47 UTC
How to reproduce:
1. Right click on some node in exporer and perform Copy.
2. Right click on editor window. (Paste is disabled. OK.)
3. Select some text in editor.
4. Invoke popup by right click. Perform copy.
5. reinvoke popup => Paste is still disabled.
Comment 3 Martin Roskanin 2001-11-14 14:23:46 UTC
It seems, it is in CloneableEditor.
if you perform item 4 via main window toolbar - Copy button, paste is also disabled.
Reassigning ...
Comment 4 Peter Zavadsky 2001-11-14 14:28:25 UTC
It seems to be a prob in CloneableEditor, updating the paste action.
I look at it. Assigned to me.
Comment 5 Peter Zavadsky 2001-11-14 14:32:24 UTC
Adjusted QA contact.
Comment 6 Peter Zavadsky 2001-11-14 15:13:30 UTC
It was in CloneableEditor. Adjusting version. Fixed in [main-trunk].

Fix:
openide/../openide/text/CloneableEditor.java [1.25].

Note: You could easilly reproduce it this way:
1) Select some text in editor
2) click on system Cut or Copy in main-window.
3) The actions are performed (yoiu can use succesfully the paste short
cut in editor) but the system Paste was not updated.

The prob with popup has the came reason.


Problem was there was created bridge between editor cut (copy) and
system cut (copy) actions, but it should be created between
substituted editor cut (copy) and system cut (copy) actions. The
substitute actions add the updating of system paste action to the
standard behaviour.

Comment 7 Martin Roskanin 2001-11-19 08:48:42 UTC
*** Issue 17763 has been marked as a duplicate of this issue. ***
Comment 8 Jan Zajicek 2001-11-23 09:54:06 UTC
It's back. Paste action in menu is disabled after cut or copy. Note,
that keyboard paste works.

dev#20011123
jdk1.4.0-rc1-b87
Comment 9 Jesse Glick 2001-11-23 16:48:43 UTC
Works OK for me in [r33 nov 23] with 1.3.1_01, maybe this is a JDK_1.4
problem?
Comment 10 Peter Zavadsky 2001-11-26 09:57:34 UTC
Yes it is on jdk1.4. 
And it seems the problem was the same which described and patched by
Jesse in #18066. It seem the patch for #18066 solves also this problem.
Comment 11 Jesse Glick 2001-11-26 11:36:01 UTC
Marking 1.4-specific with your permission.

Maybe JDK 1.4 replaces the clipboard with some kind of wrapper
transferable, too. Or perhaps it just doesn't use StringSelection to
begin with. You may want to insert a println into the place where I
patched #18066 to see what it is putting there.
Comment 12 Peter Zavadsky 2001-11-26 12:35:20 UTC
Jesse, I did and it seems it is used the wrapper
(sun.awt.datatransfer.TransferableProxy) instance (therefore the check
for instance of StringSelection failed on 1.4). Anyway your patch seems
to be more general and the right one. Thanks.
Comment 13 Peter Zavadsky 2001-11-27 08:33:35 UTC
Fixed in [release33]. See #18066.
Marked as 3.3.0 candidate.
Comment 14 Peter Zavadsky 2001-11-27 08:34:43 UTC
Fixed in [release33]. See #18066. Target milestone -> 3.3.1.
Marked as 3.3.0 candidate.
Comment 15 Peter Zavadsky 2001-11-28 07:53:12 UTC
Created attachment 3599 [details]
Jesse's patch = fix (from #18066)
Comment 16 Peter Zavadsky 2001-11-28 08:03:47 UTC
Request for approval to integrate the fix to release330:

Justification:
The fix is tested just by using cut/copy actions while wprking in
editor. Problem was the system action didn't enable/disable itself
accordingly.

Before the code checked just if in clipboard is StringSelection
instance of Transferable. This was only one case solution, works only
in jdk1.3 and only when the transferable was put in clipboard from editor.

Jesse's patch makes the check correct (more general), i.e. checking
for ability of Transferable to provide DataFlavor.stringFlavor. 

The patch is simple and shouldn't cause any problems.

Since it is Jesse's patch. I'm the reviewer.
Comment 17 Jesse Glick 2001-11-28 09:39:08 UTC
BTW this bug is RESOLVED but has no Resolution?!

Possibly useful background info: the reason I suggested the patch to
begin with was because I was working on the minicomposer example
module in
openide/api/examples/org/netbeans/examples/modules/minicomposer/ which
adds a clipboard convertor capable of taking a multiple "note"
selection and converting it into a string, as one flavor in an
ExTransferable. I noticed that it was working strangely: after copying
some notes, you could Ctrl-V to paste them in the editor, yet Paste
was disabled in popup and in the Edit menu. I found the bug in
CloneableEditor this way, patched it locally, restarted with the
patch, and the Paste menu item was now enabled, as well as Ctrl-V
working. Using 1.3.1_01, so the restriction to JDK 1.4 is not quite
accurate, though of course the bug is much more likely to be noticed
under 1.4.
Comment 18 Jan Zajicek 2001-11-28 16:35:35 UTC
verified in 3.3 #200111280300
Comment 19 Peter Zavadsky 2001-11-30 09:10:45 UTC
Integrated to [release330].

openide/../openide/text/CloneableEditor.java [1.25.6.1]

Removed keyword 3.3.0_CANDIDATE and changed milestone to 3.3.
Comment 20 Marian Mirilovic 2002-07-12 15:31:52 UTC
issue without resolution !
reopen and close it again
Comment 21 Marian Mirilovic 2002-07-12 15:34:37 UTC
x
Comment 22 Marian Mirilovic 2002-07-12 15:35:17 UTC
x
Comment 23 Quality Engineering 2003-07-01 16:39:38 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.