Bug 282241 - "Paste" is enabled on file system when text is in clipboard
Summary: "Paste" is enabled on file system when text is in clipboard
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1.1   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 02:31 EDT by Zhou Renjian CLA
Modified: 2011-05-19 12:45 EDT (History)
1 user (show)

See Also:


Attachments
Fixing the bug (778 bytes, patch)
2009-07-02 02:33 EDT, Zhou Renjian CLA
no flags Details | Diff
Fixing the bug and fix copyrights (1.26 KB, patch)
2009-07-02 23:17 EDT, Zhou Renjian CLA
dmcknigh: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhou Renjian CLA 2009-07-02 02:31:19 EDT
Copy some texts into clipboard by "Ctrl+C", and go to Remote System view, expand a host's file system, click on "My Home" or "Root", right click, "Paste" menu item will be enabled. And click it will do nothing.

"Paste" menu item should only be enabled when a file or similar resources are in clipboard.
Comment 1 Zhou Renjian CLA 2009-07-02 02:33:01 EDT
Created attachment 140652 [details]
Fixing the bug

Index: src/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java

===================================================================

--- src/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java	(revision 11)

+++ src/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java	(working copy)

@@ -259,6 +259,10 @@

 					if (va != null)
 					{
 						enable = va.canDrop(selectedObject);
+						// Fix bug#282241: Copy anything, for example, text string, will enable "Paste" menu item
+						if (enable) {
+							enable = _srcType != SystemDNDTransferRunnable.SRC_TYPE_TEXT && _srcType != SystemDNDTransferRunnable.SRC_TYPE_UNKNOWN;
+						}
 						/* to allow disable of paste
 						 * not sure if this is a performance hit or not
 						if (enable)
Comment 2 David McKnight CLA 2009-07-02 09:28:25 EDT
Hi Zhou, thanks for the contribution!  Note that these contributions need the following:

1) modified files need to contain your copyright line
2) a legal disclaimer is needed for your patch as per
http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib

Comment 3 Zhou Renjian CLA 2009-07-02 23:17:08 EDT
Created attachment 140735 [details]
Fixing the bug and fix copyrights

Legal Message: I, Zhou Renjian, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, Shanghai Kortide, to make this contribution under the EPL. 

/org.eclipse.rse.ui/src/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
Comment 4 David McKnight CLA 2009-07-03 10:58:53 EDT
Comment on attachment 140735 [details]
Fixing the bug and fix copyrights

My eclipse doesn't handle this form of patch for some reason but I'm able to make the changes manually.
Comment 5 David McKnight CLA 2009-07-03 11:01:10 EDT
Thanks for the contribution.  I've committed the change to cvs.
Comment 6 Martin Oberhuber CLA 2011-05-19 12:45:12 EDT
Comment on attachment 140652 [details]
Fixing the bug

Obsoleted by later patch.