Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Commands problem
Commands problem [message #533665] Sat, 15 May 2010 07:11 Go to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Hello everybody

Im new in Eclipse RCP programming but im currently learning and have got problem. I would like to know how to do some easy behaviour proper way in Eclipse without any tricks. Imagine i have got view which have got some tree. This view have toolbar buttons lets say A and B. Those buttons operate on tree and change its state. If i press button A it should change tree state and this change of tree state should also change state of B button (deactivate it). I know i can put some command expression 'activeWhen' on comman handler. But how to make it read state from tree object? Should i use some property tester? Anybody could explain me how to use property testers and how commands and handlers behave becouse there is no good explanation of that? I will be gratefull for help.

Tom
Re: Commands problem [message #533904 is a reply to message #533665] Mon, 17 May 2010 12:45 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There are 2 common ways that's done.

1) in createPartControl(*), instantiate your handler against your viewer
and then activate that handler (it has the instance of the viewer that
cares).

2) declare a handler and make it activeWhen your view id is active. In
the execute(*), use HandlerUtil to get the active part, then check and
cast it. ex: ((MyViewPart)part).getTree()

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: Commands problem [message #534108 is a reply to message #533904] Tue, 18 May 2010 05:57 Go to previous message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Thank you for answer and help but ive find out different way. I use sourceProvider extension for represent state of my navigation tree and then i can easy check status using eclipse expressions. This way i use eclipse functionality and dont have to bother about how to implement checking status functionality.

You can check at page: http://www.vogella.de/articles/EclipseCommands/article.html# commmands_sourceprovider
Previous Topic:Propertytester vs Sourceprovider
Next Topic:Radio button in menu
Goto Forum:
  


Current Time: Fri Apr 19 21:14:02 GMT 2024

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

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

Back to the top