Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to filter context menu action according to Build Automatically setting
How to filter context menu action according to Build Automatically setting [message #337024] Tue, 21 July 2009 21:14
Josh Wolfe is currently offline Josh WolfeFriend
Messages: 1
Registered: July 2009
Junior Member
I need a context menu item to be visible only when Build Automatically is
turned off. So far, the objectContribution's objectClass is restricted to
IProject and I have a filter for my own projectNature. However, I'm stuck
when it comes to filtering for Build Automatically.

I've done about 3 hours of research and below is an outline of my progress
and failed attempts.

ResourcesPlugin.getWorkspace().getDescription().isAutoBuildi ng()
This is the information that I want to respond to. The problem is that I
don't know where to put the code that contains the above line. I need my
code to be consulted on whether the menu item is visible or not. How can I
get Eclipse to call my code for that?

This article describes how to use an IActionFilter to determine the
visibility of a menu item. l
I don't think this will work because the selected items in my situation
are of type IResource, not my own class as in the article. I have no
control over what the IResource's return in getAdapter() so I can't get my
own IActionFilter code to execute using this strategy.

Workspace Property Change Events
I've seen that internally Eclipse is using an event model to handle the
Build Automatically setting changes. I'd love to subscribe to such an
event, but I can't see where to add a listener. If I were notified every
time Build Automatically was switched on or off, I could turn the menu
item on and off manually.

plugin.xml: enablement/visibility -> objectState, systemProperty,
pluginState, etc.
objectState suffers from the IActionFilter problem. systemProperty would
work I guess if I had a reliable way to turning my own system variable on
and off in synch with Eclipse's Build Automatically property.
systemProperty suffers from the Property Change Event problem. pluginState
as well as the other choices don't seem to be any better than the above
Previous Topic:Bugged by "Error while loading manipulator." errors
Next Topic:INewWizard without pages
Goto Forum:

Current Time: Thu May 24 23:43:29 GMT 2018

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

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

Back to the top