mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-132467 apply target branch modification with Enter or mouse interruption
* selection listener from WideSelectionTreeUi modified not to stop edit mode when mouse pressed/release, because BaseTreeUi managed this situation himself according to appropriate flags; (if mouse pressed, then BaseUi starts edit mode, and WideUi stops it immediately - this was strange) * validation added in editor listener
This commit is contained in:
@@ -127,7 +127,15 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
|
||||
public void editingStopped(ChangeEvent e) {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)myTree.getLastSelectedPathComponent();
|
||||
if (node != null && node instanceof EditableTreeNode) {
|
||||
((EditableTreeNode)node).fireOnChange();
|
||||
JComponent editedComponent = (JComponent)node.getUserObject();
|
||||
InputVerifier verifier = editedComponent.getInputVerifier();
|
||||
if (verifier != null && !verifier.verify(editedComponent)) {
|
||||
// if invalid and interrupted, then revert
|
||||
((EditableTreeNode)node).fireOnCancel();
|
||||
}
|
||||
else {
|
||||
((EditableTreeNode)node).fireOnChange();
|
||||
}
|
||||
}
|
||||
myTree.firePropertyChange(PushLogTreeUtil.EDIT_MODE_PROP, true, false);
|
||||
}
|
||||
@@ -141,6 +149,8 @@ public class PushLog extends JPanel implements TypeSafeDataProvider {
|
||||
myTree.firePropertyChange(PushLogTreeUtil.EDIT_MODE_PROP, true, false);
|
||||
}
|
||||
});
|
||||
// complete editing when interrupt
|
||||
myTree.setInvokesStopCellEditing(true);
|
||||
myTree.setRootVisible(false);
|
||||
TreeUtil.collapseAll(myTree, 1);
|
||||
final VcsBranchEditorListener linkMouseListener = new VcsBranchEditorListener(myTreeCellRenderer);
|
||||
|
||||
@@ -122,11 +122,6 @@ public class WideSelectionTreeUI extends BasicTreeUI {
|
||||
private void handle(MouseEvent e) {
|
||||
final JTree tree = (JTree)e.getSource();
|
||||
if (SwingUtilities.isLeftMouseButton(e) && !e.isPopupTrigger()) {
|
||||
// if we can't stop any ongoing editing, do nothing
|
||||
if (isEditing(tree) && tree.getInvokesStopCellEditing() && !stopEditing(tree)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TreePath pressedPath = getClosestPathForLocation(tree, e.getX(), e.getY());
|
||||
if (pressedPath != null) {
|
||||
Rectangle bounds = getPathBounds(tree, pressedPath);
|
||||
|
||||
Reference in New Issue
Block a user