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

Added projectRefresh event when project tree is refreshed but project root has not changed. #4815

Merged
merged 2 commits into from
Sep 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* - beforeProjectClose -- before _projectRoot changes
* - beforeAppClose -- before Brackets quits entirely
* - projectOpen -- after _projectRoot changes
* - projectRefresh -- after project tree is rebuilt, when projectOpen is not--
* dispatched because _projectRoot has not changed
* - projectFilesChange -- sent if one of the project files has changed--
* added, removed, renamed, etc.
*
Expand Down Expand Up @@ -920,6 +922,7 @@ define(function (require, exports, module) {
$(exports).triggerHandler({ type: "projectOpen", promises: promises }, [_projectRoot]);
$.when.apply($, promises).then(result.resolve, result.reject);
} else {
$(exports).triggerHandler("projectRefresh", _projectRoot);
Copy link

Choose a reason for hiding this comment

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

I wonder if it would make sense to trigger this in the projectOpen case as well (i.e., move it out of the if), so someone who just wants to know when the tree has been updated wouldn't have to listen to both projectOpen and projectRefresh.

Copy link

Choose a reason for hiding this comment

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

Also, could you add documentation for this to the comment at the top of the file where we list other events dispatched by ProjectManager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have multiple actions assigned to projectOpen and they are not all the same as projectRefresh so putting it out of the if would make some things run when they are actually not required. I'd prefer to keep these events separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the other side, projectRefresh is (in my case) a subset of projectOpen so putting it out of the if would be fine, in a case that projectRefresh handlers will be always launched after projectOpen handlers.

Copy link

Choose a reason for hiding this comment

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

Yeah, I guess I can see it either way. Logically, "refresh" is different from "open", so it makes sense to keep them separate.

result.resolve();
}
});
Expand Down