Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Cut/Copy/Paste in an Editor
Cut/Copy/Paste in an Editor [message #633631] Mon, 18 October 2010 15:25 Go to next message
Terran Gilman is currently offline Terran GilmanFriend
Messages: 67
Registered: July 2009
The Voice Tools Project has a set of custom editors we use to create different artifacts. We have been trying to implement cut/copy/paste in the main application editor which displays a visual representation of the workflow (not EMF/GEF) but it appears the workbench is getting confused as to which handler should be used for which editor instance or class. I'm sure we are doing something wrong.

The editor registers the handlers in the init(IEditorSite, IEditorInput) method like this:

            site.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new Action("Copy")
                public void run()
                    final SelectionStructure selection = currentCanvas.renderedCanvas.getSelection();
                    if(selection.getPrimarySelection() instanceof ConnectorFrame)

The editor instances are not shared, so each document would have it's own local handler. I assumed that the workbench maintained a scoped set of handlers for each editor instance. I think this assumption is probably wrong. Under certain circumstances it appears the handler for other editors, either other instances of our custom editor part or other classes all together, are being called instead. This is happening for cut/copy/paste actions.

It doesn't appear to be happening with our undo/redo actions. We are swapping out the undo contexts of our local actions and everything seems to work perfectly for those. Any help would be appreciated.
Re: Cut/Copy/Paste in an Editor [message #633884 is a reply to message #633631] Tue, 19 October 2010 17:03 Go to previous message
Terran Gilman is currently offline Terran GilmanFriend
Messages: 67
Registered: July 2009
I have no idea if this is the proper way to do things, but I think i have at least a workaround in place. I added a part listener to the editor site page which forcibly registers new handlers for all action ids each time the editor part is activated. This seems a little onerous so I'm probably still doing something inherently wrong.
Previous Topic:Right Click / File Refresh not refreshing my editors
Next Topic:IntroPart/ configExtension & the debugging thereof
Goto Forum:

Current Time: Fri Jan 22 04:09:32 GMT 2021

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

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

Back to the top