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 76108 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.83 KB, created by
Benno Baumgartner
on 2007-08-15 03:23:56 EDT
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Benno Baumgartner
Created:
2007-08-15 03:23:56 EDT
Size:
3.83 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 15 Aug 2007 07:22:14 -0000 >@@ -173,17 +173,9 @@ > * 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= determineOperation(currentTarget, lastValidOperation, event.currentDataType, event.operations); > event.detail = currentOperation; >+ setFeedback(event, currentLocation); > } > > /* (non-Javadoc) >@@ -193,6 +185,8 @@ > */ > public void dragEnter(DropTargetEvent event) { > currentTarget = determineTarget(event); >+ currentLocation = determineLocation(event); >+ lastValidOperation = event.detail; > doDropValidation(event); > } > >@@ -203,6 +197,7 @@ > */ > public void dragOperationChanged(DropTargetEvent event) { > currentTarget = determineTarget(event); >+ lastValidOperation = event.detail; > doDropValidation(event); > } > >@@ -247,9 +242,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= determineOperation(currentTarget, event.detail, event.currentDataType, event.operations); > } > > /** >@@ -484,4 +477,38 @@ > */ > public abstract boolean validateDrop(Object target, int operation, > TransferData transferType); >+ >+ /** >+ * Determine the operation which should be executed given the target and the operation >+ * requested by the user. This method is called whenever some aspect of the drop operation >+ * changes. The operation is one of DND#DROP_DEFAULT, DND#DROP_COPY, DND#DROP_MOVE, DND#DROP_LINK. >+ * <p> >+ * The method returns the operation valid in the given context. The result is one of >+ * DND#DROP_NONE, DND#DROP_COPY, DND#DROP_MOVE, DND#DROP_LINK, DND#DROP_DEFAULT. >+ * </p> >+ * <p> >+ * Subclasses can overwrite this method to define which operation does make >+ * sense in the given context. >+ * </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 >+ * @param operations a bitwise OR'ing of the operations that the DragSource can support >+ * @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 determineOperation(Object target, int operation, TransferData transferType, int operations) { >+ 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