Skip to content

Commit

Permalink
Merge branch 'master' of github.com:redcar/redcar
Browse files Browse the repository at this point in the history
  • Loading branch information
GarstgerUnhold committed Nov 9, 2010
2 parents f578f1e + c5594f5 commit 2cedecb
Show file tree
Hide file tree
Showing 83 changed files with 981 additions and 493 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Expand Up @@ -7,6 +7,11 @@ Enhancements:
* Strip Trailing Spaces is now _much_ faster (Tim Felgentreff)
* "Online Help" and "Submit a Bug" open the default system browser (Johannes Wollert)
* -l command line switch to jump to a file number (Johannes Wollert)
* Font and Theme dialogs now update the setting on selection change for instant feedback (Tim Felgentreff)
* Tabs now display an alert icon if the underlying file is unwritable (Delisa Mason)
* Browser bar URL field now supports project-relative paths (Delisa Mason)
* URLs can be opened in the internal browser or the OS-default based on preferences (Delisa Mason)
* Syntax checking for groovy

Bug fixes:

Expand All @@ -19,6 +24,7 @@ Internal changes:

* Code coverage is above 70% (up from 60%) (everyone)
* Code cleanup and refactoring in various plugins (everyone)
* Speedbar can now contain sliders (Tim Felgentreff)

Version 0.8.1 (26 October 2010)
===============================
Expand Down
6 changes: 2 additions & 4 deletions Rakefile
Expand Up @@ -96,10 +96,8 @@ end
desc "Run features"
task :cucumber do
cmd = "jruby "
if Config::CONFIG["host_os"] == "darwin"
cmd += "-J-XstartOnFirstThread "
end
cmd += "bin/cucumber -cf progress"
cmd << "-J-XstartOnFirstThread " if Config::CONFIG["host_os"] == "darwin"
cmd << "bin/cucumber -cf progress"
Dir["plugins/*/features"].each do |f|
sh("#{cmd} #{f} && echo 'done'")
end
Expand Down
33 changes: 0 additions & 33 deletions lib/redcar/jvm_options_probe.rb

This file was deleted.

