module Redcar module Textmate # A test for leaks #class RefreshMenuTenTimes < Redcar::Command # def execute # puts "Refreshing menu ten times." # 10.times do # Redcar.app.refresh_menu! # puts "Refreshing the menu!" # end # end #end class ShowSnippetTree < Redcar::Command def execute if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE } win.treebook.focus_tree(tree) else tree = Tree.new(TreeMirror.new(Textmate.all_bundles),TreeController.new) win.treebook.add_tree(tree) end end end class ReloadSnippetTree < Redcar::Command def execute if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE } win.treebook.remove_tree(tree) tree = Tree.new(TreeMirror.new(Textmate.all_bundles),TreeController.new) win.treebook.add_tree(tree) else ShowSnippetTree.new.run end end end class ClearBundleMenu < Redcar::Command def execute Textmate.storage['loaded_bundles'] = [] Textmate.refresh_tree Redcar.app.refresh_menu! end end class RemovePinnedBundle < Redcar::Command def initialize(bundle_name) @bundle_name = bundle_name.downcase end def execute unless not Textmate.storage['loaded_bundles'].include?(@bundle_name) bundles = Textmate.storage['loaded_bundles'] || [] bundles.delete(@bundle_name) Textmate.storage['loaded_bundles'] = bundles Textmate.refresh_tree Redcar.app.refresh_menu! end end end class PinBundleToMenu < Redcar::Command def initialize(bundle_name) @bundle_name = bundle_name.downcase end def execute unless Textmate.storage['loaded_bundles'].include?(@bundle_name) bundles = Textmate.storage['loaded_bundles'] || [] bundles << @bundle_name Textmate.storage['loaded_bundles'] = bundles Textmate.refresh_tree Redcar.app.refresh_menu! end end end end end