Search in sources :

Example 11 with ValgrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart in project linuxtools by eclipse.

the class LinkedResourceMarkerTest method testLinkedMarkers.

@Test
public void testLinkedMarkers() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testLinkedMarkers");
    ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
    IValgrindMessage[] errors = view.getMessages();
    ArrayList<IMarker> markers = new ArrayList<>(Arrays.asList(proj.getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, true, IResource.DEPTH_INFINITE)));
    assertEquals(5, markers.size());
    for (IValgrindMessage error : errors) {
        findMarker(markers, error);
    }
    assertEquals(0, markers.size());
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ValgrindViewPart(org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart) IValgrindMessage(org.eclipse.linuxtools.valgrind.core.IValgrindMessage) ArrayList(java.util.ArrayList) IMarker(org.eclipse.core.resources.IMarker) Test(org.junit.Test)

Example 12 with ValgrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart in project linuxtools by eclipse.

the class MarkerTest method testMarkers.

@Test
public void testMarkers() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testDefaults");
    ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
    IValgrindMessage[] errors = view.getMessages();
    ArrayList<IMarker> markers = new ArrayList<>(Arrays.asList(proj.getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, true, IResource.DEPTH_INFINITE)));
    assertEquals(5, markers.size());
    for (IValgrindMessage error : errors) {
        findMarker(markers, error);
    }
    assertEquals(0, markers.size());
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ValgrindViewPart(org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart) IValgrindMessage(org.eclipse.linuxtools.valgrind.core.IValgrindMessage) ArrayList(java.util.ArrayList) IMarker(org.eclipse.core.resources.IMarker) Test(org.junit.Test)

Example 13 with ValgrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart in project linuxtools by eclipse.

the class WrongDeallocationResolution method removeMessage.

/**
 * Removes message from Valgrind view.
 * @param message The message to be removed
 */
private void removeMessage(IValgrindMessage message) {
    ValgrindViewPart valgrindView = ValgrindUIPlugin.getDefault().getView();
    valgrindView.getMessagesViewer().getTreeViewer().remove(message);
}
Also used : ValgrindViewPart(org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart)

Example 14 with ValgrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart in project linuxtools by eclipse.

the class WrongDeallocationResolution method getMessagesByText.

/**
 * Returns all of the messages from the currently active Valgrind view that
 * contains a given {@link String} in their description.
 * @param text the {@link String} to match the Valgrind messages' descriptions
 * @return All messages containing the given text.
 */
private IValgrindMessage[] getMessagesByText(String text) {
    ValgrindViewPart valgrindView = ValgrindUIPlugin.getDefault().getView();
    ArrayList<IValgrindMessage> foundMessages = new ArrayList<>();
    if (valgrindView != null) {
        IValgrindMessage[] messages = valgrindView.getMessages();
        if (messages != null && messages.length != 0) {
            for (IValgrindMessage message : messages) {
                if (message.getText().contains(text)) {
                    foundMessages.add(message);
                }
            }
        }
    }
    IValgrindMessage[] foundMessagesArray = new IValgrindMessage[foundMessages.size()];
    foundMessages.toArray(foundMessagesArray);
    return foundMessagesArray;
}
Also used : ValgrindViewPart(org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart) IValgrindMessage(org.eclipse.linuxtools.valgrind.core.IValgrindMessage) ArrayList(java.util.ArrayList)

Aggregations

ValgrindViewPart (org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart)14 IValgrindMessage (org.eclipse.linuxtools.valgrind.core.IValgrindMessage)10 Test (org.junit.Test)7 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)5 ArrayList (java.util.ArrayList)4 TreePath (org.eclipse.jface.viewers.TreePath)3 TreeSelection (org.eclipse.jface.viewers.TreeSelection)3 IOException (java.io.IOException)2 IMarker (org.eclipse.core.resources.IMarker)2 IProject (org.eclipse.core.resources.IProject)2 CoreException (org.eclipse.core.runtime.CoreException)2 IPath (org.eclipse.core.runtime.IPath)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 SubMonitor (org.eclipse.core.runtime.SubMonitor)2 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 IToolBarManager (org.eclipse.jface.action.IToolBarManager)2 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)2 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)2