Sha256: 6bd58ee7f76487e7dd18075f72fd427b414408d00ac5a7a8393f9cf474c83c4d

Contents?: true

Size: 1.17 KB

Versions: 19

Compression:

Stored size: 1.17 KB

Contents

puts "loading edit_view env.rb"

require File.expand_path("../../../../application/features/support/env", __FILE__)

module SwtTabHelpers
  def hide_toolbar
    Redcar.app.show_toolbar = false
    Redcar.app.refresh_toolbar!
  end

  def get_browser_contents
    live_document = "document.getElementsByTagName('html')[0].innerHTML"
    r = focussed_tab.html_view.controller.execute("return #{live_document};").join('')
  end

  def get_tab(tab_folder)
    item1 = tab_folder.getItems.to_a.first
    tab = Redcar.app.windows.first.notebooks.map{|n| n.tabs}.flatten.detect{|t| t.controller.item == item1}
  end
  
  def focussed_tab
    # In case the focussed tab on the focussed window's notebook is empty, try another window
    Redcar.app.focussed_window.focussed_notebook.focussed_tab or Redcar.app.windows.map {|w| w.focussed_notebook.focussed_tab}.first
  end
  
  def get_tabs
    items = get_tab_folders.map{|f| f.getItems.to_a}.flatten
    items.map {|i| model_tab_for_item(i)}
  end
  
  def model_tab_for_item(item)
    model_tabs.detect {|t| t.controller.item == item}
  end
  
  def model_tabs
    Redcar.app.windows.first.notebooks.map{|n| n.tabs}.flatten
  end
end

World(SwtTabHelpers)

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
redcar-0.13 plugins/edit_view/features/support/env.rb
redcar-dev-0.13.5dev plugins/edit_view/features/support/env.rb
redcar-dev-0.13.4dev plugins/edit_view/features/support/env.rb
redcar-dev-0.13.3dev plugins/edit_view/features/support/env.rb
redcar-dev-0.13.2dev plugins/edit_view/features/support/env.rb
redcar-dev-0.13.1dev plugins/edit_view/features/support/env.rb
redcar-0.12.1 plugins/edit_view/features/support/env.rb
redcar-dev-0.13.0dev plugins/edit_view/features/support/env.rb
redcar-0.12 plugins/edit_view/features/support/env.rb
redcar-dev-0.12.27dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.26dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.25dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.24dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.23dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.22dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.21dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.20dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.19dev plugins/edit_view/features/support/env.rb
redcar-dev-0.12.18dev plugins/edit_view/features/support/env.rb