Home » Eclipse Projects » SWTBot » problems with viewByTitle in Mars
problems with viewByTitle in Mars [message #1692227] |
Tue, 14 April 2015 11:52  |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: problems with viewByTitle in Mars [message #1692563 is a reply to message #1692227] |
Thu, 16 April 2015 13:50   |
Eclipse User |
|
|
|
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.
|
|
| | | |
Goto Forum:
Current Time: Tue May 30 08:39:20 GMT 2023
Powered by FUDForum. Page generated in 0.01981 seconds
|