i have a handler and want to check a variable of my class if the handler is active or not. I found two ways: Use the propertytester mechanism or implement a sourceprovider.
Now i´m wondering which mechanism i should use, the propertytester or the sourceprovider?
Paul Webster Messages: 6813 Registered: July 2009 Location: Ottawa
Senior Member
The source provider allows you to add event driven variables to the
IEvaluationService (enabledWhen, activeWhen, visibleWhen, etc). A
property tester allows you to 1) test a property of an object in a core
expression and 2) write more complex tests for an object, as it calls as
test(*) method.
I use property testers if I need to test a property (obvious) or I need
to write a complex expression against an object (test its name and
connection state and buffered data etc) or it's an object that changes
in a very narrow way. If a property changes
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String) is
used to request the system re-calculate its state.
I use source providers if the object under test changes relatively
frequently (measured in minutes, not milliseconds :-) or is in response
to user action or need to be a target of a core expression. i.e. you
might want a Person to be a variable, so that you can test different
properties for that Person object.