public void selectionChanged(SelectionChangedEvent event) {
testDetailsText.setText("");
TreeSelection selection = (TreeSelection) event.getSelection();
currentSelection = selection.getFirstElement();
if (currentSelection instanceof EclipseJstdTestResult) {
EclipseJstdTestResult result = (EclipseJstdTestResult) currentSelection;
StringBuilder details = new StringBuilder();
result.writeDetails(details);
testDetailsText.setText(details.toString());
}
}
});
testResultsTree.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
if (currentSelection instanceof EclipseJstdTestResult) {
EclipseJstdTestResult selected = (EclipseJstdTestResult) currentSelection;
IProject project = null;
try {
String projectName =
lastLaunchConfiguration.getAttribute(LaunchConfigurationConstants.PROJECT_NAME, "");
project = new ProjectHelper().getProject(projectName);
} catch (CoreException e) {
logger.log(Level.WARNING, "Could not read project name from launch configuration.", e);
}
testCaseOpener.openTestSource(project, selected.getResult(), workbenchPage);
return;
}
}
});