Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339525

Summary: Add information to IPasteContext so that a paste action can instantiate AddContexts relative to the mouse pointer location.
Product: [Modeling] Graphiti Reporter: Rhett Hudson <rhett.hudson>
Component: CoreAssignee: Project Inbox <graphiti-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: matthias.gorning, michael.wenz
Version: 0.7.0Flags: michael.wenz: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M3 Theme_round_offs

Description Rhett Hudson CLA 2011-03-10 09:27:42 EST
Build Identifier: 20100917-0705

Currently, the position information available to guide the paste action in placing graphical representations includes whatever arrives from the clipboard and whatever is selected in the current diagram. This enables use cases like pasting at the same location as the copy, at an offset from the copy, at the location of the selection, at an offset from the selection, or replacement of the selection. 

I propose another use case: pasting at or at an offset from the location at the mouse pointer when the user issues the paste command. This is useful whether the paste operation occurs in the same diagram as the copy or a different diagram. It prevents the user from having to drag the pasted result an arbitrary distance across the diagram.

One way to achieve this is to add methods to IPasteContext that supply the target diagram, and the X and Y location of the mouse within that diagram. The paste() method could then optionally use this information to place its graphical representations.

Supplying the target diagram may be generally useful beyond this specific use case since acquiring it from the objects supplied by the getPictogramElements() method is something that every paste() method has to do and it is possible that it would be easier for the framework to do than for the client.

Reproducible: Always
Comment 1 Michael Wenz CLA 2011-07-18 07:05:29 EDT
Would like to target for Juno
Comment 2 Michael Wenz CLA 2011-10-06 10:32:06 EDT
The paste context is now also a LocationContext and provides the x and y coordinates of the paste location (right click location in case paste is triggered via context menu resp. cursor position in case of keyboard - at that location the menu is opened in this case as well).
The target diagram could already be retrieved via getDiagram defined in the AbstractFeature base class of DefaultPasteFeature.
Checked in to head and pushed to Eclipse.
commit 204c03948f84d847b1c2a38d686e6f82198a8fa3
Author: mwenz <michael.wenz@sap.com> 2011-10-06 15:49:33
Committer: mwenz <michael.wenz@sap.com> 2011-10-06 15:49:33
Parent: d8dfc13b1735b16de99369ab3d453105cade5dd1
Comment 3 Michael Wenz CLA 2012-04-11 10:38:48 EDT
Bookkeeping: Set target release
Comment 4 Michael Wenz CLA 2012-06-28 10:44:36 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)