redcar 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. data/CHANGES +28 -0
  2. data/README.md +7 -0
  3. data/ROADMAP.md +11 -1
  4. data/Rakefile +61 -2
  5. data/bin/redcar +2 -1
  6. data/lib/redcar.rb +4 -3
  7. data/lib/redcar/installer.rb +3 -1
  8. data/lib/redcar/runner.rb +1 -1
  9. data/lib/redcar/usage.rb +4 -7
  10. data/lib/redcar_quick_start.rb +39 -5
  11. data/plugins/application/features/step_definitions/tree_steps.rb +6 -0
  12. data/plugins/application/features/support/env.rb +2 -6
  13. data/plugins/application/icons/redcar_icon_beta_dev.png +0 -0
  14. data/plugins/application/lib/application/command/executor.rb +8 -0
  15. data/plugins/application/lib/application/dialog.rb +25 -2
  16. data/plugins/application/lib/application/notebook.rb +4 -0
  17. data/plugins/application/lib/application/window.rb +4 -0
  18. data/plugins/application_swt/lib/application_swt.rb +2 -0
  19. data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +28 -1
  20. data/plugins/application_swt/lib/application_swt/menu.rb +4 -0
  21. data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -0
  22. data/plugins/application_swt/lib/application_swt/notebook.rb +22 -1
  23. data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +124 -0
  24. data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +83 -0
  25. data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +14 -0
  26. data/plugins/application_swt/lib/application_swt/tab.rb +28 -6
  27. data/plugins/application_swt/lib/application_swt/window.rb +88 -43
  28. data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +11 -0
  29. data/plugins/application_swt/spec/spec_helper.rb +1 -1
  30. data/plugins/auto_completer/lib/auto_completer.rb +3 -20
  31. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +1 -1
  32. data/plugins/declarations/lib/declarations/parser.rb +2 -2
  33. data/plugins/declarations/spec/spec_helper.rb +1 -0
  34. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +3 -3
  35. data/plugins/edit_view/features/step_definitions/window_steps.rb +24 -9
  36. data/plugins/edit_view/features/support/env.rb +11 -9
  37. data/plugins/edit_view/lib/edit_view.rb +106 -6
  38. data/plugins/edit_view/lib/edit_view/info_speedbar.rb +32 -3
  39. data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +39 -0
  40. data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +34 -0
  41. data/plugins/edit_view/lib/edit_view/tab_settings.rb +103 -8
  42. data/plugins/edit_view_swt/lib/edit_view_swt.rb +40 -3
  43. data/plugins/edit_view_swt/lib/edit_view_swt/edit_tab.rb +1 -1
  44. data/plugins/execute_current_tab/lib/execute_current_tab.rb +15 -6
  45. data/plugins/project/features/open_directory_tree.feature +10 -0
  46. data/plugins/project/lib/project.rb +10 -8
  47. data/plugins/project/lib/project/dir_mirror.rb +6 -5
  48. data/plugins/project/lib/project/drb_service.rb +16 -0
  49. data/plugins/project/lib/project/manager.rb +31 -5
  50. data/plugins/redcar/redcar.rb +115 -19
  51. data/plugins/tree_view_swt/lib/tree_view_swt.rb +15 -0
  52. data/textmate/Bundles/Cucumber.tmbundle/Preferences/Cucumber_Plain_Text_Feature_Completions.tmPreferences +3 -3
  53. data/textmate/Bundles/Cucumber.tmbundle/Preferences/Symbol_list___Scenario.tmPreferences +1 -1
  54. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +18 -76
  55. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Steps.tmLanguage +1 -1
  56. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Animation_animateStyle.tmSnippet +23 -0
  57. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Event_listen.tmSnippet +16 -0
  58. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stop.tmSnippet} +5 -5
  59. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stopListening.tmSnippet} +5 -9
  60. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Cucumber_Multiline_Steps.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/List_Model.tmSnippet} +10 -7
  61. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Log_addLoggingMethodsToPrototype.tmSnippet +16 -0
  62. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_info.tmSnippet} +5 -5
  63. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario___heading_only__.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_logProperties.tmSnippet} +5 -7
  64. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Model.tmSnippet} +7 -9
  65. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/__L____.tmSnippet +16 -0
  66. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_insert____.tmSnippet +16 -0
  67. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_update____.tmSnippet +16 -0
  68. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_get.tmSnippet +16 -0
  69. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_pushScene.tmSnippet +16 -0
  70. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_serviceRequest.tmSnippet +21 -0
  71. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario_Outline.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_setupWidget.tmSnippet} +5 -9
  72. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Given_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_showBanner.tmSnippet} +5 -9
  73. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Syntaxes/Mojo.tmLanguage +713 -0
  74. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/info.plist +188 -0
  75. data/textmate/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +32 -0
  76. data/textmate/Bundles/{asciidoc.tmbundle/Preferences/Symbol_List___Heading.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Method.tmPreferences} +7 -6
  77. data/textmate/Bundles/{Cucumber.tmbundle/Preferences/next_Symbol_list___Scenario.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Section.tmPreferences} +7 -4
  78. data/textmate/Bundles/{asciidoc.tmbundle/Snippets/Bold.tmSnippet → Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences} +8 -7
  79. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk.tmLanguage +493 -0
  80. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk_2.tmLanguage +807 -0
  81. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/MIST_Smalltalk_Format.tmLanguage +645 -0
  82. data/textmate/Bundles/Smalltalk.tmbundle/info.plist +21 -0
  83. data/textmate/Themes/Twilight.tmTheme +4 -0
  84. metadata +2604 -2586
  85. data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Cucumber_Plain_Text_Feature_Completions.tmPreferences +0 -30
  86. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Plain_Text_Feature.tmLanguage +0 -221
  87. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Steps.tmLanguage +0 -424
  88. data/textmate/Bundles/asciidoc.tmbundle/Preferences/Typing_Pairs___Defaults.tmPreferences +0 -54
  89. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Anchor.tmSnippet +0 -16
  90. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Comment_Block.tmSnippet +0 -19
  91. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Example_Block.tmSnippet +0 -19
  92. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Italic.tmSnippet +0 -16
  93. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Listing_Block.tmSnippet +0 -20
  94. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Literal_Block.tmSnippet +0 -19
  95. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Passthrough_Block.tmSnippet +0 -19
  96. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quote_Block.tmSnippet +0 -19
  97. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quoted.tmSnippet +0 -16
  98. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Sidebar_Block.tmSnippet +0 -19
  99. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Subscript.tmSnippet +0 -16
  100. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Superscript.tmSnippet +0 -16
  101. data/textmate/Bundles/asciidoc.tmbundle/Syntaxes/AsciiDoc.tmLanguage +0 -428
  102. data/textmate/Bundles/asciidoc.tmbundle/info.plist +0 -91
