Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'origin/master' into textmate-commands

  • Loading branch information...
commit dacf436e108e4741a4758d3ba31e1857dd4a0404 2 parents af7662e + 68a4a90
Tim Felgentreff timfel authored
Showing with 681 additions and 718 deletions.
  1. +3 −1 CHANGES
  2. +4 −0 README.md
  3. +5 −1 lib/redcar/installer.rb
  4. +1 −1  lib/redcar/runner.rb
  5. +9 −2 plugins/application/lib/application.rb
  6. +0 −1  plugins/application/lib/application/command/executor.rb
  7. +8 −1 plugins/application/lib/application/commands/{quit_command.rb → application_commands.rb}
  8. +73 −0 plugins/application/lib/application/commands/notebook_commands.rb
  9. +105 −0 plugins/application/lib/application/commands/tab_commands.rb
  10. +117 −0 plugins/application/lib/application/commands/treebook_commands.rb
  11. +33 −0 plugins/application/lib/application/commands/{close_window_command.rb → window_commands.rb}
  12. +0 −4 plugins/{tree/lib → application/lib/application}/tree.rb
  13. 0  plugins/{tree/lib → application/lib/application}/tree/command.rb
  14. 0  plugins/{tree/lib → application/lib/application}/tree/controller.rb
  15. 0  plugins/{tree/lib → application/lib/application}/tree/mirror.rb
  16. +0 −4 plugins/core/lib/core.rb
  17. +2 −4 plugins/core/lib/core/gui.rb
  18. +0 −28 plugins/core/lib/core/logger.rb
  19. +34 −1 plugins/core/lib/core/plugin/storage.rb
  20. +49 −0 plugins/core/spec/core/shared_storage_spec.rb
  21. +1 −0  plugins/edit_view_swt/lib/edit_view_swt.rb
  22. +0 −125 plugins/file_parser/lib/file_parser.rb
  23. +0 −7 plugins/file_parser/plugin.rb
  24. +1 −1  plugins/html_view/lib/html_view.rb
  25. +1 −1  plugins/project/lib/project/commands.rb
  26. +1 −1  plugins/project/lib/project/file_list.rb
  27. +11 −4 plugins/project/lib/project/find_file_dialog.rb
  28. +47 −11 plugins/project/lib/project/manager.rb
  29. +1 −2  plugins/project/plugin.rb
  30. +12 −4 plugins/project_search/lib/project_search.rb
  31. +116 −482 plugins/redcar/redcar.rb
  32. +1 −2  plugins/runnables/plugin.rb
  33. +1 −0  plugins/test_runner/lib/test_runner.rb
  34. +15 −0 plugins/test_runner/lib/test_runner/jasmine_test_runner.rb
  35. +21 −5 plugins/test_runner/lib/test_runner/runnable_test_runner.rb
  36. +0 −2  plugins/textmate/lib/textmate/snippet.rb
  37. +6 −5 plugins/textmate/lib/textmate/tree_mirror.rb
  38. +1 −1  plugins/textmate/plugin.rb
  39. +0 −9 plugins/tree/plugin.rb
  40. +0 −5 plugins/tree/spec/spec_helper.rb
  41. +1 −2  plugins/web_bookmarks/plugin.rb
  42. +1 −1  vendor/java-mateview
