|
Re: Accessing the Problems View [message #814445 is a reply to message #813723] |
Tue, 06 March 2012 13:10 |
Benjamin Ratiarisolo Messages: 16 Registered: January 2010 Location: Paris, France |
Junior Member |
|
|
Hi Roy,
You could try something like that:
String viewName = "Problems";
// This will work fine if the view is already opened in your workbench layout.
// Otherwise, you will have to "simulate" clicking on the "Window -> Show View -> Problem" workbench menu so that the view is indeed displayed in the workbench.
SWTBotView view = getWorkbench().getBot().viewByTitle(viewName);
view.show();
view.bot().tree();
String category = "Errors";
int nbOfErrors = 0;
for (SWTBotTreeItem item : tree.getAllItems()) {
String text = item.getText();
if (text != null && text.startsWith(category)) {
item.expand();
nbOfErrors = item.getNodes().size();
break;
}
}
Note that the view name itself and the markers categories are actually defined in the plugin.properties file located at the root of the org.eclipse.ui.ide plug-in. In case you want to have your tests run under multiple locales, you should retrieve their actual values from this file instead of hard-coding them.
Hope this helps,
--
benjamin
--
Benjamin Ratiarisolo
IBM ODM Decision Server Rules - Software Developer
IBM Software - France Lab
[Updated on: Tue, 06 March 2012 13:10] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02384 seconds