data/CHANGES CHANGED
@@ -1,4 +1,32 @@
1
1
 
2
+ Version 0.3.6 (5 Jun 2010)
3
+ ==========================
4
+
5
+ Enhancements:
6
+
7
+ * Folders open in the project view on a double click (Nizar Jouini)
8
+ * Drag and drop tabs (Tim Felgentreff)
9
+ * Change font and theme commands (Sam Clopton)
10
+ * Word wrap option (Dan Lucraft)
11
+ * Toggle line numbers (Dan Lucraft)
12
+ * Can put TM themes and bundles into .redcar/{Bundles,Themes} (Dan Lucraft)
13
+ * Home command goes to start of text first then start of line (Dan Lucraft)
14
+ * The project view has a fixed width that doesn't change if you resize the main window (Tim Felgentreff)
15
+ * Optional margin that colours text differently past a configurable column. (Dan Lucraft)
16
+ * Experimental app bundle for Mac OSX. (Tim Felgentreff)
17
+ * Moved to JRuby 1.5 (Dan Lucraft)
18
+ * Opens content from standard in (Dan Lucraft)
19
+ * Dev versions of Redcar have a blue icon (Dan Lucraft)
20
+
21
+ New APIs:
22
+
23
+ * Annotations column (Dan Lucraft)
24
+ * Open popup menu and tooltips at cursor/pointer locations (Dan Lucraft)
25
+
26
+ New contributors:
27
+
28
+ * Nizar Jouini
29
+
2
30
  Version 0.3.5dev (1 May 2010)
3
31
  =============================
4
32
 
data/README.md CHANGED
@@ -50,6 +50,13 @@ To run on OSX:
50
50
 
51
51
  You may also need to install the rake, rspec and cucumber gems.
52
52
 
53
+ ## UPDATING A SOURCE BUILD
54
+
55
+ If you are running a source version of Redcar and you have pulled changes from master, then you may have to update your jars by updating and rebuilding:
56
+
57
+ $ git submodule update
58
+ $ jruby -S rake build
59
+
53
60
  ## PROBLEMS?
54
61
 
55
62
  * Irc at #redcar on irc.freenode.net