4 CHANGES
View
@@ -11,14 +11,16 @@ Enhancements:
* Which files are hidden in a project is now configurable (Konstantin Haase)
* Added logger at Redcar.log, goes to ~/.redcar/user.log (Dan Lucraft)
* Can hide files and directories from the project context menu (Benedikt Müller)
- * Notification if Redcar doesn't have permission to save files (Benedikt Müller)
+ * Notification if Redcar doesn't have permission to save files (Benedikt Müller & Bill Siggelkow)
* Tweaked the load order to make the window appear faster during startup (Dan Lucraft)
+ * All the plugins use a single preference value to ignore files (Benedikt Müller)
Bugfixes:
* Fixed Unicode problems in DocumentSearch (Tom Murray)
* You can now symlink bin/redcar (Konstantin Haase)
* Runnables are now terminated correctly when the tab is closed (Dan Lucraft)
* You are once again prompted when you close a window with running Runnables in (Dan Lucraft)
+ * Fix encoding issue that broke highlighting when there are multi-byte characters in a line (Dan Lucraft)
Version 0.10 (17 January 2011)
==============================
4 README.md
View
@@ -19,6 +19,10 @@ Some Redcar features:
* syntax checking for many languages
* built in REPLs for Ruby, Groovy, Clojure and Mirah.
+Some (current) limitations:
+
+ * Only supports UTF-8 file encodings (and therefore ASCII)
+
![alt text](http://redcareditor.com/images/redcar-4-thumb.png "Title")
![alt text](http://redcareditor.com/images/redcar-1-thumb.png "Title")
6 lib/redcar/installer.rb
View
@@ -84,7 +84,11 @@ def assets_by_platform
def fetch_asset(source, target)
relative_target = target || implicit_target(source)
absolute_target = File.join(Redcar.asset_dir, relative_target)
- return if File.exist?(absolute_target)
+ if File.exist?(absolute_target)
+ unless source =~ /dev\.jar/
+ return
+ end
+ end
download_file_to(source, absolute_target)
unzip_file(absolute_target) if absolute_target =~ /\.zip$/
end
2  lib/redcar/runner.rb
View
@@ -68,7 +68,7 @@ def construct_command(args="")
command = ["java"]
command.push(*java_args)
command.push("-Xbootclasspath/a:#{jruby_complete}")
- command.push("-Xmx320m", "-Xss1024k", "-Djruby.memory.max=320m", "-Djruby.stack.max=1024k", "org.jruby.Main")
+ command.push("-Dfile.encoding=UTF8", "-Xmx320m", "-Xss1024k", "-Djruby.memory.max=320m", "-Djruby.stack.max=1024k", "org.jruby.Main")
command.push "--debug" if debug_mode?
command.push(bin)
command.push(*cleaned_args)
11 plugins/application/lib/application.rb
View
@@ -28,11 +28,18 @@
require 'application/speedbar'
require 'application/tab'
require 'application/tab/command'
+require 'application/tree'
+require 'application/tree/command'
+require 'application/tree/controller'
+require 'application/tree/mirror'
require 'application/treebook'
require 'application/window'
-require 'application/commands/close_window_command'
-require 'application/commands/quit_command'
+require 'application/commands/application_commands'
+require 'application/commands/tab_commands'
+require 'application/commands/notebook_commands'
+require 'application/commands/window_commands'
+require 'application/commands/treebook_commands'
module Redcar
# A Redcar process contains one Application instance. The application instance
1  plugins/application/lib/application/command/executor.rb
View
@@ -2,7 +2,6 @@
module Redcar
class Command
class Executor
- include Redcar::Core::HasLogger
attr_reader :options, :command_instance
9 ...lication/lib/application/commands/quit_command.rb → .../lib/application/commands/application_commands.rb
View
@@ -1,7 +1,6 @@
module Redcar
class Application
class QuitCommand < Command
-
def execute
Redcar.app.call_on_plugins(:quit_guard) do |guard|
return unless guard
@@ -10,5 +9,13 @@ def execute
Redcar.app.quit
end
end
+
+ class ToggleToolbar < Command
+
+ def execute
+ Redcar.app.toggle_show_toolbar
+ Redcar.app.refresh_toolbar!
+ end
+ end
end
end
73 plugins/application/lib/application/commands/notebook_commands.rb
View
@@ -0,0 +1,73 @@
+module Redcar
+ class Application
+ class NewNotebookCommand < Command
+
+ def execute
+ win.create_notebook
+ end
+ end
+
+ class EnlargeNotebookCommand < Command
+ sensitize :multiple_notebooks
+
+ def execute
+ if win = Redcar.app.focussed_window
+ win.enlarge_notebook(0)
+ end
+ end
+ end
+
+ class ResetNotebookWidthsCommand < Command
+ sensitize :multiple_notebooks
+
+ def execute
+ if win = Redcar.app.focussed_window
+ win.reset_notebook_widths
+ end
+ end
+ end
+
+ class RotateNotebooksCommand < Command
+ sensitize :multiple_notebooks
+
+ def execute
+ win.rotate_notebooks
+ end
+ end
+
+ class CloseNotebookCommand < Command
+ sensitize :multiple_notebooks
+
+ def execute
+ unless win.notebooks.length == 1
+ win.close_notebook
+ end
+ end
+ end
+
+ class SwitchNotebookCommand < Command
+ sensitize :multiple_notebooks, :other_notebook_has_tab
+
+ def execute
+ new_notebook = win.nonfocussed_notebook
+ if new_notebook.focussed_tab
+ new_notebook.focussed_tab.focus
+ end
+ end
+ end
+
+ class MoveTabToOtherNotebookCommand < Command
+ sensitize :multiple_notebooks, :open_tab
+
+ def execute
+ current_notebook = tab.notebook
+ i = win.notebooks.index current_notebook
+
+ target_notebook = win.notebooks[ (i + 1) % win.notebooks.length ]
+ target_notebook.grab_tab_from(current_notebook, tab)
+ tab.focus
+ end
+ end
+
+ end
+end
105 plugins/application/lib/application/commands/tab_commands.rb
View
@@ -0,0 +1,105 @@
+module Redcar
+ class Application
+
+ class SwitchTabDownCommand < TabCommand
+
+ def execute
+ win.focussed_notebook.switch_down
+ end
+ end
+
+ class SwitchTabUpCommand < TabCommand
+
+ def execute
+ win.focussed_notebook.switch_up
+ end
+ end
+
+ class MoveTabUpCommand < TabCommand
+
+ def execute
+ win.focussed_notebook.move_up
+ end
+ end
+
+ class MoveTabDownCommand < TabCommand
+
+ def execute
+ win.focussed_notebook.move_down
+ end
+ end
+
+ class CloseTabCommand < TabCommand
+ def initialize(tab=nil)
+ @tab = tab
+ end
+
+ def tab
+ @tab || super
+ end
+
+ def execute
+ Redcar.app.call_on_plugins(:close_tab_guard, tab) do |guard|
+ return unless guard
+ end
+ close_tab
+ @tab = nil
+ end
+
+ private
+
+ def close_tab
+ win = tab.notebook.window
+ tab.close
+ # this will break a lot of features:
+ #if win.all_tabs.empty? and not Project::Manager.in_window(win)
+ # win.close
+ #end
+ end
+ end
+
+ class CloseAll < Redcar::Command
+ def execute
+ window = Redcar.app.focussed_window
+ tabs = window.all_tabs
+ tabs.each do |t|
+ CloseTabCommand.new(t).run
+ end
+ end
+ end
+
+ class CloseOthers < Redcar::Command
+ def execute
+ window = Redcar.app.focussed_window
+ current_tab = Redcar.app.focussed_notebook_tab
+ tabs = window.all_tabs
+ tabs.each do |t|
+ unless t == current_tab
+ CloseTabCommand.new(t).run
+ end
+ end
+ end
+ end
+
+ # define commands from SelectTab1Command to SelectTab9Command
+ (1..9).each do |tab_num|
+ const_set("SelectTab#{tab_num}Command", Class.new(Redcar::TabCommand)).class_eval do
+ define_method :execute do
+ notebook = Redcar.app.focussed_window_notebook
+ notebook.tabs[tab_num-1].focus if notebook.tabs[tab_num-1]
+ end
+ end
+ end
+ end
+end
+
+
+
+
+
+
+
+
+
+
+
117 plugins/application/lib/application/commands/treebook_commands.rb
View
@@ -0,0 +1,117 @@
+module Redcar
+ class Application
+
+ class CloseTreeCommand < TreeCommand
+ def execute
+ win = Redcar.app.focussed_window
+ if win and treebook = win.treebook
+ if tree = treebook.focussed_tree
+ treebook.remove_tree(tree)
+ end
+ end
+ end
+ end
+
+ class ToggleTreesCommand < TreeCommand
+ def execute
+ win = Redcar.app.focussed_window
+ if win and treebook = win.treebook
+ if win.trees_visible?
+ win.set_trees_visible(false)
+ else
+ win.set_trees_visible(true)
+ end
+ end
+ end
+ end
+
+ class SwitchTreeDownCommand < TreeCommand
+
+ def execute
+ win = Redcar.app.focussed_window
+ win.treebook.switch_down
+ end
+ end
+
+ class SwitchTreeUpCommand < TreeCommand
+
+ def execute
+ win = Redcar.app.focussed_window
+ win.treebook.switch_up
+ end
+ end
+
+ class TreebookWidthCommand < Command
+ sensitize :open_trees
+
+ def increment
+ raise "Please implement me!"
+ end
+
+ def execute
+ if win = Redcar.app.focussed_window
+ if increment > 0
+ win.adjust_treebook_width(true)
+ else
+ win.adjust_treebook_width(false)
+ end
+ end
+ end
+ end
+
+ class IncreaseTreebookWidthCommand < TreebookWidthCommand
+ def increment
+ 1
+ end
+ end
+
+ class DecreaseTreebookWidthCommand < TreebookWidthCommand
+ def decrement
+ -1
+ end
+ end
+
+ class OpenTreeFinderCommand < TreeCommand
+ def execute
+ if win = Redcar.app.focussed_window
+ if trees = win.treebook.trees and trees.any?
+ titles = []
+ trees.each {|t| titles << t.tree_mirror.title}
+ dialog = TreeFuzzyFilter.new(win,titles)
+ dialog.open
+ end
+ end
+ end
+
+ class TreeFuzzyFilter < FilterListDialog
+
+ def initialize(win,titles)
+ super()
+ @win = win
+ @titles = titles
+ end
+
+ def selected(text,ix)
+ if tree = @win.treebook.trees.detect do |tree|
+ tree.tree_mirror.title == text
+ end
+ if @win.treebook.focussed_tree == tree
+ @win.set_trees_visible(true) if not @win.trees_visible?
+ else
+ @win.treebook.focus_tree(tree)
+ end
+ tree.focus
+ close
+ end
+ end
+
+ def update_list(filter)
+ @titles.select do |t|
+ t.downcase.include?(filter.downcase)
+ end
+ end
+ end
+ end
+
+ end
+end
33 .../lib/application/commands/close_window_command.rb → ...ation/lib/application/commands/window_commands.rb
View
@@ -1,5 +1,32 @@
module Redcar
class Application
+ class NewWindowCommand < Command
+
+ def initialize(title=nil)
+ @title = title
+ end
+
+ def execute
+ window = Redcar.app.new_window
+ window.title = @title if @title
+ end
+ end
+
+ class FocusWindowCommand < Command
+ def initialize(window=nil)
+ @window = window
+ end
+
+ def execute
+ win.focus
+ @window = nil
+ end
+
+ def win
+ @window || super
+ end
+ end
+
class CloseWindowCommand < Command
def initialize(window=nil)
@window = window
@@ -31,5 +58,11 @@ def win
end
end
+ class ToggleFullscreen < Command
+ def execute
+ Redcar.app.focussed_window.fullscreen = !Redcar.app.focussed_window.fullscreen
+ end
+ end
+
end
end
4 plugins/tree/lib/tree.rb → plugins/application/lib/application/tree.rb
View
@@ -1,8 +1,4 @@
-require 'tree/controller'
-require 'tree/command'
-require 'tree/mirror'
-
module Redcar
# Pass classes implementing Redcar::Tree::Mirror and
# Redcar::Tree::Controller to Tree#new to create a tree. Pass to
0  plugins/tree/lib/tree/command.rb → plugins/application/lib/application/tree/command.rb
View
File renamed without changes
0  plugins/tree/lib/tree/controller.rb → ...ns/application/lib/application/tree/controller.rb
View
File renamed without changes
0  plugins/tree/lib/tree/mirror.rb → plugins/application/lib/application/tree/mirror.rb
View
File renamed without changes
4 plugins/core/lib/core.rb
View
@@ -1,7 +1,6 @@
require 'fileutils'
-require "core/logger"
require "core/reentry_helpers"
require "core/controller"
require "core/gui"
@@ -32,10 +31,7 @@ def self.tmp_dir
end
class Core
- include HasLogger
-
def self.loaded
- Core::Logger.init
unless File.exist?(Redcar.user_dir)
FileUtils.mkdir(Redcar.user_dir)
end
6 plugins/core/lib/core/gui.rb
View
@@ -8,8 +8,6 @@ def all
end
end
- include Redcar::Core::HasLogger
-
attr_reader :name
# Initialize a new named gui.
@@ -32,10 +30,10 @@ def register_event_loop(event_loop)
# Starts the event loop for this gui.
def start
if ARGV.include?("--quit-immediately")
- logger.info("Quitting straight away")
+ Redcar.log.info("Quitting straight away")
exit
else
- logger.info("Starting event loop")
+ Redcar.log.info("Starting event loop")
@event_loop.start
end
end
28 plugins/core/lib/core/logger.rb
View
@@ -1,28 +0,0 @@
-require 'logger'
-
-module Redcar
- def self.logger
- Core::Logger.root_logger
- end
-
- class Core
- module HasLogger
- def logger
- Core::Logger.root_logger
- end
- end
-
- module Logger
- def self.init
- level = ENV["REDCAR_LOG"] || "error"
- root_logger.level = ::Logger::ERROR
-# appender = Logging::Appenders.stdout(:level => level)
-# root_logger.add_appenders(appender)
- end
-
- def self.root_logger
- @logger ||= ::Logger.new(STDOUT)
- end
- end
- end
-end
35 plugins/core/lib/core/plugin/storage.rb
View
@@ -12,7 +12,7 @@ def self.storage_dir
# Open a storage file or create it if it doesn't exist.
#
- # @param [String] a (short) name, should be suitable for use as a filename
+ # @param [String] name a (short) name, should be suitable for use as a filename
def initialize(name)
@name = name
unless File.exists?(Storage.storage_dir)
@@ -60,6 +60,7 @@ def []=(key, value)
value
end
+ # Set a default value for a key and save it to disk
def set_default(key, value)
unless @storage.has_key?(key)
self[key] = value
@@ -67,6 +68,8 @@ def set_default(key, value)
value
end
+ # Get all keys in the storage
+ # @return [Array] the Array with all keys
def keys
@storage.keys
end
@@ -81,6 +84,36 @@ def update_timestamp
@last_modified_time = File.stat(path()).mtime
end
end
+
+ # A Storage which is used by multiple plugins. This kind of storage can only
+ # contain arrays, because otherwise plugins could not set their defaults as
+ # addition to the existing ones of other plugins.
+ class SharedStorage < Plugin::Storage
+ # Set a default value for a key or update it, if it already exists
+ def set_or_update_default(key, value)
+ if @storage.has_key?(key)
+ update_default(key, value)
+ else
+ if value.instance_of? Array
+ set_default(key, value)
+ else
+ set_default(key, [value])
+ end
+ end
+ @storage[key].uniq!
+ value
+ end
+
+ private
+
+ def update_default(key, value)
+ if value.instance_of? Array
+ self[key] = self[key] + value
+ else
+ self[key] << value
+ end
+ end
+ end
end
end
49 plugins/core/spec/core/shared_storage_spec.rb
View
@@ -0,0 +1,49 @@
+
+require File.join(File.dirname(__FILE__), "..", "spec_helper")
+
+describe Redcar::Plugin::SharedStorage do
+
+ before do
+ remove_test_files
+ end
+
+ after do
+ remove_test_files
+ end
+
+ def remove_test_files
+ FileUtils.rm_rf(Redcar::Plugin::Storage.new('test_shared_storage').send(:path))
+ end
+
+ it "should set the default when it is not already set and the value is an Array" do
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', ['b', 'c'])
+ storage['a'].should == ['b', 'c']
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage['a'].should == ['b', 'c']
+ end
+
+ it "should set the default when it is not already and the value is not an Array" do
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', 'b')
+ storage['a'].should == ['b']
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage['a'].should == ['b']
+ end
+
+ it "should update the default when it is already set and the value is an Array" do
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', 'b')
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', 'c')
+ storage['a'].should == ['b', 'c']
+ end
+
+ it "should update the default when it is already set and the value is not an Array" do
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', 'b')
+ storage = Redcar::Plugin::SharedStorage.new("test_shared_storage")
+ storage.set_or_update_default('a', ['c', 'd'])
+ storage['a'].should == ['b', 'c', 'd']
+ end
+end
1  plugins/edit_view_swt/lib/edit_view_swt.rb
View
@@ -70,6 +70,7 @@ def self.start
end
def self.load_textmate_assets
+ Redcar.log.info("loaded JavaMateView #{JavaMateView::MateText.VERSION}")
Redcar.log.benchmark("load textmate assets") do
load_textmate_assets_from_dir(Redcar.root + "/plugins/textmate/vendor/redcar-bundles")
Redcar.plugin_manager.loaded_plugins.each do |plugin|
125 plugins/file_parser/lib/file_parser.rb
View
@@ -1,125 +0,0 @@
-require 'pathname'
-
-module Redcar
- class FileParser
-
- attr_accessor :root_path, :excluded_dirs, :excluded_files, :excluded_patterns, :skip_types
-
- def self.measure(message, &block)
- require 'benchmark'
- r = nil
- b = Benchmark.measure { r = yield }
- puts message + ": " + b.to_s
- r
- end
-
- def initialize(root_path, options = {})
- self.root_path = root_path.to_s
- self.excluded_dirs = options['excluded_dirs'] || ['.git', '.svn', '.redcar']
- self.excluded_files = options['excluded_files'] || []
- self.excluded_patterns = options['excluded_patterns'] || [/tags$/, /\.log$/]
- self.skip_types = options['skip_types'] || [:executable, :mountpoint, :symlink, :zero]
- end
-
- def directory?(pathname)
- f = java.io.File.new(pathname.path.to_java)
- f.directory?
- end
-
- def each_file(&block)
- file_index, excluded_paths = 0, []
- structure = Dir.glob("#{root_path}/**/*", File::FNM_DOTMATCH)
- structure.sort.each do |path|
- fullpath = File.expand_path(path)
- next if excluded_paths.any? { |ep| fullpath =~ /^#{Regexp.escape(ep)}(\/|$)/ }
- path = Pathname.new(fullpath)
- is_excluded_pattern = excluded_patterns.any? { |pattern| fullpath =~ pattern }
- if directory?(path)
- excluded_paths << path if excluded_dirs.include?(path.basename.to_s) || is_excluded_pattern
- else
- skipped = skip_types.find { |st| path.send("#{st}?") }
- excluded = excluded_files.include?(path.basename.to_s) || is_excluded_pattern
- unless !path.readable? || path.read.is_binary_data? || skipped || excluded
- yield(FileResult.new(path, file_index))
- file_index += 1
- end
- end
- end
- end
-
- def each_line(&block)
- each_file do |file|
- file.each_line do |line|
- yield(line)
- end
- end
- end
-
- class FileResult
-
- attr_reader :path, :index, :lines, :lines_size
-
- def initialize(path, index)
- @path, @index = path, index
- @lines = @path.read.split("\n")
- @lines_size = @lines.size
- end
-
- def num
- index + 1
- end
-
- def name
- @project_path ||= Project::Manager.focussed_project.path
- path.realpath.to_s.gsub("#{@project_path}/", '')
- end
-
- def each_line(&block)
- lines.each_with_index do |text, index|
- yield(LineResult.new(self, index, text))
- end
- end
-
- def inspect
- "#<FileResult path=#{path.to_s} index=#{index} lines=#{lines.size}>"
- end
-
- end
-
- class LineResult
-
- attr_reader :file, :index, :text
-
- def initialize(file, index, text)
- @file, @index, @text = file, index, text
- end
-
- def num
- index + 1
- end
-
- def context(amount = 5)
- from, to = (index - amount), (index + amount)
- from = 0 if from < 0
- last_line_index = (file.lines_size - 1)
- to = last_line_index if to > last_line_index
-
- before, after, range = Array.new, Array.new, (from..to)
- lines = file.lines[range]
- range.each_with_index do |ri, li|
- next if ri == index
- line = LineResult.new(file, ri, lines[li])
- (ri < index) ? (before << line) : (after << line)
- end
-
- { :before => before, :after => after }
- end
-
- def inspect
- "#<LineResult index=#{index} file=#{file.to_s}>"
- end
-
- end
-
- end
-end
7 plugins/file_parser/plugin.rb
View
@@ -1,7 +0,0 @@
-Plugin.define do
- name "file_parser"
- version "0.2.0"
-
- object "Redcar::FileParser"
- file "lib", "file_parser"
-end
2  plugins/html_view/lib/html_view.rb
View
@@ -41,7 +41,7 @@ def self.storage
storage
end
end
-
+
def self.show_browser_bar?
if win = Redcar.app.focussed_window and
win.speedbar and win.speedbar.is_a?(BrowserBar)
2  plugins/project/lib/project/commands.rb
View
@@ -179,7 +179,7 @@ def initialize(tab=nil, path=nil)
def execute
path = get_path
if path
- if File.writable? path
+ if File.exists?(path) ? File.writable?(path) : File.writable?(File.dirname(path))
contents = tab.edit_view.document.to_s
new_mirror = FileMirror.new(path)
new_mirror.commit(contents)
2  plugins/project/lib/project/file_list.rb
View
@@ -79,4 +79,4 @@ def find(*paths)
end
end
end
-end
+end
15 plugins/project/lib/project/find_file_dialog.rb
View
@@ -1,18 +1,25 @@
require 'set'
module Redcar
- class Project
+ class Project
class FindFileDialog < FilterListDialog
def self.storage
@storage ||= begin
storage = Plugin::Storage.new('find_file_dialog')
storage.set_default('ignore_file_patterns', false)
- storage.set_default('ignore_files_that_match_these_regexes', [])
- storage.set_default('ignore_files_that_match_these_regexes_example_for_reference', [/.*\.class/i])
storage
end
end
+
+ def self.shared_storage
+ @shared_storage ||= begin
+ storage = Plugin::SharedStorage.new('shared__ignored_files')
+ storage.set_or_update_default('ignored_file_patterns', [])
+ storage.set_or_update_default('not_hidden_files', [])
+ storage.save
+ end
+ end
attr_reader :project
@@ -91,7 +98,7 @@ def display_path(path, first_remove_this_prefix = nil)
end
def ignore_regexes
- self.class.storage['ignore_files_that_match_these_regexes']
+ self.class.shared_storage['ignored_file_patterns']
end
def ignore_file?(filename)
58 plugins/project/lib/project/manager.rb
View
@@ -96,32 +96,42 @@ def self.storage
storage = Plugin::Storage.new('project_plugin')
storage.set_default('reveal_files_in_project_tree',true)
storage.set_default('reveal_files_only_when_tree_is_focussed',true)
- storage.set_default('hidden_files_pattern', '(^\.|\.rbc$)')
- storage.set_default('not_hidden_files', %w(.gitignore .gemtest))
storage
end
end
+
+ def self.shared_storage
+ @shared_storage ||= begin
+ storage = Plugin::SharedStorage.new('shared__ignored_files')
+ storage.set_or_update_default('ignored_file_patterns', [/^\./, /\.rbc$/])
+ storage.set_or_update_default('not_hidden_files', ['.gitignore', '.gemtest'])
+ storage.save
+ end
+ end
def self.hidden_files_pattern
- Regexp.new storage['hidden_files_pattern']
+ ignored_file_patterns
+ end
+
+ def self.ignored_file_patterns
+ shared_storage['ignored_file_patterns']
end
def self.not_hidden_files
- Array storage['not_hidden_files']
+ shared_storage['not_hidden_files']
end
def self.hide_file?(file)
file = File.basename(file)
- !not_hidden_files.include?(file) and file =~ hidden_files_pattern
+ return false if not_hidden_files.include? file
+ ignored_file_patterns.any? { |re| file =~ re }
end
- # Adds a pattern to the hidden_files_pattern option
- #
+ # Adds a pattern to the ignored_file_patterns option
+ #
# @param [String] file_pattern pattern of the file
def self.add_hide_file_pattern(file_pattern)
- old_pattern = hidden_files_pattern
- new_pattern = old_pattern.source.chop + '|' + file_pattern + ')'
- storage['hidden_files_pattern'] = new_pattern
+ shared_storage['ignored_file_patterns'] = shared_storage['ignored_file_patterns'] << Regexp.new(file_pattern)
end
def self.reveal_files?
@@ -439,6 +449,32 @@ def self.menus
end
end
end
+
+ def self.close_tab_guard(tab)
+ if tab.respond_to?(:edit_view) && tab.edit_view.document.modified?
+ tab.focus
+ result = Application::Dialog.message_box(
+ "This tab has unsaved changes. \n\nSave before closing?",
+ :buttons => :yes_no_cancel
+ )
+ case result
+ when :yes
+ # check if the tab was saved properly,
+ # it would return false for example if the permission is not granted
+ if Project::FileSaveCommand.new(tab).run
+ true
+ else
+ false
+ end
+ when :no
+ true
+ when :cancel
+ false
+ end
+ else
+ true
+ end
+ end
# Uses our own context menu hook to provide context menu entries
# @return [Menu]
@@ -455,7 +491,7 @@ def self.project_context_menus(tree, node, controller)
Menu::Builder.build do
group(:priority => :first) do
item("New File") { controller.new_file(tree, node) }
- item("New Directory") { controller.new_dir(tree, node) }
+ item("New Directory") { controller.new_dir(tree, node) }
end
separator
sub_menu "Open Directory" do
3  plugins/project/plugin.rb
View
@@ -7,6 +7,5 @@
dependencies "edit_view", ">0",
"HTML View", ">0",
"connection_manager", ">0",
- "application", ">=1.1",
- "tree", ">=0"
+ "application", ">=1.1"
end
16 plugins/project_search/lib/project_search.rb
View
@@ -33,8 +33,8 @@ def self.keymaps
def self.toolbars
Redcar::ToolBar::Builder.build do
- item "Search", :command => WordSearchCommand,
- :icon => File.join(Redcar::ICONS_DIRECTORY, "application-search-result.png"),
+ item "Search", :command => WordSearchCommand,
+ :icon => File.join(Redcar::ICONS_DIRECTORY, "application-search-result.png"),
:barname => :project
end
end
@@ -54,8 +54,16 @@ def self.storage
end
end
- Lucene::Config.use do |config|
- config[:store_on_file] = true
+ def self.shared_storage
+ @shared_storage ||= begin
+ storage = Redcar::Plugin::SharedStorage.new('shared__ignored_files')
+ storage.set_or_update_default('ignored_file_patterns', [/tags$/, /\.log$/])
+ storage.save
+ end
+ end
+
+ Lucene::Config.use do |config|
+ config[:store_on_file] = true
config[:storage_path] = ""
config[:id_field] = :id
end
598 plugins/redcar/redcar.rb
View
@@ -67,28 +67,6 @@ def execute
end
end
- class NewNotebookCommand < Command
-# sensitize :single_notebook
-
- def execute
- #unless win.notebooks.length > 1
- win.create_notebook
- # end
- end
- end
-
- class NewWindowCommand < Command
-
- def initialize(title=nil)
- @title = title
- end
-
- def execute
- window = Redcar.app.new_window
- window.title = @title if @title
- end
- end
-
class GenerateWindowsMenu < Command
def initialize(builder)
@builder = builder
@@ -123,9 +101,15 @@ def execute
book.tabs.each_with_index do |tab,i|
num = i + 1
if num < 10
- @builder.item "Tab #{num}: #{trim(tab.title)}", :type => :radio, :active => (tab == focussed_tab), :command => Top.const_get("SelectTab#{num}Command")
+ @builder.item("Tab #{num}: #{trim(tab.title)}",
+ :type => :radio,
+ :active => (tab == focussed_tab),
+ :command => Redcar::Application.const_get("SelectTab#{num}Command")
+ )
else
- @builder.item("Tab #{num}: #{trim(tab.title)}", :type => :radio, :active => (tab == focussed_tab)) {tab.focus}
+ @builder.item("Tab #{num}: #{trim(tab.title)}",
+ :type => :radio,
+ :active => (tab == focussed_tab)) { tab.focus }
end
end
if book = win.nonfocussed_notebook and book.tabs.any?
@@ -139,130 +123,6 @@ def execute
end
end
- class FocusWindowCommand < Command
- def initialize(window=nil)
- @window = window
- end
-
- def execute
- win.focus
- @window = nil
- end
-
- def win
- @window || super
- end
- end
-
- class RotateNotebooksCommand < Command
- sensitize :multiple_notebooks
-
- def execute
- win.rotate_notebooks
- end
- end
-
- class CloseNotebookCommand < Command
- sensitize :multiple_notebooks
-
- def execute
- unless win.notebooks.length == 1
- win.close_notebook
- end
- end
- end
-
- class SwitchNotebookCommand < Command
- sensitize :multiple_notebooks, :other_notebook_has_tab
-
- def execute
- new_notebook = win.nonfocussed_notebook
- if new_notebook.focussed_tab
- new_notebook.focussed_tab.focus
- end
- end
- end
-
- class MoveTabToOtherNotebookCommand < Command
- sensitize :multiple_notebooks, :open_tab
-
- def execute
- current_notebook = tab.notebook
- i = win.notebooks.index current_notebook
-
- target_notebook = win.notebooks[ (i + 1) % win.notebooks.length ]
- target_notebook.grab_tab_from(current_notebook, tab)
- tab.focus
- end
- end
-
- class OpenTreeFinderCommand < TreeCommand
-
- def execute
- if win = Redcar.app.focussed_window
- if trees = win.treebook.trees and trees.any?
- titles = []
- trees.each {|t| titles << t.tree_mirror.title}
- dialog = TreeFuzzyFilter.new(win,titles)
- dialog.open
- end
- end
- end
-
- class TreeFuzzyFilter < FilterListDialog
-
- def initialize(win,titles)
- super()
- @win = win
- @titles = titles
- end
-
- def selected(text,ix)
- if tree = @win.treebook.trees.detect do |tree|
- tree.tree_mirror.title == text
- end
- if @win.treebook.focussed_tree == tree
- @win.set_trees_visible(true) if not @win.trees_visible?
- else
- @win.treebook.focus_tree(tree)
- end
- tree.focus
- close
- end
- end
-
- def update_list(filter)
- @titles.select do |t|
- t.downcase.include?(filter.downcase)
- end
- end
- end
- end
-
- class CloseTreeCommand < TreeCommand
- def execute
- win = Redcar.app.focussed_window
- if win and treebook = win.treebook
- if tree = treebook.focussed_tree
- treebook.remove_tree(tree)
- end
- end
- end
- end
-
- class ToggleTreesCommand < TreeCommand
- def execute
- win = Redcar.app.focussed_window
- if win and treebook = win.treebook
- if win.trees_visible?
- win.set_trees_visible(false)
- else
- win.set_trees_visible(true)
- end
- end
- end
- end
-
class AboutCommand < Command
def execute
new_tab = Top::NewCommand.new.run
@@ -299,139 +159,7 @@ def execute
Application::Dialog.tool_tip(tab.edit_view.document.cursor_scope.gsub(" ", "\n"), :cursor)
end
end
-
- class CloseTabCommand < TabCommand
- def initialize(tab=nil)
- @tab = tab
- end
-
- def tab
- @tab || super
- end
-
- def execute
- if tab.is_a?(EditTab)
- if tab.edit_view.document.modified?
- tab.focus
- result = Application::Dialog.message_box(
- "This tab has unsaved changes. \n\nSave before closing?",
- :buttons => :yes_no_cancel
- )
- case result
- when :yes
- # check if the tab was saved properly,
- # it would return false for example if the permission is not granted
- if Project::FileSaveCommand.new(tab).run
- close_tab
- end
- when :no
- close_tab
- when :cancel
- end
- else
- close_tab
- end
- elsif tab.is_a?(HtmlTab)
- if tab.html_view.controller and message = tab.html_view.controller.ask_before_closing
- tab.focus
- result = Application::Dialog.message_box(
- message,
- :buttons => :yes_no_cancel
- )
- case result
- when :yes
- close_tab
- when :no
- close_tab
- when :cancel
- end
- else
- close_tab
- end
- else
- close_tab
- end
- @tab = nil
- end
-
- private
-
- def close_tab
- win = tab.notebook.window
- tab.close
- # this will break a lot of features:
- #if win.all_tabs.empty? and not Project::Manager.in_window(win)
- # win.close
- #end
- end
- end
-
- class CloseAll < Redcar::Command
- def execute
- window = Redcar.app.focussed_window
- tabs = window.all_tabs
- tabs.each do |t|
- Redcar::Top::CloseTabCommand.new(t).run
- end
- end
- end
-
- class CloseOthers < Redcar::Command
- def execute
- window = Redcar.app.focussed_window
- current_tab = Redcar.app.focussed_notebook_tab
- tabs = window.all_tabs
- tabs.each do |t|
- unless t == current_tab
- Redcar::Top::CloseTabCommand.new(t).run
- end
- end
- end
- end
-
- class SwitchTreeDownCommand < TreeCommand
-
- def execute
- win = Redcar.app.focussed_window
- win.treebook.switch_down
- end
- end
-
- class SwitchTreeUpCommand < TreeCommand
-
- def execute
- win = Redcar.app.focussed_window
- win.treebook.switch_up
- end
- end
-
- class SwitchTabDownCommand < TabCommand
-
- def execute
- win.focussed_notebook.switch_down
- end
- end
-
- class SwitchTabUpCommand < TabCommand
-
- def execute
- win.focussed_notebook.switch_up
- end
- end
-
- class MoveTabUpCommand < TabCommand
-
- def execute
- win.focussed_notebook.move_up
- end
- end
-
- class MoveTabDownCommand < TabCommand
-
- def execute
- win.focussed_notebook.move_down
- end
- end
+
class UndoCommand < EditTabCommand
sensitize :undoable
@@ -723,22 +451,6 @@ def execute
end
end
- class DialogExample < Redcar::Command
- def execute
- builder = Menu::Builder.new do
- item("Foo") { p :foo }
- item("Bar") { p :bar }
- separator
- sub_menu "Baz" do
- item("Qux") { p :qx }
- item("Quux") { p :quux }
- item("Corge") { p :corge }
- end
- end
- win.popup_menu(builder.menu)
- end
- end
-
class GotoLineCommand < Redcar::EditTabCommand
class Speedbar < Redcar::Speedbar
@@ -777,79 +489,6 @@ def execute
end
end
- class TreebookWidthCommand < Command
- sensitize :open_trees
-
- def increment
- raise "Please implement me!"
- end
-
- def execute
- if win = Redcar.app.focussed_window
- if increment > 0
- win.adjust_treebook_width(true)
- else
- win.adjust_treebook_width(false)
- end
- end
- end
- end
-
- ["In","De"].each do |prefix|
- const_set("#{prefix}creaseTreebookWidthCommand", Class.new(TreebookWidthCommand)).class_eval do
- define_method :increment do
- prefix == "In" ? 1 : -1
- end
- end
- end
-
- class EnlargeNotebookCommand < Command
- sensitize :multiple_notebooks
- def index
- raise "Please define me!"
- end
-
- def execute
- if win = Redcar.app.focussed_window
- win.enlarge_notebook(index)
- end
- end
- end
-
- ["First","Second"].each do |book|
- const_set("Enlarge#{book}NotebookCommand", Class.new(EnlargeNotebookCommand)).class_eval do
- define_method :index do
- book == "First" ? 0 : 1
- end
- end
- end
-
- # define commands from SelectTab1Command to SelectTab9Command
- (1..9).each do |tab_num|
- const_set("SelectTab#{tab_num}Command", Class.new(Redcar::TabCommand)).class_eval do
- define_method :execute do
- notebook = Redcar.app.focussed_window_notebook
- notebook.tabs[tab_num-1].focus if notebook.tabs[tab_num-1]
- end
- end
- end
-
- class ResetNotebookWidthsCommand < Command
- sensitize :multiple_notebooks
-
- def execute
- if win = Redcar.app.focussed_window
- win.reset_notebook_widths
- end
- end
- end
-
- class ToggleFullscreen < Command
- def execute
- Redcar.app.focussed_window.fullscreen = !Redcar.app.focussed_window.fullscreen
- end
- end
-
class ToggleInvisibles < Redcar::EditTabCommand
def execute
EditView.show_invisibles = !EditView.show_invisibles?
@@ -862,14 +501,6 @@ def execute
end
end
- class ToggleToolbar < Command
-
- def execute
- Redcar.app.toggle_show_toolbar
- Redcar.app.refresh_toolbar!
- end
- end
-
class SelectNewFont < EditTabCommand
def execute
Redcar::EditView::SelectFontDialog.new.open
@@ -932,8 +563,8 @@ def execute
def self.keymaps
osx = Redcar::Keymap.build("main", :osx) do
link "Cmd+N", NewCommand
- link "Cmd+Shift+N", NewNotebookCommand
- link "Cmd+Alt+N", NewWindowCommand
+ link "Cmd+Shift+N", Application::NewNotebookCommand
+ link "Cmd+Alt+N", Application::NewWindowCommand
link "Cmd+O", Project::FileOpenCommand
link "Cmd+U", Project::FileReloadCommand
link "Cmd+Shift+O", Project::DirectoryOpenCommand
@@ -941,9 +572,9 @@ def self.keymaps
#link "Cmd+Ctrl+O", Project::OpenRemoteCommand
link "Cmd+S", Project::FileSaveCommand
link "Cmd+Shift+S", Project::FileSaveAsCommand
- link "Cmd+W", CloseTabCommand
+ link "Cmd+W", Application::CloseTabCommand
link "Cmd+Shift+W", Application::CloseWindowCommand
- link "Alt+Shift+W", CloseTreeCommand
+ link "Alt+Shift+W", Application::CloseTreeCommand
link "Cmd+Q", Application::QuitCommand
#link "Cmd+Return", MoveNextLineCommand
@@ -983,29 +614,28 @@ def self.keymaps
link "Ctrl+Shift+^", SortLinesCommand
link "Cmd+T", Project::FindFileCommand
- link "Cmd+Shift+Alt+O", MoveTabToOtherNotebookCommand
- link "Cmd+Alt+O", SwitchNotebookCommand
- link "Alt+Shift+[", SwitchTreeUpCommand
- link "Alt+Shift+]", SwitchTreeDownCommand
- link "Cmd+Shift+[", SwitchTabDownCommand
- link "Cmd+Shift+]", SwitchTabUpCommand
- link "Ctrl+Shift+[", MoveTabDownCommand
- link "Ctrl+Shift+]", MoveTabUpCommand
- link "Cmd+Shift++", ToggleFullscreen
- link "Cmd+Shift+T", OpenTreeFinderCommand
- link "Alt+Shift+J", IncreaseTreebookWidthCommand
- link "Alt+Shift+H", DecreaseTreebookWidthCommand
- link "Cmd+Shift+>", EnlargeFirstNotebookCommand
- link "Cmd+Shift+<", EnlargeSecondNotebookCommand
- link "Cmd+Shift+L", ResetNotebookWidthsCommand
- link "Cmd+Shift+:", RotateNotebooksCommand
- link "Alt+Shift+N", CloseNotebookCommand
+ link "Cmd+Shift+Alt+O", Application::MoveTabToOtherNotebookCommand
+ link "Cmd+Alt+O", Application::SwitchNotebookCommand
+ link "Alt+Shift+[", Application::SwitchTreeUpCommand
+ link "Alt+Shift+]", Application::SwitchTreeDownCommand
+ link "Cmd+Shift+[", Application::SwitchTabDownCommand
+ link "Cmd+Shift+]", Application::SwitchTabUpCommand
+ link "Ctrl+Shift+[", Application::MoveTabDownCommand
+ link "Ctrl+Shift+]", Application::MoveTabUpCommand
+ link "Cmd+Shift++", Application::ToggleFullscreen
+ link "Cmd+Shift+T", Application::OpenTreeFinderCommand
+ link "Alt+Shift+J", Application::IncreaseTreebookWidthCommand
+ link "Alt+Shift+H", Application::DecreaseTreebookWidthCommand
+ link "Cmd+Shift+>", Application::EnlargeNotebookCommand
+ link "Cmd+Shift+L", Application::ResetNotebookWidthsCommand
+ link "Cmd+Shift+:", Application::RotateNotebooksCommand
+ link "Alt+Shift+N", Application::CloseNotebookCommand
link "Cmd+Alt+I", ToggleInvisibles
link "Cmd++", IncreaseFontSize
link "Cmd+-", DecreaseFontSize
link "Ctrl+Shift+P", PrintScopeCommand
- link "Cmd+Shift+H", ToggleTreesCommand
+ link "Cmd+Shift+H", Application::ToggleTreesCommand
# link "Cmd+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
@@ -1014,24 +644,24 @@ def self.keymaps
# map SelectTab<number>Command
(1..9).each do |tab_num|
- link "Cmd+#{tab_num}", Top.const_get("SelectTab#{tab_num}Command")
+ link "Cmd+#{tab_num}", Application.const_get("SelectTab#{tab_num}Command")
end
end
linwin = Redcar::Keymap.build("main", [:linux, :windows]) do
link "Ctrl+N", NewCommand
- link "Ctrl+Shift+N", NewNotebookCommand
- link "Ctrl+Alt+N", NewWindowCommand
+ link "Ctrl+Shift+N", Application::NewNotebookCommand
+ link "Ctrl+Alt+N", Application::NewWindowCommand
link "Ctrl+O", Project::FileOpenCommand
link "Ctrl+Shift+O", Project::DirectoryOpenCommand
link "Ctrl+Alt+Shift+P", Project::FindRecentCommand
#link "Alt+Shift+O", Project::OpenRemoteCommand
link "Ctrl+S", Project::FileSaveCommand
link "Ctrl+Shift+S", Project::FileSaveAsCommand
- link "Ctrl+W", CloseTabCommand
+ link "Ctrl+W", Application::CloseTabCommand
link "Ctrl+Shift+W", Application::CloseWindowCommand
- link "Alt+Shift+W", CloseTreeCommand
+ link "Alt+Shift+W", Application::CloseTreeCommand
link "Ctrl+Q", Application::QuitCommand
link "Ctrl+Enter", MoveNextLineCommand
@@ -1074,28 +704,26 @@ def self.keymaps
link "Ctrl+Shift+^", SortLinesCommand
link "Ctrl+T", Project::FindFileCommand
- link "Ctrl+Shift+Alt+O", MoveTabToOtherNotebookCommand
+ link "Ctrl+Shift+Alt+O", Application::MoveTabToOtherNotebookCommand
link "Ctrl+Shift+P", PrintScopeCommand
- link "Ctrl+Alt+O", SwitchNotebookCommand
- link "Ctrl+Shift+H", ToggleTreesCommand
- link "Alt+Page Up", SwitchTreeUpCommand
- link "Alt+Page Down", SwitchTreeDownCommand
- link "Ctrl+Page Up", SwitchTabDownCommand
- link "Ctrl+Page Down", SwitchTabUpCommand
- link "Ctrl+Shift+Page Up", MoveTabDownCommand
- link "Ctrl+Shift+Page Down", MoveTabUpCommand
- link "Ctrl+Shift+T", OpenTreeFinderCommand
- link "Alt+Shift+J", IncreaseTreebookWidthCommand
- link "Alt+Shift+H", DecreaseTreebookWidthCommand
- link "Ctrl+Shift+>", EnlargeFirstNotebookCommand
- link "Ctrl+Shift+<", EnlargeSecondNotebookCommand
- link "Ctrl+Shift+L", ResetNotebookWidthsCommand
- link "Ctrl+Shift+:", RotateNotebooksCommand
- link "Alt+Shift+N", CloseNotebookCommand
- # link "Ctrl+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
- link "F11", ToggleFullscreen
+ link "Ctrl+Alt+O", Application::SwitchNotebookCommand
+ link "Ctrl+Shift+H", Application::ToggleTreesCommand
+ link "Alt+Page Up", Application::SwitchTreeUpCommand
+ link "Alt+Page Down", Application::SwitchTreeDownCommand
+ link "Ctrl+Page Up", Application::SwitchTabDownCommand
+ link "Ctrl+Page Down", Application::SwitchTabUpCommand
+ link "Ctrl+Shift+Page Up", Application::MoveTabDownCommand
+ link "Ctrl+Shift+Page Down", Application::MoveTabUpCommand
+ link "Ctrl+Shift+T", Application::OpenTreeFinderCommand
+ link "Alt+Shift+J", Application::IncreaseTreebookWidthCommand
+ link "Alt+Shift+H", Application::DecreaseTreebookWidthCommand
+ link "Ctrl+Shift+>", Application::EnlargeNotebookCommand
+ link "Ctrl+Shift+L", Application::ResetNotebookWidthsCommand
+ link "Ctrl+Shift+:", Application::RotateNotebooksCommand
+ link "Alt+Shift+N", Application::CloseNotebookCommand
+ link "F11", Application::ToggleFullscreen
link "Ctrl+Alt+I", ToggleInvisibles
link "Ctrl++", IncreaseFontSize
link "Ctrl+-", DecreaseFontSize
@@ -1106,7 +734,7 @@ def self.keymaps
# map SelectTab<number>Command
(1..9).each do |tab_num|
- link "Alt+#{tab_num}", Top.const_get("SelectTab#{tab_num}Command")
+ link "Alt+#{tab_num}", Application.const_get("SelectTab#{tab_num}Command")
end
end
@@ -1123,8 +751,8 @@ def self.toolbars
item "Save File As", :command => Project::FileSaveAsCommand, :icon => :save_as, :barname => :core
item "Undo", :command => UndoCommand, :icon => :undo, :barname => :core
item "Redo", :command => RedoCommand, :icon => :redo, :barname => :core
- item "New Notebook", :command => NewNotebookCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "book--plus.png"), :barname => :edit
- item "Close Notebook", :command => CloseNotebookCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "book--minus.png"), :barname => :edit
+ item "New Notebook", :command => Application::NewNotebookCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "book--plus.png"), :barname => :edit
+ item "Close Notebook", :command => Application::CloseNotebookCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "book--minus.png"), :barname => :edit
end
end
@@ -1133,16 +761,16 @@ def self.menus(window)
sub_menu "File", :priority => :first do
group(:priority => :first) do
item "New", NewCommand
- item "New Window", NewWindowCommand
+ item "New Window", Application::NewWindowCommand
end
group(:priority => 10) do
separator
- item "Close Tab", CloseTabCommand
- item "Close Tree", CloseTreeCommand
+ item "Close Tab", Application::CloseTabCommand
+ item "Close Tree", Application::CloseTreeCommand
item "Close Window", Application::CloseWindowCommand
- item "Close Others", CloseOthers
- item "Close All", CloseAll
+ item "Close Others", Application::CloseOthers
+ item "Close All", Application::CloseAll
end
group(:priority => :last) do
@@ -1203,7 +831,7 @@ def self.menus(window)
group(:priority => 10) do
item "Task Manager", TaskManager::OpenCommand
separator
- #item "Print Scope Tree", PrintScopeTreeCommand
+ item "Print Scope Tree", PrintScopeTreeCommand
item "Print Scope at Cursor", PrintScopeCommand
end
end
@@ -1218,49 +846,48 @@ def self.menus(window)
end
group(:priority => 10) do
separator
- item "Toggle Fullscreen", :command => ToggleFullscreen, :type => :check, :active => window ? window.fullscreen : false
+ item "Toggle Fullscreen", :command => Application::ToggleFullscreen, :type => :check, :active => window ? window.fullscreen : false
end
group(:priority => 15) do
separator
sub_menu "Trees" do
- item "Open Tree Finder", OpenTreeFinderCommand
- item "Toggle Tree Visibility", ToggleTreesCommand
- item "Increase Tree Width", IncreaseTreebookWidthCommand
- item "Decrease Tree Width", DecreaseTreebookWidthCommand
+ item "Open Tree Finder", Application::OpenTreeFinderCommand
+ item "Toggle Tree Visibility", Application::ToggleTreesCommand
+ item "Increase Tree Width", Application::IncreaseTreebookWidthCommand
+ item "Decrease Tree Width", Application::DecreaseTreebookWidthCommand
separator
- item "Previous Tree", SwitchTreeUpCommand
- item "Next Tree", SwitchTreeDownCommand
+ item "Previous Tree", Application::SwitchTreeUpCommand
+ item "Next Tree", Application::SwitchTreeDownCommand
end
lazy_sub_menu "Windows" do
GenerateWindowsMenu.new(self).run
end
sub_menu "Notebooks" do
- item "New Notebook", NewNotebookCommand
- item "Close Notebook", CloseNotebookCommand
- item "Rotate Notebooks", RotateNotebooksCommand
- item "Move Tab To Other Notebook", MoveTabToOtherNotebookCommand
- item "Switch Notebooks", SwitchNotebookCommand
+ item "New Notebook", Application::NewNotebookCommand
+ item "Close Notebook", Application::CloseNotebookCommand
+ item "Rotate Notebooks", Application::RotateNotebooksCommand
+ item "Move Tab To Other Notebook", Application::MoveTabToOtherNotebookCommand
+ item "Switch Notebooks", Application::SwitchNotebookCommand
separator
- item "Enlarge First Notebook", EnlargeFirstNotebookCommand
- item "Enlarge Second Notebook", EnlargeSecondNotebookCommand
- item "Reset Notebook Widths", ResetNotebookWidthsCommand
+ item "Enlarge First Notebook", Application::EnlargeNotebookCommand
+ item "Reset Notebook Widths", Application::ResetNotebookWidthsCommand
end
sub_menu "Tabs" do
- item "Previous Tab", SwitchTabDownCommand
- item "Next Tab", SwitchTabUpCommand
- item "Move Tab Left", MoveTabDownCommand
- item "Move Tab Right", MoveTabUpCommand
+ item "Previous Tab", Application::SwitchTabDownCommand
+ item "Next Tab", Application::SwitchTabUpCommand
+ item "Move Tab Left", Application::MoveTabDownCommand
+ item "Move Tab Right", Application::MoveTabUpCommand
separator
# GenerateTabsMenu.new(self).run # TODO: find a way to maintain keybindings with lazy menus
item "Focussed Notebook", ShowTitle
(1..9).each do |num|
- item "Tab #{num}", Top.const_get("SelectTab#{num}Command")
+ item "Tab #{num}", Application.const_get("SelectTab#{num}Command")
end
end
end
group(:priority => :last) do
separator
- item "Show Toolbar", :command => ToggleToolbar, :type => :check, :active => Redcar.app.show_toolbar?
+ item "Show Toolbar", :command => Application::ToggleToolbar, :type => :check, :active => Redcar.app.show_toolbar?
item "Show Invisibles", :command => ToggleInvisibles, :type => :check, :active => EditView.show_invisibles?
item "Show Line Numbers", :command => ToggleLineNumbers, :type => :check, :active => EditView.show_line_numbers?
end
@@ -1291,7 +918,7 @@ def tab_focus(tab)
end
def tab_close(tab)
- CloseTabCommand.new(tab).run
+ Application::CloseTabCommand.new(tab).run
end
def window_close(win)
@@ -1303,7 +930,7 @@ def application_close(app)
end
def window_focus(win)
- FocusWindowCommand.new(win).run
+ Application::FocusWindowCommand.new(win).run
end
end
@@ -1312,33 +939,40 @@ def self.application_event_handler
end
def self.start(args=[])
- Redcar.log.info("startup milestone: loading plugins took #{Time.now - Redcar.process_start_time}")
- Redcar.update_gui do
- Application.start
- ApplicationSWT.start
- Swt.splash_screen.inc(1) if Swt.splash_screen
- s = Time.now
- if Redcar.gui
- Redcar.app.controller = ApplicationSWT.new(Redcar.app)
+ begin
+ Redcar.log.info("startup milestone: loading plugins took #{Time.now - Redcar.process_start_time}")
+ Redcar.update_gui do
+ Application.start
+ ApplicationSWT.start
+ Swt.splash_screen.inc(1) if Swt.splash_screen
+ s = Time.now
+ if Redcar.gui
+ Redcar.app.controller = ApplicationSWT.new(Redcar.app)
+ end
+ Redcar.app.refresh_menu!
+ Redcar.app.load_sensitivities
+ Redcar.log.info("initializing gui took #{Time.now - s}s")
+ end
+ Redcar.update_gui do
+ Swt.splash_screen.close if Swt.splash_screen
+ win = Redcar.app.make_sure_at_least_one_window_open
+ win.close if win and args.include?("--no-window")
+ Redcar.log.info("startup milestone: window open #{Time.now - Redcar.process_start_time}")
+ Redcar::Project::Manager.start(args)
+ Redcar.log.info("startup milestone: project open #{Time.now - Redcar.process_start_time}")
+ end
+ Redcar.load_useful_libraries
+ EditViewSWT.start
+ Redcar.log.info("startup milestone: complete: #{Time.now - Redcar.process_start_time}")
+ if args.include?("--compute-textmate-cache-and-quit")
+ Redcar::Textmate.all_bundles
+ exit
+ end
+ rescue => e
+ Redcar.log.error("error in startup: #{e.inspect}")
+ e.backtrace.each do |line|
+ Redcar.log.error(line)
end
- Redcar.app.refresh_menu!
- Redcar.app.load_sensitivities
- Redcar.log.info("initializing gui took #{Time.now - s}s")
- end
- Redcar.update_gui do
- Swt.splash_screen.close if Swt.splash_screen
- win = Redcar.app.make_sure_at_least_one_window_open
- win.close if win and args.include?("--no-window")
- Redcar.log.info("startup milestone: window open #{Time.now - Redcar.process_start_time}")
- Redcar::Project::Manager.start(args)
- Redcar.log.info("startup milestone: project open #{Time.now - Redcar.process_start_time}")
- end
- Redcar.load_useful_libraries
- EditViewSWT.start
- Redcar.log.info("startup milestone: complete: #{Time.now - Redcar.process_start_time}")
- if args.include?("--compute-textmate-cache-and-quit")
- Redcar::Textmate.all_bundles
- exit
end
end
end
3  plugins/runnables/plugin.rb
View
@@ -4,7 +4,6 @@
version "1.0"
file "lib", "runnables"
object "Redcar::Runnables"
- dependencies "tree", ">0",
- "application", ">=1.1",
+ dependencies "application", ">=1.1",
"HTML View", ">0"
end
1  plugins/test_runner/lib/test_runner.rb
View
@@ -1,4 +1,5 @@
require 'test_runner/runnable_test_runner'
+require 'test_runner/jasmine_test_runner'
require 'test_runner/rspec_runner'
require 'test_runner/run_test_command'
#
15 plugins/test_runner/lib/test_runner/jasmine_test_runner.rb
View
@@ -0,0 +1,15 @@
+module Redcar
+ class JasmineTestRunner
+ def initialize(config)
+ @jasmine_url = config[:jasmine_url] || "http://localhost:8888"
+ end
+
+ def run_test(path, current_line)
+ if jasmine_tab = Redcar.app.all_tabs.detect {|t| t.title == "Jasmine Test Runner" }
+ jasmine_tab.html_view.refresh
+ else
+ Redcar::HtmlView::DisplayWebContent.new("Jasmine Test Runner", @jasmine_url).execute
+ end
+ end
+ end
+end
26 plugins/test_runner/lib/test_runner/runnable_test_runner.rb
View
@@ -1,25 +1,41 @@
module Redcar
class RunnableTestRunner
- attr_accessor :single_test_patterns, :file_runner, :single_test_runner
+ attr_accessor :single_test_patterns, :file_runner, :single_test_runner, :other_notebook
def initialize(config)
@single_test_patterns = config["single_test_patterns"]
@single_test_runner = config["single_test_runner"]
@file_runner = config["file_runner"]
+ @other_notebook = config["other_notebook"]
end
def run_test(path, current_line)
single_test_patterns.each do |pattern|
if current_line =~ pattern
test_name = $1
- command = single_test_runner.gsub("__FILE__", path).gsub("__TEST_NAME__", test_name)
- Redcar::Runnables.run_process Project::Manager.focussed_project.path, command, "Running test: #{test_name}"
+ command = single_test_runner.gsub("__TEST_NAME__", test_name)
+ run_process command, "Running test: #{test_name}"
return
end
end
- Redcar::Runnables.run_process Project::Manager.focussed_project.path,
- file_runner.gsub("__FILE__", path), "Running test: #{File.basename(path)}"
+ run_process file_runner.dup, "Running test: #{File.basename(path)}"
+ end
+
+ def run_process(command, title)
+ p [:command, command]
+ current_tab = Redcar.app.focussed_window.focussed_notebook_tab
+ Redcar::Runnables.run_process Project::Manager.focussed_project.path, command, title
+ if other_notebook
+ window = Redcar.app.focussed_window
+ tab = Redcar.app.all_tabs.detect {|tab| tab.title == title }
+ if current_tab.notebook == tab.notebook
+ i = window.notebooks.index(tab.notebook)
+ target_notebook = window.notebooks[ (i + 1) % window.notebooks.length ]
+ target_notebook.grab_tab_from(tab.notebook, tab)
+ end
+ current_tab.focus
+ end
end
end
end
2  plugins/textmate/lib/textmate/snippet.rb
View
@@ -1,5 +1,3 @@
-# encoding: UTF-8
-
module Redcar
module Textmate
class Snippet
11 plugins/textmate/lib/textmate/tree_mirror.rb
View
@@ -1,11 +1,12 @@
-# Some Icons by Yusuke Kamiyamane.
-# http://p.yusukekamiyamane.com/
-#
-# Licensed under a Creative Commons Attribution 3.0 license.
-# http://creativecommons.org/licenses/by/3.0/
module Redcar
module Textmate
TREE_TITLE = "Bundles"
+
+ # Some Icons by Yusuke Kamiyamane.
+ # http://p.yusukekamiyamane.com/
+ #
+ # Licensed under a Creative Commons Attribution 3.0 license.
+ # http://creativecommons.org/licenses/by/3.0/
class TreeController
include Redcar::Tree::Controller
2  plugins/textmate/plugin.rb
View
@@ -4,5 +4,5 @@
version "1.0"
file "lib", "textmate"
object "Redcar::Textmate"
- dependencies "core", ">0", "application", ">0", "HTML View", ">=0.3.2", "tree", ">0"
+ dependencies "core", ">0", "application", ">0", "HTML View", ">=0.3.2"
end
9 plugins/tree/plugin.rb
View
@@ -1,9 +0,0 @@
-
-Plugin.define do
- name "tree"
- version "1.0"
- file "lib", "tree"
- object "Redcar::Tree"
- dependencies "core", ">0",
- "application", ">0"
-end
5 plugins/tree/spec/spec_helper.rb
View
@@ -1,5 +0,0 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
3  plugins/web_bookmarks/plugin.rb
View
@@ -4,8 +4,7 @@
version "1.0"
file "lib", "web_bookmarks"
object "Redcar::WebBookmarks"
- dependencies "tree", ">0",
- "application", ">=1.1",
+ dependencies "application", ">=1.1",
"project" , ">=1.1",
"HTML View" , ">0"
end
2  vendor/java-mateview
@@ -1 +1 @@
-Subproject commit c643e0c088fc5c9cecf04a8405fb6de58ac6e17b
+Subproject commit 1399a42141978ce32791c089857aec5608da0026
Please sign in to comment.
Something went wrong with that request. Please try again.