Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Source Provider State ignored by Handler(fireSourceChanged() invocation has no effect on handler enablement state)
Source Provider State ignored by Handler [message #1241271] Fri, 07 February 2014 18:35 Go to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
I have a Handler with an enabledWhen filter based on a variable that I've defined and implemented with a SourceProvider


I declare the SourceProvider as follows

            provider="<my class reference>">

And here's my SourceProvider implementation:

        String state
	public String[] getProvidedSourceNames() {
		return new String[] {"MY_VARIABLE"};

	public Map<String, String> getCurrentState() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("MY_VARIABLE", state));
		return map;

	public void setCurrentState(String state) {
		this.state = state
		fireSourceChanged(ISources.WORKBENCH, "MY_VARIABLE", state); 

Pretty straightforward, but it doesn't work. I set the state of the source provider

ISourceProviderService service = ...
sourceProvider = service.getSourceProvider("MY_VARIABLE");

I see the sourceChanged event fired in the debugger with the value set to "true". But the handler remains disabled. I tried forcing an evaluation with the evaluation service

IEvaluationService evaluationService = ...

But this has no effect either.

Can someone please tell me what I'm missing?
Re: Source Provider State ignored by Handler [message #1241300 is a reply to message #1241271] Fri, 07 February 2014 19:33 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Of course as soon as I post a message, the answer occurs to me. The tooltip for the value attribute of the "equals" element inside the "with" element used in the "enabledWhen" expression notes that the value is converted to a java base type according to the customary rules.

So my expected value of "true" was interpreted as a Boolean. I changed the SourceProvider implementation to set the value of the variable as a Boolean instead of converting it to a String. Now the enablement works as expected.
Previous Topic:drawing arrow lines between swt components/jface viewers
Next Topic:ScrolledComposite in TitleAreaDialog
Goto Forum:

Current Time: Sun Oct 04 17:16:12 GMT 2015

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

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