data/ROADMAP.md CHANGED
@@ -8,7 +8,6 @@ Features still to port
8
8
  * Tests passing on 3 platforms
9
9
  * Full project support
10
10
  * Text/Source/Ruby bundle commands ported
11
- * Drag and drop of tabs
12
11
  * Packaged for one-click install on 3 platforms
13
12
  * Ruby on Rails/HTML/CSS/YAML bundle commands ported
14
13
 
@@ -29,3 +28,14 @@ And then for 1.0...
29
28
  * Recently opened files
30
29
  * more ... ?
31
30
 
31
+
32
+ Notes on features
33
+ =================
34
+
35
+ Macros
36
+ ------
37
+
38
+ * Cursor movement keys are not commands:
39
+ - alt left/right
40
+ - shift alt left/right
41
+ - cmd left/right
data/Rakefile CHANGED
@@ -78,7 +78,7 @@ end
78
78
 
79
79
  spec = Gem::Specification.new do |s|
80
80
  s.name = "redcar"
81
- s.version = "0.3.5"
81
+ s.version = "0.3.6"
82
82
  s.summary = "A JRuby text editor."
83
83
  s.author = "Daniel Lucraft"
84
84
  s.email = "dan@fluentradical.com"
@@ -132,13 +132,72 @@ Rake::GemPackageTask.new(spec) do |pkg|
132
132
  pkg.gem_spec = spec
133
133
  end
134
134
 
135
+ desc "Build a MacOS X App bundle"
136
+ task :app_bundle do
137
+ require 'erb'
138
+
139
+ redcar_icon = "redcar_icon_beta.png"
140
+
141
+ bundle_contents = File.join("pkg", "Redcar.app", "Contents")
142
+ macos_dir = File.join(bundle_contents, "MacOS")
143
+ resources_dir = File.join(bundle_contents, "Resources")
144
+ FileUtils.mkdir_p macos_dir
145
+ FileUtils.mkdir_p resources_dir
146
+
147
+ info_plist_template = ERB.new <<-PLIST
148
+ <?xml version="1.0" encoding="UTF-8"?>
149
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
150
+ <plist version="1.0">
151
+ <dict>
152
+ <key>CFBundleExecutable</key>
153
+ <string>redcar</string>
154
+ <key>CFBundleIconFile</key>
155
+ <string><%= redcar_icon %></string>
156
+ <key>CFBundleIdentifier</key>
157
+ <string>com.redcareditor.Redcar</string>
158
+ <key>CFBundleInfoDictionaryVersion</key>
159
+ <string>6.0</string>
160
+ <key>CFBundlePackageType</key>
161
+ <string>APPL</string>
162
+ <key>CFBundleSignature</key>
163
+ <string>????</string>
164
+ <key>CFBundleVersion</key>
165
+ <string><%= spec.version %></string>
166
+ <key>LSMinimumSystemVersion</key>
167
+ <string>10.5</string>
168
+ </dict>
169
+ </plist>
170
+ PLIST
171
+ File.open(File.join(bundle_contents, "Info.plist"), "w") do |f|
172
+ f << info_plist_template.result(binding)
173
+ end
174
+
175
+ File.open(File.join(macos_dir, "redcar"), "w") do |f|
176
+ f << '#!/bin/sh
177
+ DIR=$(cd "$(dirname "$0")"; pwd)
178
+ REDCAR=$(cd "$(dirname "${DIR}/../Resources/bin/redcar")"; pwd)
179
+ ruby $REDCAR/redcar $@'
180
+ end
181
+ File.chmod 0777, File.join(macos_dir, "redcar")
182
+
183
+ spec.files.each do |f|
184
+ FileUtils.mkdir_p File.join(resources_dir, File.dirname(f))
185
+ FileUtils.cp_r f, File.join(resources_dir, f), :remove_destination => true
186
+ end
187
+
188
+ system "#{File.join(macos_dir, "redcar")} install"
189
+
190
+ FileUtils.cp_r File.join(resources_dir, "plugins", "application", "icons", redcar_icon),
191
+ resources_dir, :remove_destination => true
192
+ end
193
+
135
194
  desc 'Clean up (sanitize) the Textmate files for packaging'
136
195
  task :clean_textmate do
137
196
  # rename files to be x-platform safe
138
197
  Dir["textmate/Bundles/*.tmbundle/*/**/*"].each do |fn|
139
198
  if File.file?(fn)
140
199
  bits = fn.split("/").last.split(".")[0..-2].join("_")
