Search in sources :

Example 6 with EditorPosition

use of org.absmodels.abs.plugin.util.UtilityFunctions.EditorPosition in project abstools by abstools.

the class TypeHierarchyView method doubleClick.

@Override
public void doubleClick(DoubleClickEvent event) {
    // when an element is doubleclicked, jump to its declaration
    ISelection selected = treeViewer.getSelection();
    if (selected instanceof TreeSelection) {
        TreeSelection treeSelection = (TreeSelection) selected;
        Object elem = treeSelection.getFirstElement();
        if (elem instanceof ASTNode<?>) {
            ASTNode<?> node = (ASTNode<?>) elem;
            EditorPosition pos = AbsHyperlinkDetector.getPosition(node);
            UtilityFunctions.jumpToPosition(project, pos);
        }
    }
}
Also used : EditorPosition(org.absmodels.abs.plugin.util.UtilityFunctions.EditorPosition) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ISelection(org.eclipse.jface.viewers.ISelection) InternalASTNode(org.absmodels.abs.plugin.util.InternalASTNode) ASTNode(abs.frontend.ast.ASTNode)

Aggregations

EditorPosition (org.absmodels.abs.plugin.util.UtilityFunctions.EditorPosition)6 CompilationUnit (abs.frontend.ast.CompilationUnit)2 ModuleDecl (abs.frontend.ast.ModuleDecl)2 BadLocationException (org.eclipse.jface.text.BadLocationException)2 IDocument (org.eclipse.jface.text.IDocument)2 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)1 ASTNode (abs.frontend.ast.ASTNode)1 MainBlock (abs.frontend.ast.MainBlock)1 ParserError (abs.frontend.parser.ParserError)1 List (java.util.List)1 InternalASTNode (org.absmodels.abs.plugin.util.InternalASTNode)1 ITextSelection (org.eclipse.jface.text.ITextSelection)1 IHyperlink (org.eclipse.jface.text.hyperlink.IHyperlink)1 ISelection (org.eclipse.jface.viewers.ISelection)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1