Skip to main content



      Home
Home » Modeling » Graphiti » Pasting Near The Mouse Pointer
Pasting Near The Mouse Pointer [message #658701] Wed, 09 March 2011 09:27 Go to next message
Eclipse UserFriend
When a user pastes I'd like to be able to place the graphical objects relative to the current position of the mouse pointer. The IPasteContext does not contain coordinates for the pointer when the paste operation was invoked, so at the moment I'm limited to whatever information I pass through the clipboard from the original copy operation. That allows me to perform the paste at an offset relative to the original, but that may be meaningless if the paste operation is performed in another diagram.

Is that a feature I should request? Or is there some mechanism for getting the mouse pointer coordinates that I'm missing?
Re: Pasting Near The Mouse Pointer [message #658731 is a reply to message #658701] Wed, 09 March 2011 10:50 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rhett,

you can try a hack. Use

ILocation mouseLocation = ((DiagramEditorInternal)
getDiagramEditor()).getCurrentMouseLocation();

to retrieve the current mouse location. Unfortunately, this introduces a
dependency to gef
in your coding and also an internal usage since DiagramEditorInternal is
obviously internal ;-).
So it is really a hack just to try if you could get things working as
desired.

So either we could streamline the API of IDiagramEditor or we could
add the coordinates to the context (which is better from my point of view).
If we add coordinates to the context we should express them
container-relative...

What do you think?

Best, Tim
Re: Pasting Near The Mouse Pointer [message #658743 is a reply to message #658731] Wed, 09 March 2011 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Tim,

I agree with your opinion that passing the coordinates through the context is better. I haven't seen anywhere else in the Graphiti framework where the user in encouraged to randomly sample the position of the mouse. Smile Though I may temporarily try your suggested hack to make my paste a little nicer.

In terms of passing relative coordinates, I'm not sure what the container is in this case. The Diagram that contains the PictogramElements in the array held by the IPasteContext? That seems fine. It might be nice for the IPasteContext to actually have a reference to the Diagram that contains the PictogramElements in the array.

The example code requires that the Diagram be selected to do a paste, but I didn't like the additional click required to deselect the things I had just selected for copying in order to do the paste. So, my canPaste() and my paste() have some additional complexity for digging the Diagram out of whatever shows up in the PictogramElement array.

--Rhett
Re: Pasting Near The Mouse Pointer [message #658922 is a reply to message #658743] Thu, 10 March 2011 08:06 Go to previous messageGo to next message
Eclipse UserFriend
Can you open a bugzilla for your requirement?
Re: Pasting Near The Mouse Pointer [message #658944 is a reply to message #658922] Thu, 10 March 2011 09:31 Go to previous message
Eclipse UserFriend
Done, it is Bug 339525.
Previous Topic:ToolBar DropDown Menu for Graphiti Based Editor
Next Topic:How to overlay images
Goto Forum:
  


Current Time: Wed Jul 23 11:14:56 EDT 2025

Powered by FUDForum. Page generated in 0.25349 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top