17 changes: 10 additions & 7 deletions lib/redcar/runner.rb
Expand Up @@ -67,7 +67,8 @@ def construct_command(args="")
# unfortuanately, ruby doesn't support [a, *b, c]
command = ["java"]
command.push(*java_args)
command.push("-Xmx500m", "-Xss1024k", "-Djruby.memory.max=500m", "-Djruby.stack.max=1024k", "-cp", jruby_complete, "org.jruby.Main")
command.push("-Xbootclasspath/a:#{jruby_complete}")
command.push("-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)
Expand Down Expand Up @@ -105,14 +106,16 @@ def java_args
str.push "-Djruby.debug.loadService.timing=true"
end

require 'redcar/jvm_options_probe'

jvm_options_probe = JvmOptionsProbe.new

str.push "-d32" if jvm_options_probe.can_use_d32?
str.push "-client" if jvm_options_probe.can_use_client?
str.push "-d32" if JvmOptionsProbe::D32
str.push "-client" if JvmOptionsProbe::Client

str
end

class JvmOptionsProbe
Redirect = "> #{Redcar.null_device} 2>&1"
D32 = system("java -d32 #{Redirect}")
Client = system("java -client #{Redirect}")
end
end
end
6 changes: 3 additions & 3 deletions lib/regex_replace.rb
Expand Up @@ -45,12 +45,12 @@ def regexp_gsub(re, string, &blk)
while left.length > 0
md = re.match(left)
if md
newstr += md.pre_match
newstr << md.pre_match
r = yield md
newstr += r
newstr << r
left = md.post_match
else
newstr += left
newstr << left
left = ""
end
end
Expand Down
19 changes: 19 additions & 0 deletions plugins/application/lib/application/dialogs/filter_list_dialog.rb
Expand Up @@ -42,6 +42,14 @@ def selected(text, ix)
puts "Hooray! You selected #{text} at index #{ix}"
end

# Called by the controller when the user moves through the list.
#
# @param [String] the list row text that is now highlighted
# @param [Integer] the index of the row that is now highlighted
def moved_to(text, ix)
# Override with the code you wish you had
end

# Helper method for fuzzily filtering a list
#
# @param [Array<A>] list the list to filter
Expand Down Expand Up @@ -83,6 +91,17 @@ def filter_and_rank_by(list, query, max_length=20)
score_match_pairs.map {|a| a.last }
end

# The time interval in seconds in which moved_to events are ignored
# Override to select different interval
def step_time
1
end

def step?
@last_step ||= Time.now - step_time
@last_step + step_time <= Time.now
end

private

def make_regex(text)
Expand Down
38 changes: 22 additions & 16 deletions plugins/application/lib/application/speedbar.rb
Expand Up @@ -2,14 +2,15 @@
module Redcar
class Speedbar
include Redcar::Model

LabelItem = ObservableStruct.new(:name, :text)
ToggleItem = ObservableStruct.new(:name, :text, :key, :listener, :value)
TextBoxItem = ObservableStruct.new(:name, :listener, :value, :edit_view)
ButtonItem = ObservableStruct.new(:name, :text, :key, :listener)
ComboItem = ObservableStruct.new(:name, :items, :value, :listener)
SliderItem = ObservableStruct.new(:name, :value, :minimum, :maximum, :increment, :enabled, :listener)
KeyItem = ObservableStruct.new(:key, :listener)

def self.items
@items ||= []
end
Expand All @@ -18,21 +19,21 @@ def self.append_item(item)
return if items.detect {|i| i.respond_to?(:name) and i.name == item.name }
items << item
end

def self.close_image_path
File.join(Redcar::ICONS_DIRECTORY, "/close.png")
end

def self.define_item_finder(name)
self.class_eval %Q{
def #{name}
__get_item(#{name.to_s.inspect})
end
}
end

def __get_item(name)
item = __items.detect do |i|
item = __items.detect do |i|
i.respond_to?(:name) and
i.name.to_s == name
end
Expand All @@ -41,52 +42,57 @@ def __get_item(name)
end
item
end

def __items
@__items ||= self.class.items.map {|i| i.clone }
end

def __get_item_by_text_or_name(name)
__items.detect {|i| (i.respond_to?(:text) and i.text == name) or i.name.to_s == name.to_s }
end

def __get_item_by_label(name)
label = __items.detect {|i| i.is_a?(LabelItem) and (i.text == name or i.name.to_s == name.to_s)}
if label
index_of_label = __items.index(label)
__items[index_of_label + 1]
end
end

def self.label(name, text)
append_item LabelItem.new(name, text)
define_item_finder(name)
end

def self.toggle(name, text, key, value=false, &block)
append_item ToggleItem.new(name, text, key, block, value)
define_item_finder(name)
end

def self.textbox(name, value="", &block)
append_item TextBoxItem.new(name, block, value)
define_item_finder(name)
end

def self.button(name, text, key, &block)
append_item ButtonItem.new(name, text, key, block)
define_item_finder(name)
end

def self.combo(name, items=[], value=nil, &block)
append_item ComboItem.new(name, items, value, block)
define_item_finder(name)
end


def self.slider(name, value = 50, minimum = 0, maximum = 100, increment = 1, &block)
append_item SliderItem.new(name, value, minimum, maximum, increment, true, block)
define_item_finder(name)
end

def self.key(key, &block)
append_item KeyItem.new(key, block)
end

def inspect
"#<Speedbar #{__items.inspect}"
end
Expand Down
35 changes: 20 additions & 15 deletions plugins/application/lib/application/tab.rb
Expand Up @@ -2,16 +2,21 @@ module Redcar
class Tab
include Redcar::Model
include Redcar::Observable

DEFAULT_ICON = :file


DEFAULT_ICON = :file
NO_WRITE_ICON = :exclamation_red
MISSING_ICON = :exclamation
CONFIG_ICON = :hammer_screwdriver
HELP_ICON = :question
WEB_ICON = :globe

attr_reader :notebook

def initialize(notebook)
@notebook = notebook
@title = "unknown"
end

# Close the tab (remove it from the Notebook).
#
# Events: close
Expand All @@ -20,8 +25,8 @@ def close
notify_listeners(:close)
end
end
# Focus the tab within the notebook, and gives the keyboard focus to the

# Focus the tab within the notebook, and gives the keyboard focus to the
# contents of the tab, if appropriate.
#
# Events: focus
Expand All @@ -39,11 +44,11 @@ def title=(title)
@title = title
notify_listeners(:changed_title, title)
end

def icon
@icon || DEFAULT_ICON
end

def icon=(value)
@icon = value
notify_listeners(:changed_icon, icon)
Expand All @@ -58,30 +63,30 @@ def set_notebook(notebook)
@notebook = notebook
end

# Moves the tab to a new position in the notebook, if said position
# Moves the tab to a new position in the notebook, if said position
# is currently occupied. Defaults to the first position, if none
# is passed.
#
#
# Events: moved (position)
def move_to_position(position = 0)
if (0..@notebook.tabs.size - 1).include?(position)
notify_listeners(:moved, position)
end
end

def edit_tab?
is_a?(EditTab)
end

# Helper method to get the edit_view's document, if applicable.
def document
edit_view.document if edit_tab?
end

# Helper method to get this tab's Mirror object for the current
# document, if applicable.
def document_mirror
document.mirror if document
end
end
end
end
2 changes: 1 addition & 1 deletion plugins/application/plugin.rb
@@ -1,7 +1,7 @@

Plugin.define do
name "application"
version "1.1"
version "1.2"
file "lib", "application"
object "Redcar::Application"
dependencies "core", ">0"
Expand Down

0 comments on commit 2cedecb

Please sign in to comment.