Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Widget <-> View (ID)(How can I get the View ID given a Widget reference?)
Widget <-> View (ID) [message #648303] Wed, 12 January 2011 10:37 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 3
Registered: January 2011
Junior Member
For various resons, a method that receives a Widget object needs to find out if this widget belongs to a view, and if so, what ID it has.

I found no really good solution to get this info. I tried using the debugger to see if it was stored in any widget data field or similar, but I haven't been able to find anything. Anyone?
Re: Widget <-> View (ID) [message #648412 is a reply to message #648303] Wed, 12 January 2011 19:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 01/12/2011 05:37 AM, PigsAngel wrote:
> For various resons, a method that receives a Widget object needs to find
> out if this widget belongs to a view, and if so, what ID it has.

That information is not available in the general case. i.e. it's not
stored anywhere.

If you write your own views, you can store the appropriate information.

What exactly are you trying to do? And by that I mean what behaviour is
your user expecting to see?

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
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: Widget <-> View (ID) [message #648499 is a reply to message #648412] Thu, 13 January 2011 09:21 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 3
Registered: January 2011
Junior Member
Thanks, I suspected that was the answer.

This information would be useful for simplifying the writing of GUI test cases, but I presume we have to find other ways to solve this.
Re: Widget <-> View (ID) [message #648549 is a reply to message #648499] Thu, 13 January 2011 13:26 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 01/13/2011 04:21 AM, PigsAngel wrote:
> Thanks, I suspected that was the answer.
>
> This information would be useful for simplifying the writing of GUI test
> cases, but I presume we have to find other ways to solve this.

If you know before hand, you can set IDs on your widgets and use them in
your UI test cases.

i.e. in your viewpart, you create buttons and use
button.setData("test.id", "button1")

Then when walking your view, you can find "button1" for your tests and
when button 1 is clicked you can check that ID in your tests, etc.

Depending on the size of your app, you might only want to set the data
when in test mode.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
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:Focus problem with ViewPart and Editor
Next Topic:Update of RCP-3.5 based application with old update-site failes
Goto Forum:
  


Current Time: Thu Apr 25 10:42:13 GMT 2024

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

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

Back to the top