Re: Retarget or override Open, Save, Delete actions [message #325059] |
Thu, 07 February 2008 03:38  |
Eclipse User |
|
|
|
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)
>
>
>
|
|
|
Re: Retarget or override Open, Save, Delete actions [message #326229 is a reply to message #325059] |
Wed, 12 March 2008 08:56  |
Eclipse User |
|
|
|
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)
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04950 seconds