| 
| Override Copy and Paste Action [message #329526] | Fri, 27 June 2008 02:26  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: automatic.javalobby.org 
 Hi all
 
 Actually I need to perform some checking and save some information whenever there is a copy in the navigator view , same with paste action also.
 I was trying all the possible ways .  I first tried with the common navigator based on the article "  http://scribbledideas.blogspot.com/2006/05/building-common-n avigator-based-viewer.html"
 But my actiongroup were never called.
 
 Then I tried with global action handler , but that only triggers when we click through the top menu, not through the context menu,
 
 I finally tried with
 
 <command
 name="%command.copy.name"
 description="%command.copy.description"
 categoryId="org.eclipse.ui.category.edit"
 id="org.eclipse.ui.edit.copy"
 default
 
 
 Again my handler is never called .
 
 
 I think there is some problem with way of thinking
 
 Can someone give some ideas?
 
 
 
 Anyway I just need to trigger my class whenever there is a copy or paste in th the package explorer , that is what I need
 |  |  |  | 
| 
| Re: Override Copy and Paste Action [message #329534 is a reply to message #329526] | Fri, 27 June 2008 07:33  |  | 
| Eclipse User  |  |  |  |  | The way I override copy and paste is by using actionProvider in my navigatorContent extension point.
 
 <actionProvider
 
 class="....action.providers.EditActionProvider"
 
 id=".......explorer.actionProvider.EditAction"
 
 overrides="org.eclipse.ui.navigator.resources.actions.EditActions ">
 
 <enablement>
 
 .............
 
 
 </enablement>
 
 </actionProvider>
 
 
 I have defined an actionProvider to override the Edit actions (cut, copy,
 paste, delete) as above. Then in my actionProvider class which extends
 CommonActionProvider, in the fillActionBars method, I set the
 globalActionHandler on the actionBars object with the arguments
 ActionFactory.Copy/Paste.getId against my custom copy/paste actions.
 
 That's pretty much it. The scribbledideas blog is of great use! So also you
 could repost your query with [CNF] in the subject and you might get some
 help from Francis Uptown/Paul Webster. You could refer to Paul's blog at
 http://pweclipse.blogspot.com/ for how to do what you wish to achieve using
 commands and handlers which would be a better approach.
 
 Thanks,
 Rahul
 
 
 "goldhouse" <automatic@javalobby.org> wrote in message
 news:25437471.61261214548014824.JavaMail.root@cp1.dzone.com...
 > Hi all
 >
 > Actually I need to perform some checking and save some information
 > whenever there is a copy in the navigator view , same with paste action
 > also.
 > I was trying all the possible ways .  I first tried with the common
 > navigator based on the article "
 >  http://scribbledideas.blogspot.com/2006/05/building-common-n avigator-based-viewer.html"
 > But my actiongroup were never called.
 >
 > Then I tried with global action handler , but that only triggers when we
 > click through the top menu, not through the context menu,
 >
 > I finally tried with
 >
 > <command
 >      name="%command.copy.name"
 >      description="%command.copy.description"
 >      categoryId="org.eclipse.ui.category.edit"
 >      id="org.eclipse.ui.edit.copy"
 > default
 >
 >
 > Again my handler is never called .
 >
 >
 > I think there is some problem with way of thinking
 >
 > Can someone give some ideas?
 >
 >
 >
 > Anyway I just need to trigger my class whenever there is a copy or paste
 > in th the package explorer , that is what I need
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04618 seconds