Retargetable copy and paste action [message #233892] |
Fri, 04 May 2007 08:43 |
Dan Phifer Messages: 72 Registered: July 2009 |
Member |
|
|
I have a functioning GEF Editor, and I wanted to add copy and paste
functionality (cloning, to be specific). But I have a couple questions.
I've implemented the copy and paste actions, I have added them to the
context menu and they work fine.
However, the enablement of the copy/paste actions in the menu behave
strangely and do not match the enablement of the actions in my context
menu. Here's how I add them to the context menu:
menu.appendToGroup(GEFActionConstants.GROUP_COPY,
getAction(ActionFactory.COPY.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_COPY,
getAction(ActionFactory.PASTE.getId()));
I have registered the actions in the editor, and I am using the
ActionFactory.COPY.getId() and the ActionFactory.PASTE.getId().
addSelectionAction(registry, new CopyProcessesAction(this));
addSelectionAction(registry, new PasteProcessesAction(this));
private void addSelectionAction(ActionRegistry registry, IAction action)
{
registry.registerAction(action);
getSelectionActions().add(action.getId());
}
Is there something else I need to do in order to get the copy and paste
items in the menu (as well as the Ctrl+C, Ctrl+V commands) to enable
properly? Currently, when they are enabled, they work properly, so I know
that I have it set up at least partly in the right way. About half the
time, though, the copy command is disabled in the main menu, even when the
copy command in the context menu is enabled.
|
|
|
Re: Retargetable copy and paste action [message #233932 is a reply to message #233892] |
Fri, 04 May 2007 14:37 |
Anthony Hunter Messages: 446 Registered: July 2009 |
Senior Member |
|
|
Hi Dan,
You need to register these actions with the GlobalActionHandler. Look for
setGlobalActionHandler() for examples.
Cheers...
Anthony
"Dan Phifer" <dan.phifer@gmail.com> wrote in message
news:514188cbf1bad49e2b9eaf8897b0a455$1@www.eclipse.org...
>I have a functioning GEF Editor, and I wanted to add copy and paste
>functionality (cloning, to be specific). But I have a couple questions.
>I've implemented the copy and paste actions, I have added them to the
>context menu and they work fine.
> However, the enablement of the copy/paste actions in the menu behave
> strangely and do not match the enablement of the actions in my context
> menu. Here's how I add them to the context menu:
>
> menu.appendToGroup(GEFActionConstants.GROUP_COPY,
> getAction(ActionFactory.COPY.getId()));
> menu.appendToGroup(GEFActionConstants.GROUP_COPY,
> getAction(ActionFactory.PASTE.getId()));
>
> I have registered the actions in the editor, and I am using the
> ActionFactory.COPY.getId() and the ActionFactory.PASTE.getId().
> addSelectionAction(registry, new CopyProcessesAction(this));
> addSelectionAction(registry, new PasteProcessesAction(this));
>
> private void addSelectionAction(ActionRegistry registry, IAction action)
> {
> registry.registerAction(action);
> getSelectionActions().add(action.getId());
> }
>
>
> Is there something else I need to do in order to get the copy and paste
> items in the menu (as well as the Ctrl+C, Ctrl+V commands) to enable
> properly? Currently, when they are enabled, they work properly, so I know
> that I have it set up at least partly in the right way. About half the
> time, though, the copy command is disabled in the main menu, even when the
> copy command in the context menu is enabled.
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03500 seconds