Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » PropertyTester
PropertyTester [message #503392] Sat, 12 December 2009 10:38 Go to next message
Eclipse UserFriend
Hi,

i have a PropertyTester , which acivates the activPart when it implements a interface and a methode return true. That works fine, if i switch the acitvePart. But now should the tester check and acivate the activePart, if i modify a textfield...
how can i do this?can i fire a event like the PROP_DIRTY???
Re: PropertyTester [message #503736 is a reply to message #503392] Tue, 15 December 2009 10:07 Go to previous messageGo to next message
Eclipse UserFriend
I hope you mean you check the active part and then the method return value ... property testers should check conditions, not preform actions.

If that's what you meant, you can use org.eclipse.ui.services.IEvaluationService.requestEvaluation (String) to request your property is re-evaluated after the method return value changes.

PW
Re: PropertyTester [message #503894 is a reply to message #503392] Tue, 15 December 2009 23:39 Go to previous messageGo to next message
Eclipse UserFriend
Sorry first i check, that the activePart implements a interface and then the methode returns true.
I want a similar behaviour like the save command...
First checks the interface ISaveablePart then the isDirty methode... But how can i fire a event like the PROP_DIRTY???
Is there a introduction/tutorial?

public class PropertyTester extends org.eclipse.core.expressions.PropertyTester{

	@Override
	public boolean test(Object receiver, String property, Object[] args,
			Object expectedValue) {
		return ((IDeleteable)receiver).isDeletable();
	}
}



<extension
         point="org.eclipse.ui.handlers">
      <handler
            class="test.DeleteHandler"
            commandId="Delete">
         <activeWhen>
            <with
                  variable="activePart">
               <test
                     forcePluginActivation="true"
                     property="ProperyTester">
               </test>
            </with>
         </activeWhen>
      </handler>
   </extension>



thx
Re: PropertyTester [message #503991 is a reply to message #503894] Wed, 16 December 2009 08:16 Go to previous messageGo to next message
Eclipse UserFriend
SirWayne wrote:

> <extension
> point="org.eclipse.ui.handlers">
> <handler
> class="test.DeleteHandler"
> commandId="Delete">
> <activeWhen>
> <with
> variable="activePart">
> <test
> forcePluginActivation="true"
> property="ProperyTester">
> </test>
> </with>
> </activeWhen>
> </handler>
> </extension>
>

When you know you are updating the isDeletable() return value you should
use the IEvaluationService to request your property be re-evaluated.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Re: PropertyTester [message #504310 is a reply to message #503991] Thu, 17 December 2009 23:44 Go to previous messageGo to next message
Eclipse UserFriend
Ok thanks =)...

Is there a tutorial or introduction how to use the IEvaluationService ???
Re: PropertyTester [message #505571 is a reply to message #503392] Fri, 01 January 2010 14:10 Go to previous messageGo to next message
Eclipse UserFriend
I have a SourceProvider
1. How can i add this with Extension Point?
	@Override
	public void init(IEditorSite site, IEditorInput input)
			throws PartInitException {
		final IEvaluationService evaluationService = (IEvaluationService) getSite()
		.getWorkbenchWindow().getWorkbench().getService(
		IEvaluationService.class);
		deleteSourceProvider = new DeleteSourceProvider();		evaluationService.addSourceProvider(deleteSourceProvider);

	}

	@Override
	public void dispose() {
		super.dispose();
		final IEvaluationService evaluationService = (IEvaluationService) getSite()
		.getWorkbenchWindow().getWorkbench().getService(
		IEvaluationService.class);
		evaluationService.removeSourceProvider(deleteSourceProvider);
		deleteSourceProvider.dispose();
	}


2. but now it doesn't work my evaluationService for the other editors?? I dont understand it???...

Could you make a example please?

[Updated on: Fri, 01 January 2010 14:11] by Moderator

Re: PropertyTester [message #505922 is a reply to message #505571] Tue, 05 January 2010 09:59 Go to previous message
Eclipse UserFriend
SirWayne wrote:
> I have a SourceProvider
> 1. How can i add this with Extension Point?

Use the org.eclipse.ui.services extension point.

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.exam ples.contributions/plugin.xml?view=co
has an example of contributing a source provider through an EP.

You can check org.eclipse.ui.examples.contributions out of CVS from the
following location:

:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Previous Topic:Keybinding problems when opening a text editor in a control
Next Topic:Problem using activeEditorInput with Commands
Goto Forum:
  


Current Time: Mon May 05 18:06:02 EDT 2025

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

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

Back to the top