Component (JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { final JTextField field = (JTextField)super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row); final Object node = ((DefaultMutableTreeNode)value).getUserObject(); final PackagingElement<?> element = ((PackagingElementNode<?>)node).getElementIfSingle(); LOG.assertTrue(element != null); final String name = ((RenameablePackagingElement)element).getName(); field.setText(name); int i = name.lastIndexOf('.'); field.setSelectionStart(0); field.setSelectionEnd(i != -1 ? i : name.length()); return field; }