void (final String name) { myChangingNameFromCode = true; try { try { if (!myNameDocument.getText(0, myNameDocument.getLength()).equals(name)) { myNameDocument.replace(0, myNameDocument.getLength(), name, null); } } catch (BadLocationException e) { LOG.error(e); } } finally { myChangingNameFromCode = false; } }