Sha256: d353e4336a1b270c77fb480e3f01ac51ccfdd0e69be6ff213f5bbaec0e498fc1

Contents?: true

Size: 1.77 KB

Versions: 44

Compression:

Stored size: 1.77 KB

Contents

module Redcar
  module Scm
    class ToggleScmTreeCommand < Command
      sensitize :open_scm

      def execute(options)
        raise "ToggleScmTree requires a class value." if not options[:value]

        command = options[:value][0]
        klass = options[:value][1]
        project = Project::Manager.focussed_project
        info = Scm::Manager.project_repositories[project]
        tree = info['trees'].find {|t| t.tree_mirror.is_a?(klass[0])}

        if tree
          info['trees'].delete tree
          focussed = project.window.treebook.focussed_tree == tree
          project.window.treebook.remove_tree(tree)

          # return focus to the project module if we were currently focussed
          project.window.treebook.focus_tree(project.tree) if focussed
        elsif info['repo'].supported_commands.include? command
          tree = Tree.new(*klass.map{|k| k.new(info['repo'])})
          project.window.treebook.add_tree(tree)
          tree.tree_mirror.top.each {|n| tree.expand(n)}
          info['trees'].push tree
        else
          Application::Dialog.message_box("Sorry, but your SCM doesn't support this tree.")
        end
      end
    end

    class RemoteInitCommand < Command
      def execute(options)
        raise "No scm module given for remote init" unless options[:value]
        m = options[:value]
        dialog = Redcar::ApplicationSWT::Dialogs::TextAndFileDialog.new(Redcar.app.focussed_window.controller.shell)
        dialog.set_text(m.translations[:remote_init],m.translations[:remote_init_path],m.translations[:remote_init_target])
        result = dialog.open
        if result
          Redcar::Project::Manager.open_project_for_path(result[:directory])
          m.remote_init(result[:text].to_s,result[:directory].to_s)
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
redcar-dev-0.12.16dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.15dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.14dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.13dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.12dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.11dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.10dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.9dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.8dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.7dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.6dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.4dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.3dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.1dev-java plugins/scm/lib/scm/commands.rb
redcar-dev-0.12.0dev-java plugins/scm/lib/scm/commands.rb
redcar-0.11 plugins/scm/lib/scm/commands.rb
redcar-0.11.0dev plugins/scm/lib/scm/commands.rb
redcar-0.10 plugins/scm/lib/scm/commands.rb
redcar-0.9.2 plugins/scm/lib/scm/commands.rb
redcar-0.9.1 plugins/scm/lib/scm/commands.rb