Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[CHANGED] The Ruby support modules Dialog and TextMate::Dialog have b…

…een merged into TextMate::UI. "dialog.rb" is now "ui.rb". All of the former Dialog module methods are now accessed through the TextMate::UI module, e.g. "TextMate::UI.menu(…)" or "include TextMate; UI.menu(…)".

git-svn-id: http://svn.textmate.org/trunk/Bundles/GTDAlt.tmbundle@6958 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit 2fba1fe683e9272244b2edf3b81a0fee6546b7bc 1 parent 653fad0
Chris Thomas authored
View
6 Commands/Find Project.tmCommand
@@ -7,11 +7,11 @@
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/GTD.rb'
-require ENV['TM_SUPPORT_PATH'] + '/lib/dialog.rb'
+require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
include GTD
files = GTD.process_directory
projects = files.map{|i| i.projects}.flatten
-search_string = Dialog.request_string(:title =&gt; "Finding projects", :prompt =&gt; "Abbreviated words to seach for:")
+search_string = TextMate::UI.request_string(:title =&gt; "Finding projects", :prompt =&gt; "Abbreviated words to seach for:")
exit unless search_string &amp;&amp; !(search_string =~ /^\s*$/)
search_terms = search_string.downcase.split(" ")
for term in search_terms do
@@ -23,7 +23,7 @@ when 0
when 1
project = projects[0]
else
- project = Dialog.request_item(:title =&gt; "Finding projects",:prompt =&gt; "Too many possible matches found! Please select one:",:items =&gt; projects.map{|i| i.name+" : "+i.root.name} )
+ project = TextMate::UI.request_item(:title =&gt; "Finding projects",:prompt =&gt; "Too many possible matches found! Please select one:",:items =&gt; projects.map{|i| i.name+" : "+i.root.name} )
project = projects.find{|proj| proj.name+" : "+proj.root.name == project} if project
end
if project then
View
4 Commands/Go to Project.tmCommand
@@ -7,13 +7,13 @@
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/GTD.rb'
-require ENV['TM_SUPPORT_PATH'] + '/lib/dialog.rb'
+require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
include GTD
files = GTD.process_directory
projects = files.map{|i| i.projects}.flatten
projectNames = projects.map{|i| i.name+" : "+i.root.name}
require 'pp'
-choice = Dialog.menu(projectNames)
+choice = TextMate::UI.menu(projectNames)
if choice then
projectName = projectNames[choice]
project = projects.find{|i| i.name+" : "+i.root.name == projectName}
View
4 Commands/New.tmCommand
@@ -7,9 +7,9 @@
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/GTDUtils.rb'
-require ENV['TM_SUPPORT_PATH'] + '/lib/dialog.rb'
+require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
contextList = GTDContexts.contexts
-choice = Dialog.menu(contextList)
+choice = TextMate::UI.menu(contextList)
if choice then
print "@#{contextList[choice]} "
else
View
2  Commands/Project Statistics.tmCommand
@@ -8,7 +8,7 @@
<string>#!/usr/bin/env ruby
$:&lt;&lt; ENV['TM_BUNDLE_SUPPORT'] &lt;&lt; ENV['TM_SUPPORT_PATH']
require "lib/GTD.rb"
-require "lib/dialog"
+require "lib/ui"
include GTD
GTD.process_directory
projects = GTD.projects.find_all{|proj| !proj.completed?}
View
4 Commands/actions for context (Text).tmCommand
@@ -8,7 +8,7 @@
<string>#!/usr/bin/env ruby
$:&lt;&lt; ENV['TM_BUNDLE_SUPPORT'] &lt;&lt; ENV['TM_SUPPORT_PATH']
require "lib/GTD.rb"
-require "lib/dialog"
+require "lib/ui"
include GTD
word = STDIN.read
case word
@@ -20,7 +20,7 @@ end
if GTD.get_contexts.include?(word) then
context = word
else
- context = Dialog.request_item(:title =&gt; 'Listing actions for context', :prompt =&gt; 'Choose the new context', :items =&gt; GTD.contexts)
+ context = TextMate::UI.request_item(:title =&gt; 'Listing actions for context', :prompt =&gt; 'Choose the new context', :items =&gt; GTD.contexts)
exit unless context
end
actions = GTD.actions_for_context(context).map{|r| [r[0],r[1].to_s,r[2]]}
View
4 Commands/choose context.tmCommand
@@ -7,10 +7,10 @@
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/GTDUtils.rb'
-require ENV['TM_SUPPORT_PATH'] + '/lib/dialog.rb'
+require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
line = STDIN.read
contextList = GTDContexts.contexts
-choice = Dialog.menu(contextList)
+choice = TextMate::UI.menu(contextList)
if choice then
print line.sub(/@(\S+)($|\s+)/) {|text,space| "@" + e_sn(contextList[choice]) + ((space.nil? or space == "") ? " " : space)+"$0"}
else
View
4 Macros/New (on next line).tmMacro
@@ -20,9 +20,9 @@
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_BUNDLE_SUPPORT'] + '/lib/GTDUtils.rb'
-require ENV['TM_SUPPORT_PATH'] + '/lib/dialog.rb'
+require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
contextList = GTDContexts.contexts
-choice = Dialog.menu(contextList)
+choice = TextMate::UI.menu(contextList)
if choice then
print "@#{contextList[choice]} "
else
View
7 Support/bin/process_inbox.rb
@@ -1,12 +1,11 @@
#!/usr/bin/env ruby
$:<<ENV['TM_SUPPORT_PATH']
$:<<ENV['TM_BUNDLE_SUPPORT']
-require 'lib/dialog.rb'
+require 'lib/ui.rb'
require 'lib/exit_codes.rb'
require 'lib/GTD.rb'
require 'fileutils.rb'
include GTD
-include Dialog
class NormalException < Exception
end
@@ -52,7 +51,7 @@ class NormalException < Exception
proj = projects.find_all{|pro| pro.name.downcase.index(project.downcase) != nil}
case proj.length
when 0
- choice = Dialog.request_item(:title => "No matching project", :prompt => "Did not find any project matching: #{project}. Please select a project from the list", :items => projects.map{|pro| pro.name} )
+ choice = TextMate::UI.request_item(:title => "No matching project", :prompt => "Did not find any project matching: #{project}. Please select a project from the list", :items => projects.map{|pro| pro.name} )
if choice then
targetProj = projects.find{|pro| pro.name == choice}
else
@@ -61,7 +60,7 @@ class NormalException < Exception
when 1
targetProj = proj[0]
else
- choice = Dialog.request_item(:title => "Too many matching projects", :prompt => "Found too many projects matching: #{project}. Please select a project from the list", :items => proj.map{|pro| pro.name} )
+ choice = TextMate::UI.request_item(:title => "Too many matching projects", :prompt => "Found too many projects matching: #{project}. Please select a project from the list", :items => proj.map{|pro| pro.name} )
if choice then
targetProj = projects.find{|pro| pro.name == choice}
else
Please sign in to comment.
Something went wrong with that request. Please try again.