"Show in Tree" command #1823

Merged
merged 2 commits into from Oct 12, 2012

Projects

None yet

3 participants

@peterflynn
Adobe Systems Incorporated member
  • General purpose ProjectManager.showInTree() API (any file/folder)
  • "Show in Tree" command (current file)
  • Utility for searching arrays (new CollectionUtils module): used in new code plus to clean up an older DocumentManager method
@peterflynn peterflynn "Show in Tree" command:
- General purpose showInTree() API (any file/folder)
- "Show in Tree" command (current file)
- Utility for searching arrays (new CollectionUtils module): used in new
  code plus cleans up a DocumentManager method
0e701a1
@redmunds redmunds was assigned Oct 12, 2012
@redmunds redmunds commented on an outdated diff Oct 12, 2012
src/nls/root/strings.js
@@ -195,6 +195,7 @@ define({
"CMD_QUICK_EDIT_NEXT_MATCH" : "Next Match",
"CMD_NEXT_DOC" : "Next Document",
"CMD_PREV_DOC" : "Previous Document",
+ "CMD_SHOW_IN_TREE" : "Show in Tree",
@redmunds
redmunds Oct 12, 2012

This seems a little generic. Maybe "Show in Project Tree" or "Show in Project Panel"?

@redmunds redmunds commented on an outdated diff Oct 12, 2012
src/project/ProjectManager.js
@@ -765,7 +766,75 @@ define(function (require, exports, module) {
return result.promise();
}
-
+
+
+ /**
+ * Returns the tree node corresponding to the given file/folder. Returns null if the path lies
+ * outside the project, or if it doesn't exist.
+ *
+ * @param {!Entry} entry FileEntry of DirectoryEntry to show
+ * @return {$.Promise} Resolved with jQ obj for the jsTree tree node; or rejected if not found
+ */
+ function _findTreeNode(entry) {
+ var projRelativePath = makeProjectRelativeIfPossible(entry.fullPath);
+ var treeAPI = $.jstree._reference(_projectTree);
+ var result = new $.Deferred();
@redmunds
redmunds Oct 12, 2012

There's no need to get treeAPI or to create a Deferred object until after you have verified that the file is within the project.

@redmunds

Nice work! Done with initial review.

@peterflynn peterflynn - Make 'show in tree' label / command name less generic
- Fix bug in _findTreeNode(): return rejected Promise instead of null when
  path lies outside project tree
1a33aa5
@peterflynn
Adobe Systems Incorporated member

Fixes pushed.

NJ suggested "Show in File Tree," so I went with that and renamed the command accordingly since that was named equally generically.

I also realized that the "file not within project" case should also be returning the Promise, so I fixed that and only moved treeAPI lower down.

@redmunds

Looks good. Merging.

@redmunds redmunds merged commit b1d87a6 into master Oct 12, 2012
@ychaikin

"Show in File Tree" seems to be a something you have to go to over and over. Is there a way to make it a toggle, so it's always on if you want that way. Currently, the highlighting switching to the "Working Files", so it's no longer "in File Tree". To get it back there, you have to manually go to Navigate->Show in File Tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment