Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » PropertyTester
PropertyTester [message #503392] Sat, 12 December 2009 15:38 Go to next message
Sir Wayne is currently offline Sir WayneFriend
Messages: 216
Registered: July 2009
Senior Member
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 15:07 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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] Wed, 16 December 2009 04:39 Go to previous messageGo to next message
Sir Wayne is currently offline Sir WayneFriend
Messages: 216
Registered: July 2009
Senior Member
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 13:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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] Fri, 18 December 2009 04:44 Go to previous messageGo to next message
Sir Wayne is currently offline Sir WayneFriend
Messages: 216
Registered: July 2009
Senior Member
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 19:10 Go to previous messageGo to next message
Sir Wayne is currently offline Sir WayneFriend
Messages: 216
Registered: July 2009
Senior Member
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 19:11]

Report message to a moderator

Re: PropertyTester [message #505922 is a reply to message #505571] Tue, 05 January 2010 14:59 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 Nov 24 00:24:19 GMT 2014

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

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