Search in sources :

Example 1 with IFunction

use of org.eclipse.cdt.core.model.IFunction 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 2 with IFunction

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

the class CModelLabelsTest method testFunctionLabel.

@Test
public void testFunctionLabel() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testFunctionLabel");
    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, "main");
    assertTrue(func.getModel() instanceof IFunction);
    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) IFunction(org.eclipse.cdt.core.model.IFunction) Test(org.junit.Test)

Aggregations

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