redcar 0.6.1 → 0.7
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.
- data/CHANGES +26 -0
- data/README.md +17 -31
- data/Rakefile +1 -1
- data/bin/redcar +1 -1
- data/lib/redcar.rb +8 -4
- data/lib/redcar/installer.rb +2 -1
- data/plugins/application/features/step_definitions/dialog_steps.rb +5 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +1 -1
- data/plugins/application/features/support/env.rb +38 -17
- data/plugins/application/lib/application.rb +4 -0
- data/plugins/application/lib/application/command.rb +8 -2
- data/plugins/application/lib/application/command/executor.rb +37 -8
- data/plugins/application/lib/application/command/history.rb +3 -3
- data/plugins/application/lib/application/menu.rb +4 -0
- data/plugins/application/lib/application/menu/item.rb +9 -1
- data/plugins/application/lib/application/tab.rb +11 -0
- data/plugins/application/spec/application/command/executor_spec.rb +3 -3
- data/plugins/application/spec/application/command_spec.rb +24 -0
- data/plugins/application/spec/spec_helper.rb +1 -0
- data/plugins/application_swt/lib/application_swt.rb +27 -24
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -33
- data/plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb +46 -0
- data/plugins/application_swt/lib/application_swt/dialogs/text_and_file_dialog.rb +118 -0
- data/plugins/application_swt/lib/application_swt/icon.rb +37 -0
- data/plugins/application_swt/lib/application_swt/menu.rb +8 -3
- data/plugins/application_swt/lib/application_swt/tab.rb +6 -3
- data/plugins/application_swt/lib/application_swt/treebook.rb +29 -31
- data/plugins/application_swt/lib/swt/graphics_utils.rb +170 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +125 -0
- data/plugins/application_swt/lib/swt/vtab_item.rb +69 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +84 -0
- data/plugins/auto_indenter/lib/auto_indenter.rb +4 -2
- data/plugins/core/lib/core/controller.rb +18 -0
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/document_search/lib/document_search.rb +8 -6
- data/plugins/document_search/lib/document_search/replace.rb +51 -31
- data/plugins/document_search/lib/document_search/search_and_replace.rb +12 -11
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +33 -17
- data/plugins/edit_view/lib/edit_view.rb +100 -21
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +34 -11
- data/plugins/edit_view/lib/edit_view/actions/deletion.rb +10 -0
- data/plugins/edit_view/lib/edit_view/command.rb +5 -1
- data/plugins/edit_view/lib/edit_view/document.rb +8 -3
- data/plugins/edit_view/lib/edit_view/document/command.rb +15 -1
- data/plugins/edit_view/lib/edit_view/document/controller.rb +9 -0
- data/plugins/edit_view/lib/edit_view/document/history.rb +41 -0
- data/plugins/edit_view/lib/edit_view/tab_settings.rb +1 -11
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +150 -4
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +1 -1
- data/plugins/edit_view_swt/vendor/java-mateview.rb +1 -1
- data/plugins/find-in-project/lib/find_in_project.rb +7 -5
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +2 -2
- data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +0 -1
- data/plugins/line_tools/lib/line_tools.rb +7 -9
- data/plugins/macros/features/block_selection_in_macros.feature +48 -0
- data/plugins/macros/features/predictive_macros.feature +79 -0
- data/plugins/macros/features/record_and_run_macro.feature +87 -0
- data/plugins/macros/features/step_definitions/macro_steps.rb +66 -0
- data/plugins/macros/features/step_definitions/prediction_steps.rb +8 -0
- data/plugins/macros/features/support/env.rb +2 -0
- data/plugins/macros/lib/macros.rb +167 -0
- data/plugins/macros/lib/macros/action_sequence.rb +30 -0
- data/plugins/macros/lib/macros/commands.rb +108 -0
- data/plugins/macros/lib/macros/macro.rb +37 -0
- data/plugins/macros/lib/macros/manager_controller.rb +67 -0
- data/plugins/macros/lib/macros/predictive/document_controller.rb +69 -0
- data/plugins/macros/lib/macros/predictive/sequence_finder.rb +112 -0
- data/plugins/macros/plugin.rb +9 -0
- data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +142 -0
- data/plugins/macros/spec/spec_helper.rb +6 -0
- data/plugins/macros/views/macro_manager.html.erb +86 -0
- data/plugins/outline_view/lib/outline_view.rb +1 -1
- data/plugins/project/lib/project/commands.rb +2 -2
- data/plugins/redcar/redcar.rb +37 -46
- data/plugins/repl/lib/repl.rb +4 -4
- data/plugins/runnables/features/command_tree.feature +1 -1
- data/plugins/runnables/features/parameter_input.feature +42 -0
- data/plugins/runnables/features/step_definitions/runnable_steps.rb +6 -0
- data/plugins/runnables/features/support/env.rb +28 -8
- data/plugins/runnables/lib/runnables.rb +35 -206
- data/plugins/runnables/lib/runnables/commands.rb +65 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable.rb +62 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +59 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +32 -0
- data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +41 -0
- data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +61 -0
- data/plugins/scm/lib/scm.rb +78 -45
- data/plugins/scm/lib/scm/commands.rb +18 -4
- data/plugins/scm/lib/scm/model.rb +54 -41
- data/plugins/scm_svn/LICENSE +48 -0
- data/plugins/scm_svn/features/add_and_commit.feature +18 -0
- data/plugins/scm_svn/features/checkout.feature +5 -0
- data/plugins/scm_svn/features/edit_and_index.feature +12 -0
- data/plugins/scm_svn/features/ignore_files.feature +14 -0
- data/plugins/scm_svn/features/merge.feature +34 -0
- data/plugins/scm_svn/features/resolve_conflict.feature +23 -0
- data/plugins/scm_svn/features/revert_and_delete.feature +21 -0
- data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +27 -0
- data/plugins/scm_svn/features/step_definitions/checkout_steps.rb +25 -0
- data/plugins/scm_svn/features/step_definitions/edit_and_index_steps.rb +50 -0
- data/plugins/scm_svn/features/step_definitions/scm_svn_steps.rb +57 -0
- data/plugins/scm_svn/features/support/env.rb +74 -0
- data/plugins/scm_svn/features/switch_branches.feature +53 -0
- data/plugins/scm_svn/features/update.feature +16 -0
- data/plugins/scm_svn/lib/scm_svn.rb +423 -9
- data/plugins/scm_svn/lib/scm_svn/change.rb +116 -0
- data/plugins/swt/lib/swt.rb +0 -15
- data/plugins/swt/lib/swt/cucumber_patches.rb +2 -37
- data/plugins/swt/lib/swt/cucumber_runner.rb +1 -0
- data/plugins/swt/lib/swt/full_swt.rb +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/Syntaxes/Clojure.tmLanguage +14 -2
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
- data/plugins/todo_list/views/default.css +50 -0
- data/plugins/todo_list/views/index.html.erb +5 -16
- data/plugins/todo_list/views/redcar_small_icon.png +0 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +14 -33
- data/plugins/view_shortcuts/views/default.css +31 -0
- data/plugins/view_shortcuts/views/index.html.erb +26 -16
- data/plugins/view_shortcuts/views/redcar_small_icon.png +0 -0
- data/{plugins/runnables → share}/icons/cog.png +0 -0
- data/share/icons/folder-gear-emblem.png +0 -0
- data/share/icons/folder-gear.png +0 -0
- data/share/icons/folder-open-small-gears.png +0 -0
- metadata +59 -5
data/CHANGES
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
Version 0.7 (4 October 2010)
|
|
2
|
+
============================
|
|
3
|
+
|
|
4
|
+
Enhancements:
|
|
5
|
+
|
|
6
|
+
* Vertical tabs for the tree book on the left. (Tim Felgentreff)
|
|
7
|
+
* Runnables are grouped by type in the tree (Delisa Mason)
|
|
8
|
+
* Improved styling of the keyboard shortcuts help and todo list (Delisa Mason)
|
|
9
|
+
* Tidier Edit menu! (Delisa Mason)
|
|
10
|
+
* Record and run macros (Dan Lucraft)
|
|
11
|
+
* Name and save macros (Dan Lucraft)
|
|
12
|
+
* Macro manager to save, rename and delete macros (Dan Lucraft)
|
|
13
|
+
* Predictive macros that know what you want to do! (Dan Lucraft)
|
|
14
|
+
* Experimental Subversion integration (Delisa Mason)
|
|
15
|
+
|
|
16
|
+
New internal APIs:
|
|
17
|
+
|
|
18
|
+
* DocumentHistory stream of changes to text (Dan Lucraft)
|
|
19
|
+
* Menus can have lazy text that is generated when you look at them (Dan Lucraft)
|
|
20
|
+
* Tab icons can change. (Dan Lucraft)
|
|
21
|
+
|
|
22
|
+
Bugfixes
|
|
23
|
+
|
|
24
|
+
* Open in file browser and command line now works on Windows (Jeremy Wentworth, Delisa Mason)
|
|
25
|
+
|
|
26
|
+
|
|
1
27
|
Version 0.6 (21 September 2010)
|
|
2
28
|
===============================
|
|
3
29
|
|
data/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{Redcar}
|
|
2
2
|
========
|
|
3
3
|
|
|
4
|
-
by Daniel Lucraft
|
|
5
4
|
http://RedcarEditor.com/
|
|
6
5
|
|
|
7
6
|
## DESCRIPTION
|
|
@@ -15,64 +14,51 @@ You must have Java installed. You will also need to run these commands for each
|
|
|
15
14
|
$ sudo gem install redcar
|
|
16
15
|
$ redcar install
|
|
17
16
|
|
|
18
|
-
NB the install will take a minute or so to complete as it has to download
|
|
19
|
-
about 15MB of jar files.
|
|
17
|
+
NB the install will take a minute or so to complete as it has to download about 15MB of jar files.
|
|
20
18
|
|
|
21
19
|
## USAGE
|
|
22
20
|
|
|
23
21
|
Run
|
|
24
22
|
|
|
25
|
-
$ redcar
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
$ redcar
|
|
24
|
+
|
|
25
|
+
## PROBLEMS?
|
|
26
|
+
|
|
27
|
+
* Irc at #redcar on irc.freenode.net
|
|
28
|
+
* Mailing list at http://groups.google.com/group/redcar-editor
|
|
28
29
|
|
|
29
30
|
## INSTALLING FROM SOURCE
|
|
30
31
|
|
|
31
32
|
If you want to contribute to Redcar, you can install it from the source code.
|
|
32
33
|
|
|
33
|
-
If you're running Windows, as a prerequisite, you'll need to install the
|
|
34
|
-
rubyzip gem:
|
|
34
|
+
If you're running Windows, as a prerequisite, you'll need to install the rubyzip gem:
|
|
35
35
|
|
|
36
36
|
$ gem install rubyzip
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
installed as JRuby gems.
|
|
40
|
-
|
|
41
|
-
$ jruby -S gem install rspec cucumber json-jruby
|
|
42
|
-
|
|
43
|
-
Download from github, checkout the submodules and build JavaMateView.
|
|
38
|
+
Download from github, checkout the submodules and install the jars.
|
|
44
39
|
|
|
45
40
|
$ git clone git://github.com/redcar/redcar.git
|
|
46
41
|
$ cd redcar
|
|
47
42
|
$ git submodule init
|
|
48
43
|
$ git submodule update
|
|
49
|
-
$
|
|
50
|
-
$ jruby -S rake build
|
|
44
|
+
$ ruby bin/redcar install
|
|
51
45
|
|
|
52
|
-
To run
|
|
46
|
+
To run:
|
|
53
47
|
|
|
54
|
-
$
|
|
55
|
-
|
|
56
|
-
To run on OSX:
|
|
57
|
-
|
|
58
|
-
$ jruby -J-XstartOnFirstThread bin/redcar
|
|
59
|
-
|
|
60
|
-
You may also need to install the rake, rspec and cucumber gems.
|
|
48
|
+
$ ruby bin/redcar
|
|
61
49
|
|
|
62
50
|
## UPDATING A SOURCE BUILD
|
|
63
51
|
|
|
64
|
-
If you are running a source version of Redcar and you have pulled changes from
|
|
65
|
-
master, then you may have to update your jars by updating and rebuilding:
|
|
52
|
+
If you are running a source version of Redcar and you have pulled changes from master, then you may have to update your repo:
|
|
66
53
|
|
|
67
54
|
$ git submodule update
|
|
68
|
-
$
|
|
55
|
+
$ ruby bin/redcar install
|
|
69
56
|
|
|
70
|
-
##
|
|
57
|
+
## TESTS
|
|
71
58
|
|
|
72
|
-
|
|
73
|
-
* Mailing list at http://groups.google.com/group/redcar-editor
|
|
59
|
+
NB. Redcar features won't run with Cucumber 0.9.0 yet. They are known to work with 0.8.5.
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
To run the tests you need JRuby installed. You also need rspec and cucumber installed as Jruby gems. See jruby.org for this, or install with rvm.
|
|
76
62
|
|
|
77
63
|
To run all specs and features:
|
|
78
64
|
|
data/Rakefile
CHANGED
data/bin/redcar
CHANGED
data/lib/redcar.rb
CHANGED
|
@@ -51,10 +51,10 @@ end
|
|
|
51
51
|
#
|
|
52
52
|
# and so on.
|
|
53
53
|
module Redcar
|
|
54
|
-
VERSION = '0.
|
|
54
|
+
VERSION = '0.7' # also change in the Rakefile!
|
|
55
55
|
VERSION_MAJOR = 0
|
|
56
|
-
VERSION_MINOR =
|
|
57
|
-
VERSION_RELEASE =
|
|
56
|
+
VERSION_MINOR = 7
|
|
57
|
+
VERSION_RELEASE = 0
|
|
58
58
|
|
|
59
59
|
ENVIRONMENTS = [:user, :debug, :test]
|
|
60
60
|
|
|
@@ -155,7 +155,11 @@ module Redcar
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
def self.no_gui_mode?
|
|
158
|
-
ARGV.include?("--no-gui")
|
|
158
|
+
@no_gui_mode || ARGV.include?("--no-gui")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def self.no_gui_mode!
|
|
162
|
+
@no_gui_mode = true
|
|
159
163
|
end
|
|
160
164
|
|
|
161
165
|
def self.show_splash
|
data/lib/redcar/installer.rb
CHANGED
|
@@ -60,7 +60,8 @@ module Redcar
|
|
|
60
60
|
"http://redcar.s3.amazonaws.com/clojure-1.2beta1.jar" => "/clojure.jar",
|
|
61
61
|
"http://redcar.s3.amazonaws.com/clojure-contrib-1.2beta1.jar" => "/clojure-contrib.jar",
|
|
62
62
|
"http://redcar.s3.amazonaws.com/org-enclojure-repl-server.jar" => nil,
|
|
63
|
-
"http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/groovy/groovy-all/1.7.4/groovy-all-1.7.4.jar" => "/groovy-all.jar"
|
|
63
|
+
"http://mirrors.ibiblio.org/pub/mirrors/maven2/org/codehaus/groovy/groovy-all/1.7.4/groovy-all-1.7.4.jar" => "/groovy-all.jar",
|
|
64
|
+
"http://mirrors.ibiblio.org/pub/mirrors/maven2/org/tmatesoft/svnkit/svnkit/1.3.4/svnkit-1.3.4.jar" => "/svnkit.jar"
|
|
64
65
|
},
|
|
65
66
|
:windows => {
|
|
66
67
|
"http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/#{xulrunner_version}/runtimes/xulrunner-#{xulrunner_version}.en-US.win32.zip" => "xulrunner-#{xulrunner_version}.en-US.win32.zip",
|
|
@@ -4,6 +4,10 @@ Given /^I will choose "([^\"]*)" from the "([^\"]*)" dialog$/ do |path, type|
|
|
|
4
4
|
Redcar.gui.dialog_adapter.set(type.to_sym, path)
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
Given /^I would type "([^"]*)" in an input box$/ do |params|
|
|
8
|
+
Redcar.gui.dialog_adapter.add_input(params)
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
Then /^I should not see a "([^\"]*)" dialog for the rest of the feature/ do |type|
|
|
8
12
|
Redcar.gui.dialog_adapter.set(type.to_sym, :raise_error)
|
|
9
13
|
end
|
|
@@ -11,3 +15,4 @@ end
|
|
|
11
15
|
Then /^I should see a message box containing "([^"]*)"$/ do |arg1|
|
|
12
16
|
Redcar.gui.dialog_adapter.should_get_message(arg1)
|
|
13
17
|
end
|
|
18
|
+
|
|
@@ -18,7 +18,7 @@ Then /^I should (not )?see "([^\"]*)" in the tree$/ do |negate, rows|
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
Then /^the tree width should be the default$/ do
|
|
21
|
-
width = Redcar.app.focussed_window.treebook.
|
|
21
|
+
width = Redcar.app.focussed_window.treebook.controller.tab_folder.bounds.width
|
|
22
22
|
default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH - 5
|
|
23
23
|
raise "The tree width was #{width}, expected #{default}" unless width == default
|
|
24
24
|
end
|
|
@@ -8,11 +8,11 @@ module SwtHelper
|
|
|
8
8
|
menu_bar = shell.get_menu_bar
|
|
9
9
|
menu_bar
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def first_shell
|
|
13
13
|
Redcar::ApplicationSWT.display.get_shells.to_a.first
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def active_shell
|
|
17
17
|
focussed_window.controller.shell
|
|
18
18
|
end
|
|
@@ -24,13 +24,13 @@ module SwtHelper
|
|
|
24
24
|
def focussed_tree
|
|
25
25
|
focussed_window.treebook.focussed_tree
|
|
26
26
|
end
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
def dialog(type)
|
|
29
29
|
dialogs.detect {|d| d.is_a?(type) }
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
def dialogs
|
|
33
|
-
Redcar::ApplicationSWT.display.get_shells.to_a.map do |s|
|
|
33
|
+
Redcar::ApplicationSWT.display.get_shells.to_a.map do |s|
|
|
34
34
|
Redcar::ApplicationSWT.shell_dialogs[s]
|
|
35
35
|
end.compact
|
|
36
36
|
end
|
|
@@ -48,7 +48,7 @@ module SwtHelper
|
|
|
48
48
|
tree.extend(TreeHelpers)
|
|
49
49
|
tree
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
def find_node_with_text(top, node_text)
|
|
53
53
|
node = top.detect { |node| node.text == node_text }
|
|
54
54
|
return node if node
|
|
@@ -60,38 +60,39 @@ module SwtHelper
|
|
|
60
60
|
def items
|
|
61
61
|
getItems.to_a
|
|
62
62
|
end
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
def item_texts
|
|
65
65
|
getItems.to_a.map {|item| item.getText}
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
class FakeDialogAdapter
|
|
71
71
|
def initialize
|
|
72
72
|
@responses = {}
|
|
73
|
+
@inputs = []
|
|
73
74
|
end
|
|
74
|
-
|
|
75
|
+
|
|
75
76
|
def set(method, value)
|
|
76
77
|
@responses[method] = value
|
|
77
78
|
end
|
|
78
|
-
|
|
79
|
+
|
|
79
80
|
def should_get_message(message)
|
|
80
81
|
@message = message
|
|
81
82
|
end
|
|
82
|
-
|
|
83
|
+
|
|
83
84
|
def open_file(*args)
|
|
84
85
|
check_for_raise(@responses[:open_file])
|
|
85
86
|
end
|
|
86
|
-
|
|
87
|
+
|
|
87
88
|
def open_directory(*args)
|
|
88
89
|
check_for_raise(@responses[:open_directory])
|
|
89
90
|
end
|
|
90
|
-
|
|
91
|
+
|
|
91
92
|
def save_file(*args)
|
|
92
93
|
check_for_raise(@responses[:save_file])
|
|
93
94
|
end
|
|
94
|
-
|
|
95
|
+
|
|
95
96
|
def message_box(*args)
|
|
96
97
|
if @message == :any
|
|
97
98
|
elsif @message
|
|
@@ -104,18 +105,35 @@ class FakeDialogAdapter
|
|
|
104
105
|
end
|
|
105
106
|
@responses[:message_box].to_sym if @responses[:message_box]
|
|
106
107
|
end
|
|
107
|
-
|
|
108
|
+
|
|
109
|
+
def input(*args)
|
|
110
|
+
if @inputs.length < 1
|
|
111
|
+
raise TestingError.new("No input added to complete this command.")
|
|
112
|
+
end
|
|
113
|
+
val = @inputs[0]
|
|
114
|
+
@inputs.delete_at(0)
|
|
115
|
+
{:value => val} # no button to speak of...
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def add_input(value)
|
|
119
|
+
@inputs << value
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def clear_input
|
|
123
|
+
@inputs = []
|
|
124
|
+
end
|
|
125
|
+
|
|
108
126
|
def check_for_raise(result)
|
|
109
127
|
if result == :raise_error
|
|
110
128
|
raise TestingError.new("did not expect dialog")
|
|
111
129
|
end
|
|
112
130
|
result
|
|
113
131
|
end
|
|
114
|
-
|
|
132
|
+
|
|
115
133
|
def available_message_box_button_combos
|
|
116
134
|
Redcar::ApplicationSWT::DialogAdapter.new.available_message_box_button_combos
|
|
117
135
|
end
|
|
118
|
-
|
|
136
|
+
|
|
119
137
|
def available_message_box_types
|
|
120
138
|
Redcar::ApplicationSWT::DialogAdapter.new.available_message_box_types
|
|
121
139
|
end
|
|
@@ -171,6 +189,9 @@ After do
|
|
|
171
189
|
raise "Command errors #{errors.inspect}"
|
|
172
190
|
end
|
|
173
191
|
Redcar.app.history.clear
|
|
192
|
+
total_mem = java.lang.Runtime.getRuntime.totalMemory
|
|
193
|
+
free_mem = java.lang.Runtime.getRuntime.freeMemory
|
|
194
|
+
p [:total, total_mem, :free, free_mem, :diff, total_mem - free_mem]
|
|
174
195
|
end
|
|
175
196
|
|
|
176
197
|
at_exit {
|
|
@@ -71,12 +71,18 @@ module Redcar
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def environment(env)
|
|
74
|
-
|
|
74
|
+
if env == nil
|
|
75
|
+
remove_instance_variable(:@env) if @env
|
|
76
|
+
else
|
|
77
|
+
@env = env
|
|
78
|
+
end
|
|
75
79
|
end
|
|
76
80
|
|
|
77
81
|
def run(opts = {})
|
|
78
82
|
@executor = Executor.new(self, opts)
|
|
79
|
-
@executor.execute
|
|
83
|
+
result = @executor.execute
|
|
84
|
+
remove_instance_variable(:@executor)
|
|
85
|
+
result
|
|
80
86
|
end
|
|
81
87
|
|
|
82
88
|
private
|
|
@@ -4,11 +4,15 @@ module Redcar
|
|
|
4
4
|
class Executor
|
|
5
5
|
include Redcar::Core::HasLogger
|
|
6
6
|
|
|
7
|
+
attr_reader :options, :command_instance
|
|
8
|
+
|
|
7
9
|
def self.current_environment
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:
|
|
10
|
+
if Redcar.app
|
|
11
|
+
win = Redcar.app.focussed_window
|
|
12
|
+
tab = Redcar.app.focussed_notebook_tab
|
|
13
|
+
{ :win => win,
|
|
14
|
+
:tab => tab }
|
|
15
|
+
end
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def initialize(command_instance, options={})
|
|
@@ -17,25 +21,50 @@ module Redcar
|
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
def execute
|
|
20
|
-
|
|
24
|
+
set_environment
|
|
21
25
|
begin
|
|
22
26
|
if not @options.empty?
|
|
23
27
|
result = @command_instance.execute(@options)
|
|
24
28
|
else
|
|
25
29
|
result = @command_instance.execute
|
|
26
30
|
end
|
|
31
|
+
finish
|
|
32
|
+
clear_environment
|
|
27
33
|
rescue Object => e
|
|
28
|
-
|
|
34
|
+
set_error(e)
|
|
29
35
|
print_command_error(e)
|
|
30
36
|
rescue java.lang.StackOverflowError => e
|
|
31
|
-
|
|
37
|
+
set_error(e)
|
|
32
38
|
print_command_error(e)
|
|
33
39
|
end
|
|
34
40
|
record
|
|
35
41
|
result
|
|
42
|
+
ensure
|
|
43
|
+
clear_environment
|
|
36
44
|
end
|
|
37
45
|
|
|
38
46
|
private
|
|
47
|
+
|
|
48
|
+
def set_environment
|
|
49
|
+
env = Executor.current_environment || {}
|
|
50
|
+
env = env.merge(options.delete(:env) || {})
|
|
51
|
+
|
|
52
|
+
@command_instance.environment(env)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def clear_environment
|
|
56
|
+
@command_instance.environment(nil)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def set_error(e)
|
|
60
|
+
@command_instance.error = e
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def finish
|
|
64
|
+
if @command_instance.respond_to?(:_finished)
|
|
65
|
+
@command_instance._finished
|
|
66
|
+
end
|
|
67
|
+
end
|
|
39
68
|
|
|
40
69
|
def print_command_error(e)
|
|
41
70
|
puts "Error in command #{@command_instance.class}"
|
|
@@ -44,7 +73,7 @@ module Redcar
|
|
|
44
73
|
end
|
|
45
74
|
|
|
46
75
|
def record
|
|
47
|
-
if Redcar.app.history
|
|
76
|
+
if Redcar.app.andand.history
|
|
48
77
|
Redcar.app.history.record(@command_instance)
|
|
49
78
|
end
|
|
50
79
|
end
|