private synchronized Action getEditorAction() { if (editorAction == null) { BaseKit kit = Utilities.getKit(getComponent()); if (kit != null) { editorAction = kit.getActionByName(editorActionName); } } return editorAction; }
/** * Perform the goto operation. * * @return whether the dialog should be made invisible or not */ protected boolean performGoto() { JTextComponent c = EditorRegistry.lastFocusedComponent(); if (c != null) { try { int line = Integer.parseInt(getGotoValueText()); // issue 188976 if (line == 0) line = 1; // end of issue 188976 BaseDocument doc = Utilities.getDocument(c); if (doc != null) { int rowCount = Utilities.getRowCount(doc); if (line > rowCount) line = rowCount; // Obtain the offset where to jump int pos = Utilities.getRowStartFromLineOffset(doc, line - 1); BaseKit kit = Utilities.getKit(c); if (kit != null) { Action a = kit.getActionByName(ExtKit.gotoAction); if (a instanceof ExtKit.GotoAction) { pos = ((ExtKit.GotoAction) a).getOffsetFromLine(doc, line - 1); } } if (pos != -1) { Caret caret = c.getCaret(); caret.setDot(pos); } else { c.getToolkit().beep(); return false; } } } catch (NumberFormatException e) { c.getToolkit().beep(); return false; } } return true; }