if (isEditing(tree) && tree.getInvokesStopCellEditing()
&& ! stopEditing(tree))
return false;
completeEditing();
TreeCellEditor ed = cellEditor;
if (ed != null && tree.isPathEditable(path))
{
if (ed.isCellEditable(event))
{
editingRow = getRowForPath(tree, path);
Object value = path.getLastPathComponent();
boolean isSelected = tree.isPathSelected(path);
boolean isExpanded = tree.isExpanded(editingPath);
boolean isLeaf = treeModel.isLeaf(value);
editingComponent = ed.getTreeCellEditorComponent(tree, value,
isSelected,
isExpanded,
isLeaf,
editingRow);
Rectangle bounds = getPathBounds(tree, path);
Dimension size = editingComponent.getPreferredSize();
int rowHeight = getRowHeight();
if (size.height != bounds.height && rowHeight > 0)
size.height = rowHeight;
if (size.width != bounds.width || size.height != bounds.height)
{
editorHasDifferentSize = true;
treeState.invalidatePathBounds(path);
updateSize();
}
else
editorHasDifferentSize = false;
// The editing component must be added to its container. We add the
// container, not the editing component itself.
tree.add(editingComponent);
editingComponent.setBounds(bounds.x, bounds.y, size.width,
size.height);
editingComponent.validate();
editingPath = path;
if (ed.shouldSelectCell(event))
{
stopEditingInCompleteEditing = false;
tree.setSelectionRow(editingRow);
stopEditingInCompleteEditing = true;
}