Skip to content

Commit

Permalink
Add 'Open Project' command to the dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
njx committed May 30, 2012
1 parent 41376c6 commit 07a4e7d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions main.js
Expand Up @@ -34,7 +34,9 @@ define(function (require, exports, module) {
// Brackets modules
var DocumentManager = brackets.getModule("document/DocumentManager"),
ProjectManager = brackets.getModule("project/ProjectManager"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager");
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
Commands = brackets.getModule("command/Commands"),
CommandManager = brackets.getModule("command/CommandManager");

var $dropdownToggle;

Expand Down Expand Up @@ -81,7 +83,8 @@ define(function (require, exports, module) {
$dropdown.remove();
}

var currentProject = ProjectManager.getProjectRoot().fullPath;
var currentProject = ProjectManager.getProjectRoot().fullPath,
hasProject = false;
recentProjects.forEach(function (root) {
if (root !== currentProject) {
var $link = $("<a></a>")
Expand All @@ -96,8 +99,17 @@ define(function (require, exports, module) {
$("<li></li>")
.append($link)
.appendTo($dropdown);
hasProject = true;
}
});
if (hasProject) {
$("<li class='divider'>").appendTo($dropdown);
}
$("<li><a>Open Project...</a></li>")
.click(function () {
CommandManager.execute(Commands.FILE_OPEN_FOLDER);
})
.appendTo($dropdown);

$dropdown.css({
left: toggleOffset.left,
Expand Down

0 comments on commit 07a4e7d

Please sign in to comment.