Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 74689 Details for
Bug 197965
[DND] Allow ViewerDropAdapter to set the default operation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
fix
fix_197965.txt (text/plain), 3.36 KB, created by
Benno Baumgartner
on 2007-07-26 10:00:38 EDT
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Benno Baumgartner
Created:
2007-07-26 10:00:38 EDT
Size:
3.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/viewers/ViewerDropAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java,v >retrieving revision 1.15 >diff -u -r1.15 ViewerDropAdapter.java >--- src/org/eclipse/jface/viewers/ViewerDropAdapter.java 20 Jun 2007 19:53:46 -0000 1.15 >+++ src/org/eclipse/jface/viewers/ViewerDropAdapter.java 26 Jul 2007 14:00:59 -0000 >@@ -173,16 +173,7 @@ > * that it is still enabled. > */ > private void doDropValidation(DropTargetEvent event) { >- //update last valid operation >- if (event.detail != DND.DROP_NONE) { >- lastValidOperation = event.detail; >- } >- //valid drop and set event detail accordingly >- if (validateDrop(currentTarget, event.detail, event.currentDataType)) { >- currentOperation = lastValidOperation; >- } else { >- currentOperation = DND.DROP_NONE; >- } >+ currentOperation= getDefaultDropOperation(currentTarget, lastValidOperation, event.currentDataType); > event.detail = currentOperation; > } > >@@ -193,6 +184,7 @@ > */ > public void dragEnter(DropTargetEvent event) { > currentTarget = determineTarget(event); >+ lastValidOperation = event.detail; > doDropValidation(event); > } > >@@ -203,6 +195,7 @@ > */ > public void dragOperationChanged(DropTargetEvent event) { > currentTarget = determineTarget(event); >+ lastValidOperation = event.detail; > doDropValidation(event); > } > >@@ -247,9 +240,7 @@ > * Last chance for the action to disable itself > */ > public void dropAccept(DropTargetEvent event) { >- if (!validateDrop(currentTarget, event.detail, event.currentDataType)) { >- event.detail = DND.DROP_NONE; >- } >+ event.detail= getDefaultDropOperation(currentTarget, event.detail, event.currentDataType); > } > > /** >@@ -484,4 +475,35 @@ > */ > public abstract boolean validateDrop(Object target, int operation, > TransferData transferType); >+ >+ /** >+ * Get the default drop operation on the given object. This method is called whenever some >+ * aspect of the drop operation changes. >+ * <p> >+ * The default operation is the one used when no modifier key is pressed by the user. >+ * </p> >+ * <p> >+ * Subclasses can overwrite this method to define which operation does make >+ * sense on the drop target. >+ * </p> >+ * >+ * @param target the object that the mouse is currently hovering over, or >+ * <code>null</code> if the mouse is hovering over empty space >+ * @param operation the current drag operation (copy, move, etc.) >+ * @param transferType the current transfer type >+ * @return the operation which will be executed if no modifier key is pressed >+ * by the user >+ * >+ * @see DND#DROP_NONE >+ * @see DND#DROP_MOVE >+ * @see DND#DROP_COPY >+ * @see DND#DROP_LINK >+ */ >+ protected int getDefaultDropOperation(Object target, int operation, TransferData transferType) { >+ if (!validateDrop(target, operation, transferType)) { >+ return DND.DROP_NONE; >+ } >+ >+ return operation; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197965
:
74689
|
74905
|
76108