use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class ValgrindLaunchConfigurationDelegate method parseLogs.
protected IValgrindMessage[] parseLogs(IPath outputPath) throws IOException, CoreException {
List<IValgrindMessage> messages = new ArrayList<>();
for (File log : outputPath.toFile().listFiles(LOG_FILTER)) {
ValgrindCoreParser parser = new ValgrindCoreParser(log, launch);
IValgrindMessage[] results = parser.getMessages();
if (results.length == 0) {
results = new IValgrindMessage[1];
// $NON-NLS-1$
results[0] = new ValgrindInfo(null, Messages.getString("ValgrindOutputView.No_output"), launch);
}
messages.addAll(Arrays.asList(results));
createMarkers(results);
}
return messages.toArray(new IValgrindMessage[messages.size()]);
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class BasicMemcheckTest method testNumErrors.
@Test
public void testNumErrors() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testNumErrors");
IValgrindMessage[] messages = ValgrindUIPlugin.getDefault().getView().getMessages();
assertEquals(3, messages.length);
// $NON-NLS-1$
checkTestMessages(messages, "testNumErrors");
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class ExpandCollapseTest method testExpand.
@Test
public void testExpand() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDefaults");
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
viewer = view.getMessagesViewer();
contextMenu = viewer.getTreeViewer().getTree().getMenu();
// Select first error and expand it
IValgrindMessage[] messages = (IValgrindMessage[]) viewer.getTreeViewer().getInput();
IValgrindMessage element = messages[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { element }));
viewer.getTreeViewer().setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(0).notifyListeners(SWT.Selection, null);
checkExpanded(element, true);
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class LinkedResourceDoubleClickTest method doDoubleClick.
private void doDoubleClick() {
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
CoreMessagesViewer viewer = view.getMessagesViewer();
// get first leaf
IValgrindMessage[] elements = (IValgrindMessage[]) viewer.getTreeViewer().getInput();
IValgrindMessage element = elements[0];
TreePath path = new TreePath(new Object[] { element });
frame = null;
while (element.getChildren().length > 0) {
element = element.getChildren()[0];
path = path.createChildPath(element);
if (element instanceof ValgrindStackFrame) {
frame = (ValgrindStackFrame) element;
}
}
assertNotNull(frame);
viewer.getTreeViewer().expandToLevel(frame, AbstractTreeViewer.ALL_LEVELS);
TreeSelection selection = new TreeSelection(path);
// do double click
IDoubleClickListener listener = viewer.getDoubleClickListener();
listener.doubleClick(new DoubleClickEvent(viewer.getTreeViewer(), selection));
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class LinkedResourceMarkerTest method findMarker.
private void findMarker(ArrayList<IMarker> markers, IValgrindMessage error) throws Exception, CoreException {
ValgrindStackFrame frame = null;
IValgrindMessage[] children = error.getChildren();
for (int i = 0; i < children.length; i++) {
if (frame == null && children[i] instanceof ValgrindStackFrame && isWorkspaceFrame((ValgrindStackFrame) children[i])) {
frame = (ValgrindStackFrame) children[i];
} else if (children[i] instanceof ValgrindError) {
findMarker(markers, children[i]);
}
}
int ix = -1;
for (int i = 0; i < markers.size(); i++) {
IMarker marker = markers.get(i);
if (marker.getAttribute(IMarker.MESSAGE).equals(error.getText()) && marker.getResource().getName().equals(frame.getFile()) && marker.getAttribute(IMarker.LINE_NUMBER).equals(frame.getLine())) {
ix = i;
}
}
assertFalse(ix < 0);
markers.remove(ix);
}
Aggregations