Class: Redcar::Textmate::CreateNewSnippetGroup

Inherits:
Command show all
Defined in:
plugins/textmate/lib/textmate/commands.rb

Constant Summary

Constants included from Observable

Observable::ASPECTS

Instance Attribute Summary

Attributes inherited from Command

#error

Instance Method Summary (collapse)

Methods inherited from Command

active_changed, #environment, inherited, #inspect, norecord, record?, #run

Methods included from Sensitive

#active?, #sensitivities, #sensitivity_names, #sensitize

Methods included from Observable

#add_listener, #notify_listeners, #remove_listener

Constructor Details

- (CreateNewSnippetGroup) initialize(tree, node)

A new instance of CreateNewSnippetGroup



79
80
81
# File 'plugins/textmate/lib/textmate/commands.rb', line 79

def initialize tree,node
  @tree, @node = tree, node
end

Instance Method Details

- (Object) execute



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'plugins/textmate/lib/textmate/commands.rb', line 83

def execute
  target_uuid = @node.is_a?(BundleNode) ? nil : @node.uuid
  group_uuid  = BundleEditor.create_submenu "New Menu", @node.bundle, target_uuid
  bundle_node = @tree.tree_mirror.bundle_node_by_name(@node.bundle.name)
  if new_group = bundle_node.child_by_uuid(group_uuid)
    @node = bundle_node.child_by_uuid target_uuid
    @tree.expand(@node)
    @tree.edit(new_group)
    @node = bundle_node.child_by_uuid target_uuid
    @tree.expand(@node)
    @tree.select(new_group)
  end
end