use of org.eclipse.jface.viewers.TreePath in project linuxtools by eclipse.
the class CModelLabelsTest method checkLabelProvider.
private static void checkLabelProvider(CachegrindFunction func, CachegrindFile file) {
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
TreeViewer viewer = view.getViewer();
TreePath path = new TreePath(new Object[] { view.getOutputs()[0], file, func });
checkLabelProvider(viewer, path, func);
}
use of org.eclipse.jface.viewers.TreePath in project linuxtools by eclipse.
the class DoubleClickTest method testDoubleClickFile.
@Test
public void testDoubleClickFile() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDoubleClickFile");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
CachegrindOutput output = view.getOutputs()[0];
// $NON-NLS-1$
CachegrindFile file = getFileByName(output, "cpptest.cpp");
TreePath path = new TreePath(new Object[] { output, file });
doDoubleClick(path);
checkFile(file);
}
use of org.eclipse.jface.viewers.TreePath in project linuxtools by eclipse.
the class ExpandCollapseTest method testCollapse.
@Test
public void testCollapse() throws Exception {
// Expand the element first
testExpand();
// Then collapse it
CachegrindOutput[] outputs = (CachegrindOutput[]) viewer.getInput();
CachegrindOutput output = outputs[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { output }));
viewer.setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(1).notifyListeners(SWT.Selection, null);
checkExpanded(output, false);
}
use of org.eclipse.jface.viewers.TreePath 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.jface.viewers.TreePath 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));
}
Aggregations