problems with viewByTitle in Mars [message #1692227] |
Tue, 14 April 2015 07:52  |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03896 seconds