Skip to content

Commit

Permalink
v0.4.4 - updated context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbard committed Sep 12, 2014
1 parent cae6df4 commit 9f96bd2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Documents Toolbar",
"description": "Adds toolbar with tabs of open documents on the top of the editor. Now with drag and drop!",
"homepage": "https://github.com/dnbard/brackets-documents-toolbar",
"version": "0.4.3",
"version": "0.4.4",
"author": "Alex Bardanov <[email protected]>",
"license": "MIT",
"engines": {
Expand Down
43 changes: 36 additions & 7 deletions services/contextMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var CommandMenus = require('command/Menus'),
CommandManager = require('command/CommandManager'),
ProjectManager = require('project/ProjectManager');
ProjectManager = require('project/ProjectManager'),
AppInit = require('utils/AppInit');

define(function(require, exports, module){
var instance = new ContextMenuService(),
Expand Down Expand Up @@ -36,6 +37,11 @@ define(function(require, exports, module){
return self.context._name.indexOf(query) >= 0;
}

this.addNewRuleCommand = CommandManager.register('!', 'dte_addRule', function(){
var viewModel = ModalService.showHandler();
viewModel.getOrCreateRule(self.context._name);
});

this.clearRuleCommand = CommandManager.register('Clear custom colors', 'dte_clearRule', function(){
var colorRules = storage.getKey(storageRulesKey) || {};

Expand All @@ -45,13 +51,36 @@ define(function(require, exports, module){
$(DocumentManager).trigger('workingSetSort');
});

this.addNewRuleCommand = CommandManager.register('!', 'dte_addRule', function(){
var viewModel = ModalService.showHandler();
viewModel.getOrCreateRule(self.context._name);
});
AppInit.appReady(function(){
setTimeout(function(){
self.menu.addMenuItem(CommandManager.get('file.saveAs'));
self.menu.addMenuItem(CommandManager.get('file.save'));
self.menu.addMenuItem(CommandManager.get('file.rename'));
self.menu.addMenuItem(CommandManager.get('navigate.showInFileTree'));
self.menu.addMenuItem(CommandManager.get('navigate.showInOS'));
self.menu.addMenuDivider();
self.menu.addMenuItem(CommandManager.get('cmd.findInSubtree'));
self.menu.addMenuItem(CommandManager.get('cmd.replaceInSubtree'));
self.menu.addMenuDivider();
self.menu.addMenuItem(CommandManager.get('file.close'));
self.menu.addMenuItem(CommandManager.get('file.close_above'));
self.menu.addMenuItem(CommandManager.get('file.close_others'));
self.menu.addMenuItem(CommandManager.get('file.close_below'));
self.menu.addMenuDivider();

if (CommandManager.get('git.addToIgnore')){
self.menu.addMenuItem(CommandManager.get('git.addToIgnore'));
}

this.menu.addMenuItem(this.addNewRuleCommand);
this.menu.addMenuItem(this.clearRuleCommand);
if (CommandManager.get('git.removeFromIgnore')){
self.menu.addMenuItem(CommandManager.get('git.removeFromIgnore'));
self.menu.addMenuDivider();
}

self.menu.addMenuItem(self.addNewRuleCommand);
self.menu.addMenuItem(self.clearRuleCommand);
}, 100);
});

}

Expand Down
2 changes: 2 additions & 0 deletions viewmodels/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ define(function(require, exports, module){

this.showContextMenu = ko.observable(false);
this.onDocumentContextMenu = function(context, event){
self.onDocumentClick(context, event);

contextMenu.open(context, event);
}

Expand Down

0 comments on commit 9f96bd2

Please sign in to comment.