Topic
  • 2 replies
  • Latest Post - ‏2009-12-17T10:52:22Z by Krzysztof Kazmierczyk
Rudy Gachet
Rudy Gachet
2 Posts

Pinned topic Catching Paste event in RSM

‏2009-11-17T16:37:30Z |
Hi all,

I'm new to this forum and this is my first question :D

My problem is i can't "catch" paste event when the user click on the Copy button of the contextual menu (the activated view is the UML Modeler).
It works well for Ctrl+P shortcut and by the top menu Edit. So it sounds like RSM has his own commandId for Paste (and i think copy and cut) commands defined in the contextual menu.
I print the list of defined commandIds (using commandService.getDefinedCommandIds() method) but i did'nt found any command that looks like'*.past.*' other than org.eclipse.ui.edit.paste.

To "catch" the event Paste, i process as below:




public 

class AllNotifications 

extends ResourceSetListenerImpl 
{ @Override 

public 

void resourceSetChanged(ResourceSetChangeEvent event) 
{ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); 

final String commandPasteId = 
"org.eclipse.ui.edit.paste"; Command commandPaste = commandService.getCommand(commandPasteId); commandPaste.addExecutionListener(

new IExecutionListener() 
{ 

public 

void preExecute(String commandId, ExecutionEvent event) 
{ 
// some code 
}   
}); 
}


Thank you for your help.

Rudy Gachet
Updated on 2009-12-17T10:52:22Z at 2009-12-17T10:52:22Z by Krzysztof Kazmierczyk
  • Rudy Gachet
    Rudy Gachet
    2 Posts

    Re: Catching Paste event in RSM

    ‏2009-11-18T08:29:39Z  
    Oups,

    You should read "when the user click on the Paste button" and "It works well for Ctrl+V shortcut"
  • Krzysztof Kazmierczyk
    1 Post

    Re: Catching Paste event in RSM

    ‏2009-12-17T10:52:22Z  
    The caouse of the problem is that the paste item in the popup-menu is an action, not a command. There is also a discussion on Eclipse Community Forums where you can find more information about the reason of this situation.

    Krzysztof Kazmierczyk