Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Need help for SWTBot with Menus, and e4 in general
Need help for SWTBot with Menus, and e4 in general [message #899578] Wed, 01 August 2012 13:48 Go to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Hi,

We want SWTBot to work with Eclipse 4.2. We started a new development
stream, and have noticed that SWTBot is still compatible with Eclipse
4.2 without any change.
However, the "Eclipse Finder" in SWTBot, which is responsible for
manipulating workbech concepts (such as views & so on), has several
incompatibilites with Eclipse 4.2. One of them is about Views menus:
Before, with 3.x, the MenuManager for a view used to contain all the
contributed stuff in the menu. Now, it seems to be filled in a lazy way,
so that we can't query it to find menus for views.
I think there may be a way to use a SWT.MenuDetect event on the menu
widget, but I did not find a way to retrieve this menu widget.
Do you have any suggestion on how to ensure MenuManager gets populated
before querying it?

The general issue is where should SWTBot place itself for the Eclipse
Finder? Now there is the modeled workbench and the renderers, so should
SWTBot simply trigger the modeled workbench? Would it allow so many
useful operations as SWTBot used to provide with 3.x? Or should SWTBot
used the rendered workbench, and then rely on the renderer (which may
change) ? In such case, do you agree that would mean implement 1 Finder
for each renderer ?

Your help is very welcome, here or on the SWTBot mailing list.

Cheers,
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Need help for SWTBot with Menus, and e4 in general [message #899792 is a reply to message #899578] Thu, 02 August 2012 11:29 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

In a general manner, is there a way to trigger rendering for a given
MenuManager programmatically?
Or is there a way to get the rendered Widget or Control for a given UI
elment?

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Need help for SWTBot with Menus, and e4 in general [message #899802 is a reply to message #899792] Thu, 02 August 2012 11:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Well normally the rendering is triggered by setting the
"toBeRendered"-flag to true but I'm not sure about all those menu
contributions.

I guess only Paul knows how this is legazy menu system interop is
working. Did you tried to look at live application model, in fact all
informations have to be in this model.

Tom

Am 02.08.12 13:29, schrieb Mickael Istria:
> In a general manner, is there a way to trigger rendering for a given
> MenuManager programmatically?
> Or is there a way to get the rendered Widget or Control for a given UI
> elment?
>
Re: Need help for SWTBot with Menus, and e4 in general [message #899808 is a reply to message #899802] Thu, 02 August 2012 12:13 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 08/02/2012 01:56 PM, Tom Schindl wrote:
> Well normally the rendering is triggered by setting the
> "toBeRendered"-flag to true but I'm not sure about all those menu
> contributions.

The issue here is that SWTBot relies on MenuManager, and not on the Menu
model. Do you have any clue on how to navigate from one to another?
I think I'll need to access the renderer? Can it be retrieved via a
service, would you have a snippet?

> I guess only Paul knows how this is legazy menu system interop is
> working. Did you tried to look at live application model, in fact all
> informations have to be in this model.

Ok, I'll try that.
Can the e4 service be retrieved as simple OSGi services using
BundleContext? Or is there a more efficient way to get them.
I don't think SWTBot gets loaded in a specific IEclipseContext so I
probably can't use Depdenency Inject, can I?

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Need help for SWTBot with Menus, and e4 in general [message #899812 is a reply to message #899808] Thu, 02 August 2012 12:36 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 08/02/2012 02:13 PM, Mickael Istria wrote:
> Can the e4 service be retrieved as simple OSGi services using
> BundleContext? Or is there a more efficient way to get them.

I could retrieve it through the ViewSite, thanks.
I'm still wondering whether SWTBot should only rely on modeled
application, and mostly work by querying the Model, or whether it should
rely on the Rendered stuff.
Any hint is welcome.

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Need help for SWTBot with Menus, and e4 in general [message #899844 is a reply to message #899812] Thu, 02 August 2012 14:40 Go to previous messageGo to next message
Eclipse UserFriend
Hi Mickael,

MenuManager is created in the MenuManagerRenderer. If you want to go back and forth SWT element - Model element you have to do:

Model-> Element : modelElement.getWidget()
Element -> Model (in case of SWT): swtelement.getData(AbstractPartRenderer.OWNING_ME)

Due to the fact that I'm not familiar with SWTBot, I am not clear what it needs to get things done. If you could be more specific on that I can hint something else.
Re: Need help for SWTBot with Menus, and e4 in general [message #902837 is a reply to message #899844] Mon, 20 August 2012 17:51 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I'll just add that org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showMenuButton(MPart, CTabFolder, MMenu) is the starting point for how we use the view menu MMenu, and do to the strangeness of the 3.x API and which part of the framework owns what, org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(IWorkbenchPart, Composite) shows us hooking up a MenuManager to the view menu MMenu.

PW




Re: Need help for SWTBot with Menus, and e4 in general [message #904903 is a reply to message #902837] Wed, 29 August 2012 10:58 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Paut, Sopot,

Here is a bug to track the kind of issues we met with e4 menu in SWTBot:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388306

I'd appreciate if you could find some time to give a hint. The general
issue seems to be menus not populated correctly. SWTBot menu handling is
all about sending Show and Hide events, we probably need another way to
do it for e4, and add some more events to ensure menus get populated.

On 08/20/2012 07:51 PM, Paul Webster wrote:
> I'll just add that
> org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showMenuButton(MPart,
> CTabFolder, MMenu) is the starting point for how we use the view menu
> MMenu, and do to the strangeness of the 3.x API and which part of the
> framework owns what,
> org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(IWorkbenchPart,
> Composite) shows us hooking up a MenuManager to the view menu MMenu.
>
> PW
>
>
>


--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:E4/GWT integration
Next Topic:Eclipse 4 and Web
Goto Forum:
  


Current Time: Fri Apr 26 03:27:54 GMT 2024

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

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

Back to the top