void () { if (myIsNamePathSyncEnabled && !isPathChangedByUser()) { try { myIsPathNameSyncEnabled = false; String name = getText(0, getLength()); String path = myTfPath.getText().trim(); int lastSeparatorIndex = path.lastIndexOf(File.separator); if (lastSeparatorIndex >= 0) { setPath(path.substring(0, lastSeparatorIndex + 1) + name); } else if (!path.isEmpty()) { setPath(path + File.separatorChar + name); } } catch (BadLocationException e) { LOG.error(e); } finally { myIsPathNameSyncEnabled = true; } } }