Skip to content

Commit

Permalink
Fix context menus with 1.0.7 and add right click set as active for fl…
Browse files Browse the repository at this point in the history
…ow files
  • Loading branch information
ruby0x1 committed Aug 15, 2015
1 parent adb2096 commit b85734f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
## 0.3.0 - Dev
## 0.4.2

* Fix bug in context menus on Atom 1.0.7
* Add right click to flow files for set target as

## 0.4.1

* fix bug in status and target display (thanks @jeremyfa)

## 0.4.0

* cleaned up logging

## 0.3.2

* add clearer notes for dependencies

## 0.3.1

* add requirements notes to readme

## 0.3.0

* make menus useful
* status window show lack of flow file
* add clear project menu command
* clean up consumer set logic
* provide build selectors
* status warning shows as notification
* add build selectors to config
* various internal implementation details completed

## 0.2.1

* update readme

## 0.2.0

Expand Down
28 changes: 28 additions & 0 deletions lib/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ module.exports = {
this.set_flow_file(state.project_path, dont_set_consumer);
}

//{ label: 'Set as active HXML file', command: 'haxe:set-hxml-file'}
atom.contextMenu.add({
"atom-text-editor" : [
{ type: 'separator' },
{ label: 'Set as active flow file', command: 'flow:set-flow-file', shouldDisplay:this.display_context.bind(this) },
{ type: 'separator' }
],
".tree-view .file": [
{ type: 'separator' },
{ label: 'Set as active flow file', command: 'flow:set-flow-file', shouldDisplay:this.display_context_tree.bind(this) },
{ type: 'separator' }
]
});

},

deactivate:function() {
Expand Down Expand Up @@ -189,6 +203,20 @@ module.exports = {

}, //set_flow_file_from_treeview

//Menu handling

display_context: function(event) {
var editor = atom.workspace.getActiveTextEditor();
var scope = editor.getRootScopeDescriptor();
return (scope.scopes.indexOf('source.flow') != -1);
},

display_context_tree: function(event) {
var key = '.flow';
var val = event.target.innerText || '';
return val.indexOf(key, val.length - key.length) !== -1;
},

//Internal conveniences

_init_internal:function() {
Expand Down
5 changes: 0 additions & 5 deletions menus/atom-flow.cson
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

'context-menu':
'[data-path$=flow]': [
{ label: 'Set as active flow file', command: 'flow:set-flow-file'},
{ type: 'separator' },
]
'menu': [
{
'label': 'Packages'
Expand Down

0 comments on commit b85734f

Please sign in to comment.