141
- new_basename = bits.gsub(" ", "_").gsub(/[^\w_]/, "__") + File.extname(fn)
200
+ new_basename = bits.gsub(" ", "_").gsub(/[^\w_]/, "__").gsub(/\\./, "__") + File.extname(fn)
142
201
  new_fn = File.join(File.dirname(fn), new_basename)
143
202
  # p [fn,new_fn]
144
203
  next if new_fn == fn
data/bin/redcar CHANGED
@@ -14,6 +14,7 @@ elsif ARGV.first == '--associate_with_any_right_click'
14
14
  installer = Redcar::Installer.new
15
15
  installer.associate_with_any_right_click
16
16
  else
17
+ Redcar.read_stdin
17
18
  exit if Redcar.try_to_load_via_drb
18
19
  require File.join(File.dirname(__FILE__), %w(.. lib redcar))
19
20
  Redcar.spin_up
@@ -21,4 +22,4 @@ else
21
22
  Redcar.load
22
23
  Redcar::Top.start(ARGV)
23
24
  Redcar.pump
24
- end
25
+ end
data/lib/redcar.rb CHANGED
@@ -40,10 +40,10 @@ require 'yaml'
40
40
  #
41
41
  # and so on.
42
42
  module Redcar
43
- VERSION = '0.3.5'
43
+ VERSION = '0.3.6'
44
44
  VERSION_MAJOR = 0
45
45
  VERSION_MINOR = 3
46
- VERSION_RELEASE = 5
46
+ VERSION_RELEASE = 6
47
47
 
48
48
  ENVIRONMENTS = [:user, :debug, :test]
49
49
 
@@ -57,6 +57,7 @@ module Redcar
57
57
  end
58
58
 
59
59
  def self.environment
60
+ raise "no environment set" unless @environment
60
61
  @environment
61
62
  end
62
63
 
@@ -150,7 +151,7 @@ module Redcar
150
151
  attr_accessor :app
151
152
  attr_reader :gui
152
153
  end
153
-
154
+
154
155
  # Set the application GUI.
155
156
  def self.gui=(gui)
156
157
  raise "can't set gui twice" if @gui
@@ -67,6 +67,8 @@ module Redcar
67
67
  /jface/org.eclipse.jface.text_3.5.0.jar
68
68
  /jface/org.eclipse.osgi.jar
69
69
  /jface/org.eclipse.text_3.5.0.v20090513-2000.jar
70
+ /jface/org.eclipse.core.resources.jar
71
+ /jface/org.eclipse.core.jobs.jar
70
72
  )
71
73
 
72
74
  JRUBY_JAR_DIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
@@ -77,7 +79,7 @@ module Redcar
77
79
  "/jruby/joni.jar"
78
80
  ]
79
81
 
80
- JRUBY << "http://jruby.kenai.com/downloads/1.4.0/jruby-complete-1.4.0.jar"
82
+ JRUBY << "http://jruby.org.s3.amazonaws.com/downloads/1.5.0/jruby-complete-1.5.0.jar"
81
83
 
