require ENV['TM_BUNDLE_SUPPORT'] + '/lib/connect.rb' #Retrieve a p4 object from connect.rb then connect to the server conn = Connect.new p4 = conn.connect if p4 change_no = '' output = '' #Retrieve the changelists available for a submit pending = p4.run_changes('-c', p4.client, '-u', p4.user, '-s', 'pending') items = [] pending.each do |i| items << i['change'] end change = conn.get_changelist_choice("Submit", items.include?('default') ? ['default'] : []) #Submit nib jobs_arr = ['a', 'b', 'c'] files_arr = ['x', 'y', 'z'] string_dict = {} string_dict['description'] = "A description" params = {} params['jobs'] = ['a','b','c'] params['files'] = ['x','y','z'] params['description'] = "A description" output = [] TextMate::UI.request_item(:items => ['a','b','c']) { |window| return_hash = window.wait_for_input puts return_hash } end __END__ TextMate::UI.dialog(:nib => ENV['TM_BUNDLE_SUPPORT'] + '/nibs/submit_test.nib', :parameters => params, :center => true) { |window| return_hash = window.wait_for_input puts return_hash.keys } end __END__ begin if change[0] == "pending" change_no = change[1] output = p4.run_submit('-c', change_no) elsif change[0] == "default" change_no = "default" output = p4.run_submit(path_out) else #Something funny has happened :( output = "Oh dear, oh dear, oh dear; please e-mail bbates@perforce.co.uk" end rescue Exception => msg p4.disconnect abort(msg) end p4.disconnect abort(output.to_s) else p4.disconnect abort("Failed to connect, please check your settings") end