int (Editor editor, int startFrom) { final CharSequence text = editor.getDocument().getCharsSequence(); int idEnd = startFrom; while (idEnd < text.length() && Character.isJavaIdentifierPart(text.charAt(idEnd))) { idEnd++; } return idEnd; }