public boolean gotoDeclaration(JTextComponent target) { try { Caret caret = target.getCaret(); int dotPos = caret.getDot(); BaseDocument doc = (BaseDocument) target.getDocument(); int[] idBlk = Utilities.getIdentifierBlock(doc, dotPos); ExtSyntaxSupport extSup = (ExtSyntaxSupport) doc.getSyntaxSupport(); if (idBlk != null) { int decPos = extSup.findDeclarationPosition(doc.getText(idBlk), idBlk[1]); if (decPos >= 0) { caret.setDot(decPos); return true; } } } catch (BadLocationException e) { } return false; }
public boolean gotoDeclaration(JTextComponent target) { try { Caret caret = target.getCaret(); int dotPos = caret.getDot(); BaseDocument doc = (BaseDocument)target.getDocument(); int[] idBlk = Utilities.getIdentifierBlock(doc, dotPos); ExtSyntaxSupport extSup = (ExtSyntaxSupport)doc.getSyntaxSupport(); if (idBlk != null) { int decPos = extSup.findDeclarationPosition(doc.getText(idBlk), idBlk[1]); if (decPos >= 0) { caret.setDot(decPos); return true; } } } catch (BadLocationException e) { } return false; }