use of org.eclipse.linuxtools.oprofile.ui.model.UiModelSymbol in project linuxtools by eclipse.
the class OprofileViewDoubleClickListener method doubleClick.
@Override
public void doubleClick(DoubleClickEvent event) {
TreeViewer tv = (TreeViewer) event.getSource();
TreeSelection tsl = (TreeSelection) tv.getSelection();
IUiModelElement element = (IUiModelElement) tsl.getFirstElement();
try {
if (element instanceof UiModelEvent) {
// UiModelEvent event = (UiModelEvent)element;
} else if (element instanceof UiModelSession) {
/* moved into an action menu */
} else if (element instanceof UiModelImage) {
// UiModelImage image = (UiModelImage)element;
} else if (element instanceof UiModelSymbol) {
final UiModelSymbol symbol = (UiModelSymbol) element;
final String fileName = symbol.getFileName();
int line = symbol.getLineNumber();
ProfileUIUtils.openEditorAndSelect(fileName, line);
} else if (element instanceof UiModelSample) {
// jump to line number in the appropriate file
UiModelSample sample = (UiModelSample) element;
int line = sample.getLine();
// get file name from the parent sample
final String fileName = sample.getFile();
ProfileUIUtils.openEditorAndSelect(fileName, line, getProject());
}
} catch (BadLocationException e1) {
e1.printStackTrace();
} catch (PartInitException e2) {
e2.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
}
Aggregations