Skip to content

Commit

Permalink
Focus Runnables tree if it is already open.
Browse files Browse the repository at this point in the history
  • Loading branch information
danlucraft committed Jul 9, 2010
1 parent f4084e3 commit b2b3da8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions plugins/runnables/lib/runnables.rb
Expand Up @@ -7,6 +7,7 @@

module Redcar
class Runnables
TREE_TITLE = "Runnables"

class TreeMirror
include Redcar::Tree::Mirror
Expand All @@ -23,7 +24,7 @@ def initialize(project)
end

def title
"Runnables"
TREE_TITLE
end

def top
Expand Down Expand Up @@ -95,12 +96,16 @@ def activated(tree, node)

class ShowRunnables < Redcar::Command
def execute
project = Project::Manager.in_window(win)
tree = Tree.new(
TreeMirror.new(project),
TreeController.new(project)
)
win.treebook.add_tree(tree)
if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE }
win.treebook.focus_tree(tree)
else
project = Project::Manager.in_window(win)
tree = Tree.new(
TreeMirror.new(project),
TreeController.new(project)
)
win.treebook.add_tree(tree)
end
end
end
end
Expand Down

0 comments on commit b2b3da8

Please sign in to comment.