IEvaluationService [message #512245] |
Thu, 04 February 2010 08:53  |
Eclipse User |
|
|
|
Hello,
i have few questions about the IEvaluationService. I have still a problem to understand it.
I have some Views and a Interface
public interface IDeletable {
public boolean isDeleteable();
public void delete();
}
If the methode isDeleteable true the command should be enable.
So i have a PropertyTester
public class DeleteProperyTester extends PropertyTester {
public static final String IS_DELETE = "delete";
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
if (property.equals(IS_DELETE))
return ((IDeletable) receiver).isDeleteable();
return false;
}
}
And the Handler
public class DeleteHandler extends AbstractHandler{
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart edi = HandlerUtil.getActivePart(event);
if (null != edi) {
if (edi instanceof IDeletable) {
IDeletable deletable = (IDeletable) edi;
deletable.delete();
}
}
return null;
}
}
If i switch the view, the ProprtyTester checks the method isDeleteable again. Its the same like the Save Command, i switch a Edtior and it's calling the isDirty method. Ok that works.
But I need a Event which can be fire like the PROP_DIRTY... If I modify a Text the PropertyTester shoudl test the isDeleteable again. But I don't know how i can do this. I know i need a EvaluationService:
1. How can i register a EvaluationService and how can i unregister?
2. Do I need a AbstractSourceProvider?
3. Some example?
Thanks =)
[Updated on: Thu, 04 February 2010 10:00] by Moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24745 seconds