Search in sources :

Example 1 with IMethod

use of org.eclipse.cdt.core.model.IMethod in project linuxtools by eclipse.

the class CModelLabelsTest method testNestedMethodLabel.

@Test
public void testNestedMethodLabel() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNestedMethodLabel");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    CachegrindOutput output = view.getOutputs()[0];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    // $NON-NLS-1$
    CachegrindFunction func = getFunctionByName(file, "A::B::e()");
    assertTrue(func.getModel() instanceof IMethod);
    checkLabelProvider(func, file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) IMethod(org.eclipse.cdt.core.model.IMethod) Test(org.junit.Test)

Example 2 with IMethod

use of org.eclipse.cdt.core.model.IMethod in project linuxtools by eclipse.

the class CachegrindFunction method findElement.

private ICElement findElement(String name, IParent parent) throws CModelException {
    ICElement element = null;
    List<ICElement> dom = parent.getChildrenOfType(ICElement.C_FUNCTION);
    dom.addAll(parent.getChildrenOfType(ICElement.C_METHOD));
    for (int i = 0; i < dom.size(); i++) {
        ICElement func = dom.get(i);
        if ((func instanceof IFunction || func instanceof IMethod) && func.getElementName().equals(name)) {
            element = func;
        }
    }
    return element;
}
Also used : IMethod(org.eclipse.cdt.core.model.IMethod) ICElement(org.eclipse.cdt.core.model.ICElement) IFunction(org.eclipse.cdt.core.model.IFunction)

Example 3 with IMethod

use of org.eclipse.cdt.core.model.IMethod in project linuxtools by eclipse.

the class CModelLabelsTest method testMethodLabel.

@Test
public void testMethodLabel() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testMethodLabel");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    CachegrindOutput output = view.getOutputs()[0];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    // $NON-NLS-1$
    CachegrindFunction func = getFunctionByName(file, "A::A()");
    assertTrue(func.getModel() instanceof IMethod);
    checkLabelProvider(func, file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) IMethod(org.eclipse.cdt.core.model.IMethod) Test(org.junit.Test)

Aggregations

IMethod (org.eclipse.cdt.core.model.IMethod)3 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)2 CachegrindFile (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile)2 CachegrindFunction (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction)2 CachegrindOutput (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput)2 Test (org.junit.Test)2 ICElement (org.eclipse.cdt.core.model.ICElement)1 IFunction (org.eclipse.cdt.core.model.IFunction)1