Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Conditional conext menu in fragment plugin
Conditional conext menu in fragment plugin [message #290770] Wed, 31 August 2005 18:56 Go to next message
Spike is currently offline SpikeFriend
Messages: 3
Registered: July 2009
Junior Member
I'm working on a fragment plugin to extend an existing commercial plugin
and I've run into a bit of a stumbling block.

I want to add a refactor option to the right-click context menu in the
editor so that various refactoring options can be invoked.

I've got that part working fine using the org.eclipse.ui.popupMenus
extension point.

The problem is that the refactor options won't all be valid for any given
text selection. I can easily implement the checking logic in my actions
and tell the user that the action is invalid for the current selection,
but it would be a much better interface if I could disable the invalid
menu items before the user sees it.

I don't have access to the source code for the existing plugin, so I'm
wondering if there's a particular extension point that would allow me to
do what I want. I thought maybe there would be something that could be
added to the plugin at startup.

TIA

Spike
Re: Conditional conext menu in fragment plugin [message #290771 is a reply to message #290770] Wed, 31 August 2005 19:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Your action is an IActionDelegate. When you receive the
selectionChanged(IACtion, ISelection) you can get the selection, test
it, and if not valid, take the IAction passed it and setEnable(false),
if it is valid do setEnable(true).

Spike wrote:
> I'm working on a fragment plugin to extend an existing commercial plugin
> and I've run into a bit of a stumbling block.
>
> I want to add a refactor option to the right-click context menu in the
> editor so that various refactoring options can be invoked.
>
> I've got that part working fine using the org.eclipse.ui.popupMenus
> extension point.
>
> The problem is that the refactor options won't all be valid for any
> given text selection. I can easily implement the checking logic in my
> actions and tell the user that the action is invalid for the current
> selection, but it would be a much better interface if I could disable
> the invalid menu items before the user sees it.
>
> I don't have access to the source code for the existing plugin, so I'm
> wondering if there's a particular extension point that would allow me to
> do what I want. I thought maybe there would be something that could be
> added to the plugin at startup.
>
> TIA
>
> Spike
>

--
Thanks,
Rich Kulp
Re: Conditional conext menu in fragment plugin [message #290775 is a reply to message #290771] Wed, 31 August 2005 19:37 Go to previous message
Spike is currently offline SpikeFriend
Messages: 3
Registered: July 2009
Junior Member
Works perfectly.

Thanks!
Previous Topic:Help system on Live-CDROMs
Next Topic:How do I find out where a .class is coming from?
Goto Forum:
  


Current Time: Fri Apr 19 11:13:59 GMT 2024

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

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

Back to the top