Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Rename on Second Click fixes #2412

Closed
wants to merge 6 commits into from
Closed

Rename on Second Click fixes #2412

wants to merge 6 commits into from

Conversation

redmunds
Copy link
Contributor

This prevents rename on right click for #2394. This fix in WorkingSetView.js is simpler than it looks at first glance because I also did a minor logic cleanup.

This implements Rename on second click in project tree for #2411.

@peterflynn I also looked at fixing the behavior of double-click in the working set, but couldn't get it working. Double-clicking in the project tree to open a file and also put it in the working set probably only works because the operation for single-clicking is a subset of it (only opens file). I'm guessing that double-click in project tree only seems to work because what single-click does is a subset of what double-click does. Double-click in either Working Set or Project Tree is now fixed so that it should never invoke Rename as mentioned in #2411.

I noticed that re-order working set files using drag/drop while in Rename mode. Is this OK? I couldn't find any cases that seemed to cause any problems.

Fixed (untracked) issue where Navigate > Show in File Tree so Rename is not invoked. It was a tricky recipe to start with:

  1. Select file in Project Tree
  2. Close parent folder using arrow
  3. Navigate > Show in File Tree

@peterflynn
Copy link
Member

Note: holding off on this until Sprint 19 since the functionality that caused those bugs is being temporarily backed out for Sprint 18 -- see pull #2417. We can use this pull request to re-enable the functionality next sprint, with all the necessary fixes.

@redmunds
Copy link
Contributor Author

redmunds commented Jan 9, 2013

@peterflynn This is ready for re-review. Please read details at the top of issue carefully because there are a lot a subtle cases fixed with this one.

@ghost ghost assigned peterflynn Jan 9, 2013
@peterflynn
Copy link
Member

@redmunds: is double-click in the working set supposed to do anything? It doesn't seem to on master, and I can't find any code that implies otherwise... I think double-click is only a factor for the project tree.

@redmunds
Copy link
Contributor Author

Double-click in the working set is not supposed to do anything. I added the double-click handler just for the sake of detecting a double click and prevent 2 single-click events from occurring (which would be: initiate rename, followed by cancel rename).

_projectTree.jstree("select_node", $node, false);
_suppressRename = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be a lot of other cases where we also programatically invoke select_node. Can we be sure none of them will ever happen when the item is already selected?

It seems safer to not have to rely on that sort of assumption. Is there a way for the select_node event handler above to distinguish user-driven selection from programmatic? (e.g. does it pass along a root-cause click event object or anything?). If not, I wonder if we could instead just have rename be driven by click events rather than select_node...

@peterflynn
Copy link
Member

If I right-click the selected item in the file tree, I'm still seeing it go into rename mode... Doesn't happen for the working set though.

CommandManager.execute(Commands.FILE_RENAME);
}
_inClickCallback = false;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a decent amount of code duplication between here and ProjectManager. If you don't think there's a clean way to centralize it, could we add a few comments so future modifiers of this code know changes should probably be mirrored in the other file? I'd suggest a comment in the timeout handler in each file, and in the place the timeout gets set in each file...

@peterflynn
Copy link
Member

@redmunds: done reviewing.

@redmunds redmunds mentioned this pull request Jan 11, 2013
@peterflynn
Copy link
Member

@redmunds do you think we should close this old pull request since it sounds like someone else in #1976 may work on it now?

@redmunds
Copy link
Contributor Author

@peterflynn I guess there's no reason to leave this open. Closing.

@redmunds redmunds closed this Jan 29, 2013
@peterflynn
Copy link
Member

Sounds good. We can always leave the branch around for a while in case @AVGP or someone else wants to build off of it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants