Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Renaming EMF Editor with F2
Renaming EMF Editor with F2 [message #498054] Fri, 13 November 2009 21:55 Go to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi,

I am trying to implement the keybinding F2 for a custom rename operation in the EMF editor (or, if there is already a rename functionality triggered by F2 this would be great too).

I added the command and a key binding for this command into my plugin.xml however I have to specify a context id. Now I wanted to try to create a context ID but I don't really know how.
I added the contexts extension point to my xml and tried to add it, but I don't know what the parentId for a EMF generated editor would be and the list poping up by clicking browse doesn't help me a lot.

Can anyone give me a hint on how to do this?

best regards,
artur
Re: Renaming EMF Editor with F2 [message #498059 is a reply to message #498054] Fri, 13 November 2009 22:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Artur,

I haven't a clue how to do this. Hopefully someone else will have an
idea...


Artur Kronenberg wrote:
> Hi,
>
> I am trying to implement the keybinding F2 for a custom rename
> operation in the EMF editor (or, if there is already a rename
> functionality triggered by F2 this would be great too).
>
> I added the command and a key binding for this command into my
> plugin.xml however I have to specify a context id. Now I wanted to try
> to create a context ID but I don't really know how. I added the
> contexts extension point to my xml and tried to add it, but I don't
> know what the parentId for a EMF generated editor would be and the
> list poping up by clicking browse doesn't help me a lot.
>
> Can anyone give me a hint on how to do this?
>
> best regards,
> artur


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Renaming EMF Editor with F2 [message #498347 is a reply to message #498054] Mon, 16 November 2009 14:29 Go to previous messageGo to next message
Mario Winterer is currently offline Mario WintererFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Artur!

Eclipse alreay defines a command and a keybinding for "rename". So you
could simply reuse this command and just define a custom handler that is
able to perform your custom renaming inside your editor.

Command-ID: org.eclipse.ui.edit.rename
Keybinding: F2

Example:
<extension point="org.eclipse.ui.handlers">
<handler class="<MY_RENAME_HANDLER_IMPLEMENTATION>"
commandId="org.eclipse.ui.edit.rename">
<enabledWhen>
<with variable="activeEditorId">
<equals value="<MY_EDITOR_ID>">
</equals>
</with>
</enabledWhen>
<activeWhen>
<with variable="activeEditorId">
<equals value="<MY_EDITOR_ID>">
</equals>
</with>
</activeWhen>
</handler>
</extension>

Artur Kronenberg schrieb:
> Hi,
>
> I am trying to implement the keybinding F2 for a custom rename operation
> in the EMF editor (or, if there is already a rename functionality
> triggered by F2 this would be great too).
>
> I added the command and a key binding for this command into my
> plugin.xml however I have to specify a context id. Now I wanted to try
> to create a context ID but I don't really know how. I added the contexts
> extension point to my xml and tried to add it, but I don't know what the
> parentId for a EMF generated editor would be and the list poping up by
> clicking browse doesn't help me a lot.
>
> Can anyone give me a hint on how to do this?
>
> best regards,
> artur
Re: Renaming EMF Editor with F2 [message #498372 is a reply to message #498347] Mon, 16 November 2009 16:12 Go to previous message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi Mario,

using the custom rename command of eclipse and writing my own handler worked perfect. Thanks!
Previous Topic:Generating programmatically a genmodel file
Next Topic:Constraints in meta-model
Goto Forum:
  


Current Time: Sun Sep 22 09:06:20 GMT 2024

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

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

Back to the top