Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » problems with viewByTitle in Mars
problems with viewByTitle in Mars [message #1692227] Tue, 14 April 2015 11:52 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1751
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I started to port one of my projects to Mars, where SWTBot is used
extensively (https://www.eclipse.org/emf-parsley/).

The tests that use bot.viewByTitle fail, though the view is actually
visible when the test is run.

By debugging, it looks like the culprit is a change in
org.eclipse.ui.internal.WorkbenchPage.getViewReferences (which is used
in SWTBot by WorkbenchContentsFinder.findViewsInternal).

In Luna, the code of getViewReferences used to be

public IViewReference[] getViewReferences() {
MPerspective perspective = getCurrentPerspective();
if (perspective != null) {
List<MPlaceholder> placeholders = modelService.findElements(window, null,
MPlaceholder.class, null, EModelService.PRESENTATION);
List<IViewReference> visibleReferences = new ArrayList<IViewReference>();
for (ViewReference reference : viewReferences) {
for (MPlaceholder placeholder : placeholders) {
if (reference.getModel() == placeholder.getRef()
&& placeholder.isToBeRendered()) {
// only rendered placeholders are valid view references
visibleReferences.add(reference);
}
}
}
return visibleReferences.toArray(new
IViewReference[visibleReferences.size()]);
}
return new IViewReference[0];
}

In Mars, it became

public IViewReference[] getViewReferences() {
return getViewReferences(false);
}

private IViewReference[] getViewReferences(boolean allPerspectives) {
MPerspective perspective = getCurrentPerspective();
if (perspective != null) {
int scope = allPerspectives ? WINDOW_SCOPE : EModelService.PRESENTATION;
List<MPlaceholder> placeholders = modelService.findElements(window, null,
MPlaceholder.class, null, scope);
List<IViewReference> visibleReferences = new ArrayList<IViewReference>();
for (ViewReference reference : viewReferences) {
for (MPlaceholder placeholder : placeholders) {
if (reference.getModel() == placeholder.getRef()
&& placeholder.isToBeRendered()) {
// only rendered placeholders are valid view references
visibleReferences.add(reference);
}
}
}
return visibleReferences.toArray(new
IViewReference[visibleReferences.size()]);
}
return new IViewReference[0];
}

and my views are not found anymore (again, my view is visible in the
current perspective)...

has anyone else experienced such problems when switching to Mars?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: problems with viewByTitle in Mars [message #1692563 is a reply to message #1692227] Thu, 16 April 2015 13:50 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Hi Lorenzo.

That code looks like it should perform identically. What version of Mars were you using? There was a bug in the bug fix for bug 457939, committed on March 25 and fixed on April 10, that might account for this changed behaviour.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: problems with viewByTitle in Mars [message #1692887 is a reply to message #1692563] Mon, 20 April 2015 12:50 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1751
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 16/04/2015 15:50, Brian de Alwis wrote:
> Hi Lorenzo.
>
> That code looks like it should perform identically. What version of

Hi

Yes, I've just realized that the semantics should be the same...

> Mars were you using? There was a bug in the bug fix for bug 457939,
> committed on March 25 and fixed on April 10, that might account for this
> changed behaviour.

I'm using the current milestone 6:
http://download.eclipse.org/eclipse/downloads/drops4/S-4.5M6-201503200800/
so I guess that fix is not included... I'll try to see if with the
integration build it works; however that bug seems to have been re-opened.

thanks for the information
cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: problems with viewByTitle in Mars [message #1693023 is a reply to message #1692887] Tue, 21 April 2015 09:41 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1751
Registered: July 2009
Location: Firenze, Italy
Senior Member
I've just tried with
http://download.eclipse.org/eclipse/downloads/drops4/N20150420-2000/ and
the problem is still there...

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: problems with viewByTitle in Mars [message #1693033 is a reply to message #1693023] Tue, 21 April 2015 11:18 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1751
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 21/04/2015 11:41, Lorenzo Bettini wrote:
> I've just tried with
> http://download.eclipse.org/eclipse/downloads/drops4/N20150420-2000/ and
> the problem is still there...
>

I filed a bug against Platform UI:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=465097

In particular an example of failing test in SWTBot's own test suite is

org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewTest.openView()

Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Previous Topic:Assert the text inside the MessageDialog
Next Topic:Using SWTBot with an existing RCP application
Goto Forum:
  


Current Time: Sat Sep 22 13:33:36 GMT 2018

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

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

Back to the top