IEvaluationService [message #512245] |
Thu, 04 February 2010 13:53 |
Dennis Melzer Messages: 244 Registered: July 2009 |
Senior Member |
|
|
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 15:00] Report message to a moderator
|
|
|
|
|
|
Re: IEvaluationService [message #513440 is a reply to message #513328] |
Wed, 10 February 2010 09:06 |
Dennis Melzer Messages: 244 Registered: July 2009 |
Senior Member |
|
|
Paul Webster wrote on Tue, 09 February 2010 13:49 | SirWayne wrote:
>
> @Override
> public void modifyText(ModifyEvent e) {
> // fire Event which triggers the PropertyTester
> // to test the isDeletable again
>
> }
> });
Here is where you want to use
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String)
PW
|
Thank you very much!!!
So it works. Thats very nice =). I thought always i have to register the service. So its very easy =)...
final IEvaluationService evaluationService = (IEvaluationService) getSite()
.getWorkbenchWindow().getWorkbench().getService(
IEvaluationService.class);
evaluationService.requestEvaluation("test.delete");
[Updated on: Wed, 10 February 2010 12:24] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.06013 seconds