Sha256: a11b44acf7fd3757c5c11fd9b7dc54e52177ee01c10abbe6fe9e258e29b1e7af

Contents?: true

Size: 1.07 KB

Versions: 30

Compression:

Stored size: 1.07 KB

Contents

module Redcar
  class Runnables
    class RunningProcessChecker
      def initialize(tabs, message, options)
        @tabs, @message, @options = tabs, message, options
      end
      
      def check
        tabs_with_running_processes = @tabs.select {|t| t.html_view.controller and t.html_view.controller.ask_before_closing }
        if tabs_with_running_processes.any?
          result = Application::Dialog.message_box(
            "You have #{tabs_with_running_processes.length} running processes.\n\n" + 
            @message,
            :buttons => :yes_no_cancel
          )
          case result
          when :yes
            tabs_with_running_processes.each do |t|
              t.focus
              t.close
            end
            @options[:continue] ? @options[:continue].call : nil
          when :no
            @options[:continue] ? @options[:continue].call : nil
          when :cancel
            @options[:cancel] ? @options[:cancel].call : nil
          end
        else
          @options[:none] ? @options[:none].call : nil
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
redcar-0.11.0dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.10 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.9.2 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.9.1 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.9.0 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.8.1 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.8 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.7 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.6.1 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.6 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.6.1dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.1 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5 plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.6dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.5dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.4dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.3dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.2dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.5.1dev plugins/runnables/lib/runnables/running_process_checker.rb
redcar-0.4.1 plugins/runnables/lib/runnables/running_process_checker.rb