Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Registering an action as retargettable action
Registering an action as retargettable action [message #326421] Wed, 19 March 2008 09:51
Rahul Kamdar is currently offline Rahul KamdarFriend
Messages: 63
Registered: July 2009
Member
Hi,

This is actually from a old chain... I would be really grateful if someone
could guide me in the right direction for registering actions as
retargettable actions...

Anyway for your reference, have copy pasted the text below...

Thanks,
Rahul

Hi Francis,

Thanks for the help that you extended. I worked on the following and used it
successfully to override the Open action (this is registered as a
Retargettable action already). However, for the editActions (copy, paste) I
am unable to override the default action, since I need to register my
actions as retargetting these default actions. How can I do that really?

The way I have added my actions (following instructions given on the CNF
blog - scribbledideas.blogspot.com) is using actionProvider... following is
roughly the code from the plugin.xml for reference (if it helps!)...

<extension
id="com.sample.prjexpextn"
name="sample Project"
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="true"
contentProvider="com.sample.prjexpextn.cnf.VFileContentProvider "
icon="/icons/designer_folder_tree_icon.gif"
id="com.sample.xpd.projectExplorer.extension"
labelProvider="com.sample.prjexpextn.cnf.VFileLabelProvider "
name="Sample"
priority="high">
<actionProvider
class=" com.sample.prjexpextn.cnf.action.providers.EditActionProvide r "
id="com.sample.prjexpexten.actionProvider.EditAction"
overrides="org.eclipse.ui.navigator.resources.EditActions">
<enablement>
<or>
<and>
<adapt type="org.eclipse.core.resources.IFile" />
<test
...............
</test>
</and>
<and>
<adapt type="org.eclipse.core.resources.IFolder" />
<test
...................
</test>
</and>
</or>
</enablement>
</actionProvider>
</navigatorContent>
</extension>

I believe in order to ensure that these actions RETARGET the original
copy/paste, I have to define them as retargettable actions? CNF as of now
has only one retargettable action
org.eclipse.ui.navigator.ICommonActionConstants.OPEN. So similarly, how do I
register other actions as retarget actions?

Thanks,
Rahul

"Francis Upton" <francisu@ieee.org> wrote in message
news:47AAC392.6050107@ieee.org...
> This belongs on eclipse.platform, I have posted it there.
>
> Look into the org.eclipse.ui.navigator.viewer and .navigatorContent
> extension points. This allows you to select which action sets you pick up
> from the definition of the CommonNavigator which is found in
> org.eclipse.ui.navigator.resources.
>
> You can substitute your own actions using something like this (I replaced
> the NewAction with my own):
>
> <!-- for RCP app -->
> <extension
> point="org.eclipse.ui.navigator.viewer">
> <viewerActionBinding
> viewerId="com.oaklandsw.gui.navigator">
> <includes>
> <!-- we don't want all of these, as we don't want NewActions -->
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.EditActions" />
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.RefactorActions " />
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.OpenActions" />
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.PortingActions" />
> <actionExtension
> pattern=" org.eclipse.ui.navigator.resources.PropertiesActionsProvider " />
> <actionExtension
> pattern=" org.eclipse.ui.navigator.resources.WorkManagementActionProvi der "
> />
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.ResourceMgmtActions " />
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.WorkingSetActionProvider " />
> <actionExtension pattern="com.oaklandsw.gui.*" />
> <actionExtension pattern="com.oaklandsw.transform.*" />
> </includes>
> <excludes>
> <!-- exclude everything not specifically included -->
> <actionExtension
> pattern="org.eclipse.ui.navigator.resources.NewActions" />
> </excludes>
> </viewerActionBinding>
> <viewerContentBinding viewerId="com.oaklandsw.gui.navigator">
> <includes>
> <contentExtension
> pattern="com.oaklandsw.transform.navigatorContent"/>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resourceContent" />
> <contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"/>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resources.workingSets"/>
> </includes>
> </viewerContentBinding>
> </extension>
>
>
> <extension
> point="org.eclipse.ui.navigator.navigatorContent">
>
> ...
>
> <actionProvider
> class="com.oaklandsw.transform.editor.NewActionProvider"
> id="com.oaklandsw.transform.NewActions"
> priority="highest">
> <enablement>
> <not>
> <systemTest property="org.eclipse.core.runtime.product" value="XXX"/>
> </not>
> </enablement>
> </actionProvider>
> ...
>
>
>
>
>
> Also, these postings provide much useful information on use of the CNF
> (package explorer):
>
> http://scribbledideas.blogspot.com/2006/05/building-common-n avigator-based-viewer.html
>
> I don't know off the top of my head how you deal with the double-click
> stuff, but if you look at the extension points and the articles, you
> should be able to find that.
>
>
>
> Rahul Kamdar wrote:
>> Hi,
>>
>> In my plugin I have written an extension to the project explorer and
>> defined
>> my own content provider for it. I want to be able to change the default
>> action on double-clicking (opening of an editor either associated with it
>> or
>> in text editor) a file in the tree - so that instead of it performing the
>> default open an editor for the file I can perform some of my own actions.
>>
>> Additionally, I want to be able to edit the save cycle of a file - on
>> pressing the save button (or triggering save by keyboard shortcut) and
>> peform my own processing. Same for the delete action on a resource.
>>
>> I would really appreciate any help or pointers in this. Thanks!
>>
>> PS - These are issues that I am trying to resolve at the highest priority
>> as
>> of now!! :) There is one more thing I am unable to do - to be able to
>> modify
>> the menu that pops when you right-click any item in the project explorer
>> (so
>> that I can add/remove buttons in this menu)
>>
>>
Previous Topic:How to put different projects together
Next Topic:Dynamic Help
Goto Forum:
  


Current Time: Sun Sep 01 02:24:07 GMT 2024

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

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

Back to the top