Search in sources :

Example 1 with UiModelSample

use of org.eclipse.linuxtools.oprofile.ui.model.UiModelSample 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();
    }
}
Also used : UiModelSample(org.eclipse.linuxtools.oprofile.ui.model.UiModelSample) UiModelEvent(org.eclipse.linuxtools.oprofile.ui.model.UiModelEvent) IUiModelElement(org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement) TreeViewer(org.eclipse.jface.viewers.TreeViewer) UiModelSession(org.eclipse.linuxtools.oprofile.ui.model.UiModelSession) CoreException(org.eclipse.core.runtime.CoreException) TreeSelection(org.eclipse.jface.viewers.TreeSelection) PartInitException(org.eclipse.ui.PartInitException) UiModelImage(org.eclipse.linuxtools.oprofile.ui.model.UiModelImage) UiModelSymbol(org.eclipse.linuxtools.oprofile.ui.model.UiModelSymbol) BadLocationException(org.eclipse.jface.text.BadLocationException)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 IUiModelElement (org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement)1 UiModelEvent (org.eclipse.linuxtools.oprofile.ui.model.UiModelEvent)1 UiModelImage (org.eclipse.linuxtools.oprofile.ui.model.UiModelImage)1 UiModelSample (org.eclipse.linuxtools.oprofile.ui.model.UiModelSample)1 UiModelSession (org.eclipse.linuxtools.oprofile.ui.model.UiModelSession)1 UiModelSymbol (org.eclipse.linuxtools.oprofile.ui.model.UiModelSymbol)1 PartInitException (org.eclipse.ui.PartInitException)1