82
84
  JOPENSSL = {
83
85
  "/jruby/bcmail-jdk14-139-#{Redcar::VERSION}.jar" => "lib/openssl/lib/bcmail-jdk14-139.jar",
data/lib/redcar/runner.rb CHANGED
@@ -11,7 +11,7 @@ module Redcar
11
11
  # our vendored jarred one (useful for gems).
12
12
  def spin_up
13
13
  bin = "#{File.dirname(__FILE__)}/../../bin/redcar"
14
- jruby_complete = File.expand_path(File.join(File.dirname(__FILE__), "..", "jruby-complete-1.4.0.jar"))
14
+ jruby_complete = File.expand_path(File.join(File.dirname(__FILE__), "..", "jruby-complete-1.5.0.jar"))
15
15
  unless File.exist?(jruby_complete)
16
16
  puts "\nCan't find jruby jar at #{jruby_complete}, did you run 'redcar install' ?"
17
17
  exit 1
data/lib/redcar/usage.rb CHANGED
@@ -19,13 +19,10 @@ module Redcar
19
19
  puts
20
20
  puts "Usage: redcar [OPTIONS] [FILE|DIR]*"
21
21
  puts
22
- puts " --font=FONT Choose font"
23
- puts " --font-size=SIZE Choose font point size"
24
- puts " --theme=THEME Choose Textmate theme"
25
- puts "--multiple-instance Don't attempt to run from an existing instance"
26
- puts " --verbose Set $VERBOSE to true"
27
- puts " --debug JRuby debugging mode: activates the profiling commands in the Debug menu"
28
- puts ""
22
+ puts " --multiple-instance Don't attempt to open files and dirs in an already running instance"
23
+ puts " --debug JRuby debugging mode: activates the profiling commands in the Debug menu"
24
+ puts "--untitled-file=PATH Open the given file as an untitled tab."
25
+ puts " --ignore-stdin Ignore stdin"
29
26
  #puts "To associate with right click in windows explorer:"
30
27
  #puts
31
28
  #puts " C:> redcar --associate_with_any_right_click"
@@ -2,9 +2,34 @@ require 'socket'
2
2
 
3
3
  module Redcar
4
4
  DRB_PORT = 10021
5
+ DONT_READ_STDIN_ARG = "--ignore-stdin"
6
+
7
+ def self.read_stdin
8
+ if not $stdin.tty? and not ARGV.include?(DONT_READ_STDIN_ARG)
9
+ data = ""
10
+ begin
11
+ chunk = $stdin.read_nonblock(1024)
12
+ data << chunk
13
+ while chunk
14
+ chunk = $stdin.read_nonblock(1024)
15
+ data << chunk
16
+ end
17
+ rescue Errno::EAGAIN
18
+ retry
19
+ rescue EOFError
20
+ end
21
+
22
+ if data.size > 0
23
+ require 'tmpdir'
24
+ file = File.join(Dir.tmpdir, "tmp#{$$}.txt")
25
+ File.open(file, 'w') {|f| f.write data}
26
+ ARGV.unshift "--untitled-file=#{file}", DONT_READ_STDIN_ARG
27
+ end
28
+ end
29
+ end
5
30
 
6
31
  def self.try_to_load_via_drb
7
- return if ARGV.find{|arg| arg == "--multiple-instance" || arg == '--help' || arg == '-h'}
32
+ return if ARGV.find {|arg| arg == "--multiple-instance" || arg == '--help' || arg == '-h'}
8
33
  begin
9
34
  begin
10
35
  TCPSocket.new('127.0.0.1', DRB_PORT).close
@@ -19,10 +44,19 @@ module Redcar
19
44
 
20
45
  if ARGV.any?
21
46
  ARGV.each do |arg|
22
- next if arg[0..0] == "-"
23
- if drb.open_item_drb(File.expand_path(arg)) != 'ok'
24
- return
25
- end
47
+ if File.file?(arg) or File.directory?(arg)
48
+ if drb.open_item_drb(File.expand_path(arg)) != 'ok'
49
+ return
50
+ end
51
+ end
52
+ if arg =~ /--untitled-file=(.*)/
53
+ path = $1
54
+ if File.file?(path)
55
+ if drb.open_item_untitled(File.expand_path(path)) != 'ok'
56
+ return
57
+ end
58
+ end
59
+ end
26
60
  end
27
61
  else
28
62
  return unless drb.open_item_drb('just_bring_to_front')
@@ -16,3 +16,9 @@ Then /^I should (not )?see "([^\"]*)" in the tree$/ do |bool, rows|
16
16
  on_top or on_2
17
17
  end
18
18
  end
19
+
20
+ Then /^the directory tree width should be the default$/ do
21
+ width = Redcar.app.focussed_window.treebook.trees.last.controller.viewer.control.bounds.width
22
+ default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH
23
+ raise "The directory tree width was #{width}, expected #{default}" unless width == default
24
+ end
@@ -24,16 +24,12 @@ module SwtHelper
24
24
  end.compact
25
25
  end
26
26
 
27
- def sash_form
28
- active_shell.getChildren.to_a.first
29
- end
30
-
31
27
  def tree_book
32
- sash_form.getChildren.to_a.first
28
+ active_shell.children.to_a.first.children.to_a.first
33
29
  end
34
30
 
35
31
  def top_tree
36
- r = tree_book.getLayout.topControl
32
+ r = tree_book
37
33
  r.extend(TreeHelpers)
38
34
  r
39
35
  end
@@ -22,14 +22,22 @@ module Redcar
22
22
  result = @command_instance.execute
23
23
  rescue Object => e
24
24
  @command_instance.error = e
25
+ print_command_error(e)
25
26
  rescue java.lang.StackOverflowError => e
26
27
  @command_instance.error = e
28
+ print_command_error(e)
27
29
  end
28
30
  record
29
31
  result
30
32
  end
31
33
 
32
34
  private
35
+
36
+ def print_command_error(e)
37
+ puts "Error in command #{@command_instance.class}"
38
+ puts e.class.to_s + ": " + e.message
39
+ puts e.backtrace
40
+ end
33
41
 
34
42
  def record
35
43
  if Redcar.app.history
@@ -75,8 +75,31 @@ module Redcar
75
75
  end
76
76
 
77
77
  # Shows a tool tip to the user, at the cursor location.
78
- def self.tool_tip(message)
79
- Redcar.gui.dialog_adapter.tool_tip(message)
78
+ #
79
+ # Allowed locations:
80
+ # * :cursor - the location of the text cursor in the focussed text widget
81
+ # * :pointer - the location of the mouse pointer
82
+ #
83
+ # If :cursor is specified with no open tab, it will default to :pointer.
84
+ #
85
+ # @param [String] message
86
+ # @param [Symbol] location
87
+ def self.tool_tip(message, location)
88
+ Redcar.gui.dialog_adapter.tool_tip(message, location)
89
+ end
90
+
91
+ # Shows a popup menu to the user.
92
+ #
93
+ # Allowed locations:
94
+ # * :cursor - the location of the text cursor in the focussed text widget
95
+ # * :pointer - the location of the mouse pointer
96
+ #
97
+ # If :cursor is specified with no open tab, it will default to :pointer.
98
+ #
99
+ # @param [Redcar::Menu] menu
100
+ # @param [Symbol] location
101
+ def self.popup_menu(menu, location)
102
+ Redcar.gui.dialog_adapter.popup_menu(menu, location)
80
103
  end
81
104
  end
82
105
  end
@@ -63,6 +63,10 @@ module Redcar
63
63
  notify_listeners(:tab_focussed, tab)
64
64
  end
65
65
 
66
+ def sort_tabs!(&block)
67
+ @tabs.sort! &block
68
+ end
69
+
66
70
  # Focus the next tab to the right from the currently focussed tab.
67
71
  # Does not wrap.
68
72
  def switch_up
@@ -210,5 +210,9 @@ module Redcar
210
210
  tab.focus
211
211
  end
212
212
  end
213
+
214
+ def all_tabs
215
+ notebooks.map {|nb| nb.tabs }.flatten
216
+ end
213
217
  end
214
218
  end
@@ -16,6 +16,8 @@ require "application_swt/menu"
16
16
  require "application_swt/menu/binding_translator"
17
17
  require "application_swt/notebook"
18
18
  require "application_swt/notebook/drag_and_drop_listener"
19
+ require "application_swt/notebook/tab_transfer"
20
+ require "application_swt/notebook/tab_drag_and_drop_listener"
19
21
  require "application_swt/speedbar"
20
22
  require "application_swt/treebook"
21
23
  require "application_swt/window"
@@ -89,14 +89,41 @@ module Redcar
89
89
  {:button => button, :value => dialog.getValue}
90
90
  end
91
91
 
92
- def tool_tip(message)
92
+ def tool_tip(message, location)
93
93
  tool_tip = Swt::Widgets::ToolTip.new(parent_shell, Swt::SWT::ICON_INFORMATION)
94
94
  tool_tip.set_message(message)
95
95
  tool_tip.set_visible(true)
96
+ tool_tip.set_location(*get_coordinates(location))
97
+ end
98
+
99
+ def popup_menu(menu, location)
100
+ window = Redcar.app.focussed_window
101
+ menu = ApplicationSWT::Menu.new(window.controller, menu, nil, Swt::SWT::POP_UP)
102
+ menu.move(*get_coordinates(location))
103
+ menu.show
96
104
  end
97
105
 
98
106
  private
99
107
 
108
+ def get_coordinates(location)
109
+ edit_view = EditView.focussed_tab_edit_view
110
+ if location == :cursor and not edit_view
111
+ location = :pointer
112
+ end
113
+ case location
114
+ when :cursor
115
+ location = edit_view.controller.mate_text.viewer.get_text_widget.get_location_at_offset(edit_view.cursor_offset)
116
+ x, y = location.x, location.y
117
+ widget_offset = edit_view.controller.mate_text.viewer.get_text_widget.to_display(0,0)
118
+ x += widget_offset.x
119
+ y += widget_offset.y
120
+ when :pointer
121
+ location = ApplicationSWT.display.get_cursor_location
122
+ x, y = location.x, location.y
123
+ end
124
+ [x, y]
125
+ end
126
+
100
127
  def file_dialog(type, options)
101
128
  dialog = Swt::Widgets::FileDialog.new(parent_shell, type)
102
129
  if options[:filter_path]