You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <caw...@us...> - 2007-08-09 12:52:25
|
Revision: 2947
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2947&view=rev
Author: cawilliams
Date: 2007-08-09 05:52:23 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
add newest stuff from debug-commons-0.9.4
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/ruby/classic-debug-verbose.rb
trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/ChangeLog
trunk/org.rubypeople.rdt.launching/ruby/MIT-LICENSE
trunk/org.rubypeople.rdt.launching/ruby/README
trunk/org.rubypeople.rdt.launching/ruby/classic-debug.txt
trunk/org.rubypeople.rdt.launching/ruby/context.rb
trunk/org.rubypeople.rdt.launching/ruby/xml_printer.rb
Added: trunk/org.rubypeople.rdt.launching/ruby/ChangeLog
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/ChangeLog (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/ChangeLog 2007-08-09 12:52:23 UTC (rev 2947)
@@ -0,0 +1,140 @@
+2007-08-08 Martin Krauskopf <mar...@su...>
+
+ * lib/context.rb: to_inspect = str.gsub(/\\n/, "\n") in debug_eval() to make
+ possible to evaluate multiline expressions. Frontend must escape new
+ lines accordingly.
+
+2007-07-31 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: synchronize get_thread_num method
+
+2007-07-25 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug-verbose.rb, lib/context.rb, lib/xml_printer.rb:
+ synchronizing all socket communication to prevent race condition
+
+2007-07-23 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug-verbose.rb, lib/context.rb, lib/xml_printer.rb: code
+ reorganization. Context and Printer class moved to their own files. No
+ semantic change.
+
+ * lib/classic-debug-verbose.rb, lib/context.rb, lib/xml_printer.rb,
+ build_dist: more code cleanup. Rubyfying Java names. No semantic changes.
+
+2007-07-19 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: do not allow to call 'set_trace_func' by debuggee
+
+ * lib/classic-debug.rb: s/DEBUGGER__/DC_DEBUGGER__ to prevent debug.rb
+ collisions
+
+2007-07-17 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: send message 'finished' back when exiting
+
+2007-07-16 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: 'exit' command implemented
+
+2007-07-15 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: More protocols unification: sent error when the
+ negative number is passed to delete
+
+2007-07-12 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: Make 'self' first in the local variables list
+ (merging fast and classic debuggers protocols)
+
+2007-07-11 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: turning off some logging in debug mode. *Too*
+ verbose to be useful in a frontend. Might be uncommented by developer for
+ now.
+
+2007-07-09 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: prevent error when debugger process is killed +
+ better error logging
+
+2007-07-04 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: Return <message> for unknown command (merging fast
+ and classic debuggers protocols)
+
+ * classic-debug/test/*, test-base/*: Initial test refactoring. Sharing
+ common tests which work for both, classic and fast debuggers. Currently
+ stepping_breakpoints_test.
+
+2007-06-18 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: do not send binary data within values of variables.
+ See http://www.netbeans.org/nonav/issues/show_bug.cgi?id=101748 for more
+ details.
+
+2007-05-06 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb, test/cd_inspect_test.rb: escaping error message in
+ processingException. Sometime caused to send invalid XML.
+
+ * 0.9.3 released
+
+2007-04-27 Martin Krauskopf <mar...@su...>
+
+ * test/test_base.rb, test/cd_*_test.rb, test: fixing tests for JRuby
+ interpreter
+
+2007-03-29 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb, test/cd_stepping_breakpoints_test.rb: fixed bug with
+ breakpoints removing
+
+ * 0.9.2 released
+
+2007-03-20 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb: fix for handling file names and path containing
+ spaces and/or semicolons. Breakpoint struct introduced.
+
+ * test/cd_stepping_breakpoints_test.rb test/readers.rb test/test_base.rb:
+ test for the space and/or semicolon in path edge cases
+
+ * 0.9.1 released
+
+2007-03-15 Martin Krauskopf <mar...@su...>
+
+ * etc/build_dist: simple script for building tarball
+
+ * etc/kill_debugger: might be handy during testing phase
+
+ * README: TOC, 1.8.6 works smoothly, intermediate Java library note
+
+ * classic-debug.txt: initial description of few commands
+
+ * 0.9.0 released
+
+2007-02-21 Martin Krauskopf <mar...@su...>
+
+ * classic-debug.txt, README: description of $RemoteDebugPort
+
+ * test/test_base.rb: trivial - use File.join
+
+2007-02-19 Martin Krauskopf <mar...@su...>
+
+ * lib/classic-debug.rb, test/cd_stepping_breakpoints_test.rb: fixing (my)
+ regression of next/continue behavior while stepping over.
+
+2007-02-16 Martin Krauskopf <mar...@su...>
+
+ * test/cd_inspect_test.rb, test/readers.rb: merging more RDT tests from Java
+ to Ruby
+
+ * test/cd_*_test.rb, test/test_base.rb (run_to_line): new function plus
+ relevant refactoring
+
+2007-02-15 Martin Krauskopf <mar...@su...>
+
+ Initial debug-commons based on the Markus Barchfeld's RDT work. See README
+ file in the project directory for more details.
+
Added: trunk/org.rubypeople.rdt.launching/ruby/MIT-LICENSE
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/MIT-LICENSE (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/MIT-LICENSE 2007-08-09 12:52:23 UTC (rev 2947)
@@ -0,0 +1,24 @@
+The file lib/classic-debug.rb is based on the debug.rb file from Ruby
+project.
+
+Copyright (c) 2007 debug-commons team
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
Added: trunk/org.rubypeople.rdt.launching/ruby/README
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/README (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/README 2007-08-09 12:52:23 UTC (rev 2947)
@@ -0,0 +1,91 @@
+= debug-commons
+
+
+== TOC
+- Overview
+- History, Future, Aims
+- Requirements
+- Install
+- Related (sub)projects [intermediate libraries]
+- License
+
+
+== Overview
+
+----
+Note: this document is currently being more-or-less duplicate of the
+debug-commons homepage. So for the up-to-date information look rather at the
+site directly and follow the links there:
+
+http://debug-commons.rubyforge.org/
+----
+
+debug-commons currently consist of wrappers around various Ruby debugging
+backends. 'Wrapping' in this case means that backends are enriched by
+producing/consuming a unified XML-based protocol. Currently there are two
+wrappers, one for Ruby "classic debugger" (debug.rb) and another for Kent
+Sibilev's ruby-debug gem implementation. Both protocols have a lot in common,
+however differ slightly due to the nature of their implementation and
+behaviour. Take a look at classic-debug.txt and ruby-debug.txt files for more
+detailed information about individual protocols.
+
+
+== History, Future, Aims
+
+The project was originally developed as part of Ruby Development Tools[1]. The
+debugger plugin was mainly developed by Markus Barchfeld with the help of
+Christopher Williams, Werner Schuster (murphee), Mirko Stocker (and others) who
+work on other parts of RDT. Later Martin Krauskopf, implementing NetBeans
+debugger module, wrote to RDT people about possible cooperation on the backend
+they had. First official email here:
+
+http://sourceforge.net/mailarchive/forum.php?thread_id=31511654&forum_id=9198
+
+(MK: RDT folks have invested and brought a nice bunch of work. I believe
+both sides (and hopefully others) will gain a lot in the end).
+
+
+This project was founded because there doesn't seem to be a general open source
+solution in the Ruby world for debugger-frontend implementers. The aim is to
+provide such a solution for anyone who wants to start (or is already working)
+on a debugger frontend (standalone GUI debugger, an IDE or editor plugin,
+remote CLI-based one, ...). You might take a look at from-time-to-time evolving
+Ruby Debugging document:
+
+http://debug-commons.rubyforge.org/misc/ruby-debugging.html
+
+Hopefully, in the future, we will have something similar as e.g. Java has with
+its JPDA.
+
+Currently there are RDT and NetBeans contributors working on this common
+project - and anyone is very welcome to join.
+
+There are some consideration to be done like joining/supporting a Common
+Debugger Protocol (http://www.xdebug.org/docs-dbgp.php), better support for
+JRuby, ... [TBD - probably separate TODO] so feel free to join the mailing
+list(s) for a discussion about current and feature plans [TBD - link to MLs]
+
+
+== Requirements
+Currently tests fully pass with Ruby 1.8.6. Latest official build of 1.8.5
+(p35) seems to end with Segmentation fault on some machines. So better to use
+1.8.6 for non-problematic run. JRuby has some problems which are being
+subsequently filed (and fixed) into their Tracker. See status on the project's
+official website for more details.
+
+
+== Install
+Project is distributed as tarball containing classic-debug backend. Soon there
+should be also ruby-debug extension.
+
+
+== Related (sub)projects [intermediate libraries]
+Together with the backends project there are also subprojects containing
+libraries intermediating socket communication between backends and a frontend.
+Currently only library for Java is there. Hopefully more will come.
+
+
+== License
+
+See MIT-LICENSE file.
+
Modified: trunk/org.rubypeople.rdt.launching/ruby/classic-debug-verbose.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/classic-debug-verbose.rb 2007-08-09 12:50:11 UTC (rev 2946)
+++ trunk/org.rubypeople.rdt.launching/ruby/classic-debug-verbose.rb 2007-08-09 12:52:23 UTC (rev 2947)
@@ -1,3 +1,3 @@
-module DebugVerbose
-end
-require 'classic-debug'
\ No newline at end of file
+module DebugVerbose
+end
+require 'classic-debug'
Modified: trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb 2007-08-09 12:50:11 UTC (rev 2946)
+++ trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb 2007-08-09 12:52:23 UTC (rev 2947)
@@ -1,1199 +1,359 @@
-# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
-# Copyright (C) 2000 Information-technology Promotion Agency, Japan
-require 'cgi'
-require 'thread'
-require 'yaml'
-
-# REMOTE_DEBUG_PORT is the port on which the debugger waits for commands from a
-# front-end.
-#
-# RDT note: if you change this, you must also change the corresponding port in
-# org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy
-REMOTE_DEBUG_PORT = (defined? $RemoteDebugPort) ? $RemoteDebugPort : 1098
-
-# VERBOSE_DEBUGGER prints the communication between a front-end and ruby
-# debugger on stderr. If you have started a front-end debug session (and use
-# default preferences for colors of streams), the communication will be printed
-# in red letters to the front-end console.
-VERBOSE_DEBUGGER = defined? DebugVerbose
-
-class PrinterMultiplexer
- def initialize
- @printers = []
- end
-
- def addPrinter(printer)
- @printers << printer
- end
-
- def method_missing(methodName, *args)
- @printers.each { |printer|
- printer.send(methodName, *args)
- }
- end
-end
-
-class XmlPrinter
-
- def initialize(socket)
- @socket = socket
- end
-
- def out(*params)
- debugIntern(false, *params)
- if @socket then
- @socket.printf(*params)
- end
- end
-
- def printXml(s, *params)
- out(s, *params)
- end
-
- def printError(s, *params)
- out("<error>" + s + "</error>", *params)
- end
-
- def printMessage(s, *params)
- out("<message>" + s + "</message>", *params)
- end
-
- def printVariable(name, binding, kind)
- printVariableValue(name, eval(name, binding), kind)
- end
-
- def printVariableValue(name, value, kind)
- if value == nil then
- out("<variable name=\"%s\" kind=\"%s\"/>", CGI.escapeHTML(name), kind)
- return
- end
- if value.class().name == "Array" or value.class().name == "Hash" then
- hasChildren = value.length > 0
- if value.length == 0 then
- valueString = "Empty " + value.class().name
- else
- valueString = value.class().name + " (" + value.length.to_s + " element(s))"
- end
- else
- hasChildren = value.instance_variables.length > 0 || value.class.class_variables.length > 0
- valueString = value.to_s
- if valueString =~ /^\"/ then
- valueString.slice!(1..(valueString.length)-2)
- end
- end
- valueString = "[Binary Data]" if valueString.is_binary_data?
- out("<variable name=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\"/>", CGI.escapeHTML(name), kind, CGI.escapeHTML(valueString), value.class(), hasChildren, value.respond_to?(:object_id) ? value.object_id : value.id)
- end
-
- def printBreakpoint(n, debugFuncName, file, pos)
- out("<breakpoint file=\"%s\" line=\"%s\" threadId=\"%s\"/>", file, pos, DEBUGGER__.get_thread_num())
- end
-
- def printException(file, pos, exception)
- out("<exception file=\"%s\" line=\"%s\" type=\"%s\" message=\"%s\" threadId=\"%s\"/>", file, pos, exception.class, CGI.escapeHTML(exception.to_s), DEBUGGER__.get_thread_num())
- end
-
- def printStepEnd(file, line, framesCount)
- out("<suspended file=\"%s\" line=\"%s\" frames=\"%s\" threadId=\"%s\"/>", file, line, framesCount, DEBUGGER__.get_thread_num())
- end
-
- def printFrame(pos, n, file, line, id)
- out("<frame no=\"%s\" file=\"%s\" line=\"%s\"/>", n, file, line)
- end
-
- def printThread(num, thread)
- out("<thread id=\"%s\" status=\"%s\"/>", num, thread.status)
- end
-
- def printLoadResult(file, exception=nil)
- if exception then
- out("<loadResult file=\"%s\" exceptionType=\"%s\" exceptionMessage=\"%s\"/>", file, exception.class, CGI.escapeHTML(exception.to_s))
- else
- out("<loadResult file=\"%s\" status=\"OK\"/>", file)
- end
- end
-
- def debug(*params)
- debugIntern(true, *params)
- end
-
- def debugIntern(escape, *params)
- if VERBOSE_DEBUGGER then
- output = sprintf(*params)
- output = CGI.escapeHTML(output) if escape
- STDERR.print(output)
-# STDERR.print(' [[' + caller(0)[2].sub(/[^:]*:/, '') + ' ')
-# STDERR.print(Thread.current.to_s + ']]')
- STDERR.print("\n")
- end
- end
-end
-
-#multiplex = PrinterMultiplexer.new
-#multiplex.addPrinter(XmlPrinter.new(nil))
-#multiplex.addPrinter(XmlPrinter.new(nil))
-#multiplex.printXml("TEST")
-
-require 'socket'
-require 'tracer'
-
-class Tracer
- def Tracer.trace_func(*vars)
- Single.trace_func(*vars)
- end
-end
-
-SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
-
-class DEBUGGER__
-
- # type: 0 - breakpoint, 1 - watchpoint
- Breakpoint = Struct.new("Breakpoint", :valid, :type, :file, :pos)
-
- class CommandLinePrinter
- def printXml(s)
- # print XML only
- end
-
- def printVariable(name, binding, kind)
- stdout.printf " %s => %s\n", name, eval(name, binding).inspect
- end
-
- def printBreakpoint(n, debugFuncName, file, pos)
- stdout.printf "Breakpoint %d, %s at %s:%s\n", n, debugFuncName, file, pos
- stdout.flush
- end
-
- def printFrame(pos, n, file, line, id)
- if pos == n
- stdout.printf "--> #%d %s:%s%s\n", n, file, line, id ? ":in `#{id.id2name}'":""
- else
- stdout.printf " #%d %s:%s%s\n", n, file, line, id ? ":in `#{id.id2name}'":""
- end
- end
-
- def printException(file, line, exception)
- stdout.printf "%s:%d: `%s' (%s)\n", file, line, exception, exception.class
- stdout.flush
- end
-
- def printThread(num, thread)
- if thread == Thread.current
- stdout.print "+"
- else
- stdout.print " "
- end
- stdout.printf "%d ", num
- stdout.print thread.inspect, "\t"
- file = DEBUGGER__.context(thread).instance_eval{@file}
- if file
- stdout.print file, ":", DEBUGGER__.context(thread).instance_eval{@line}
- end
- stdout.print "\n"
- end
-
-
- def printStepEnd(file, line, framesCount)
-
- end
-
- def debug(*params)
-
- end
-
- def stdout
- DEBUGGER__.stdout
- end
- end
-
- class Context
- attr_reader :shouldResume
- def initialize
- @printer = DEBUGGER__.printer
- @socket = DEBUGGER__.socket
- @stop_next = 0
- @last_file = nil
- @file = nil
- @line = nil
- @no_step = nil
- @frames = []
- @current_frame = -1
- @finish_pos = 0
- @trace = false
- @catch = nil # "StandardError"
- @suspend_next = false
- @shouldResume = false
- end
-
- def stop_next(n=1)
- @stop_next = n
- end
-
- def set_suspend
- @suspend_next = true
- end
-
- def clear_suspend
- @suspend_next = false
- end
-
- def stopCurrentThread
- @printer.debug("Suspending : %s", Thread.current)
- Thread.stop()
- @printer.debug("Resumed : %s", Thread.current)
- end
-
- def trace?
- @trace
- end
-
- def set_trace(arg)
- @trace = arg
- end
-
- def stdout
- if @socket then
- @socket
- else
- DEBUGGER__.stdout
- end
- end
-
- def break_points
- DEBUGGER__.break_points
- end
-
- def display
- DEBUGGER__.display
- end
-
- def context(th)
- DEBUGGER__.context(th)
- end
-
- def set_trace_all(arg)
- DEBUGGER__.set_trace(arg)
- end
-
- def set_last_thread(th)
- DEBUGGER__.set_last_thread(th)
- end
-
- def debug_eval_private(str, binding)
- # evaluates str like "var.@instance_var.@instance_var"
- # and "var.privateMethod"
- # return value might be nil
- # the scan must detect array and hash accesses, which might
- # themselves contain point separated expressions, e.g.
- # array[Test.getX].y
- names = str.scan(/[^\[\]]*(?=\.)|.*\[.*\](?=\.)|.*$/)
- # names can contain empty strings
- obj = eval(names[0], binding)
- (1..names.length-1).each { |i|
- if names[i] != "" then
- if names[i].length > 2 && names[i][0..1] == '@@' then
- @printer.debug("Evaluating (class_var): %s on %s", names[i], obj )
- obj = obj.class.class_eval("#{names[i]}")
- else
- @printer.debug("Evaluating (instance_var): %s on %s", names[i], obj )
- obj = obj.instance_eval("#{names[i]}")
- end
- end
- }
- return obj
- end
-
- def debug_eval(str, binding, noPrivateInstanceVars = false)
- begin
- if noPrivateInstanceVars then
- val = eval(str, binding)
- else
- val = debug_eval_private(str, binding)
- end
- val
- rescue ScriptError, StandardError => error
- if error.to_s =~ /private method .* called for/ then
- return debug_eval(str, binding, true)
- end
- @printer.debug("Error in debug_eval (noPrivateInstancsVars=%s): %s", noPrivateInstanceVars, error)
- raise error
- end
- end
-
- def debug_silent_eval(str, binding)
- begin
- val = eval(str, binding)
- val
- rescue StandardError, ScriptError
- nil
- end
- end
-
- def var_list(ary, binding, kind)
- ary.sort! do |v1, v2|
- if v1 == 'self'
- result = -1
- elsif v2 == 'self'
- result = 1
- else
- result = v1 <=> v2
- end
- result
- end
- @printer.printXml("<variables>")
- for v in ary
- @printer.printVariable(v,binding, kind)
- end
- @printer.printXml("</variables>")
- end
-
- def printArrayElements(array)
- index = 0
- array.each { |e|
- @printer.printVariableValue('[' + index.to_s + ']', e, 'instance')
- index += 1
- }
- end
-
- def printHashElements(hash)
- hash.keys.each { | k |
- if k.class.name == "String"
- name = '\'' + k + '\''
- else
- name = k.to_s
- end
- @printer.printVariableValue(name, hash[k], 'instance')
- }
- end
-
-
- def getConstantsInClass(aClass)
- constants = aClass.constants() - Object.constants
- return constants.delete_if { |c| ! aClass.const_defined? c }
- end
-
-
- def getBinding(pos)
- # returns frame info of frame pos, if pos is within bound, nil otherwise
- pos = @current_frame unless pos
- pos = pos.to_i - 1
- if pos < 0 then
- @printer.debug("ERROR: illegal stack frame, using top frame.")
- pos = 0
- end
- if pos >= @frames.size then
- @printer.debug("ERROR: given stack frame number %i too high.", pos + 1)
- pos = @frames.size - 1
- end
- @printer.debug("Using frame %s (1-based) for evaluation of variable.", pos + 1)
- return @frames[pos][0]
- end
-
-
- def debug_variable_info(input, binding)
-
- case input
- when /^\s*g(?:lobal)?$/
- var_list(global_variables, binding, 'global')
-
- when /^\s*l(?:ocal)?\s*(\d+)?$/
- @printer.debug("Getting binding for frame #{$1}")
- new_binding = getBinding($1)
- if new_binding then
- binding = new_binding
- end
- begin
- #@printer.debug("binding=%s", binding)
- localVars = eval("local_variables", binding)
- # v 1.8.1 dies in eval @printer.debug("HERE")
- if eval('self.to_s', binding) !~ /main/ then
- localVars << "self"
- end
- var_list(localVars, binding, 'local')
- rescue StandardError => bang
- @printer.debug("Exception while evaluating local_variables: %s", bang)
- var_list([], binding, 'local')
- end
-
- when /^\s*i(?:nstance)?\s*(\d+)?\s+((?:[\\+-]0x)[\dabcdef]+)?/
- new_binding = getBinding($1)
- if new_binding then
- binding = new_binding
- end
- begin
- @printer.printXml("<variables>")
- if $2 then
- obj = ObjectSpace._id2ref($2.hex)
- if (!obj) then
- @printer.debug("unknown object id : %s", $2)
- end
- else
- obj = debug_eval($', binding)
- end
- if (obj.class.name == "Array") then
- printArrayElements(obj)
- return
- end
- if (obj.class.name == "Hash") then
- printHashElements(obj)
- return
- end
- @printer.debug("%s", obj)
- instanceBinding = obj.instance_eval{binding()}
- obj.instance_variables.each {
- | instanceVar |
- @printer.printVariable(instanceVar, instanceBinding, 'instance')
- }
- classBinding = obj.class.class_eval('binding()')
- obj.class.class_variables.each {
- | classVar |
- @printer.printVariable(classVar, classBinding, 'class')
- }
- # I'd like to optimize getting the constants, but they are more dynamic
- # than one would expect from true constants.
- getConstantsInClass(obj.class).each {
- | constant |
- @printer.printVariable(constant, classBinding, 'constant')
- }
- rescue StandardError => error
- @printer.debug("%s", error)
- ensure
- @printer.printXml("</variables>")
- end
-
-
- when /^\s*inspect\s*(\d+)?\s+/
- new_binding = getBinding($1)
- if new_binding then
- binding = new_binding
- end
- begin
- obj = debug_eval($', binding, true)
- rescue ScriptError, StandardError => error
- @printer.printXml("<processingException type=\"%s\" message=\"%s\"/>", error.class, CGI.escapeHTML(error.message))
- return
- end
- @printer.debug("%s", obj)
- @printer.printXml("<variables>")
- @printer.printVariableValue($', obj, "local")
- @printer.printXml("</variables>")
- end
- end
-
- def debug_method_info(input, binding)
- case input
- when /^i(:?nstance)?\s+/
- obj = debug_eval($', binding) # correct highlighting since RDT editor does not recognize $'
-
- len = 0
- for v in obj.methods.sort
- len += v.size + 1
- if len > 70
- len = v.size + 1
- stdout.print "\n"
- end
- stdout.print v, " "
- end
- stdout.print "\n"
-
- else
- obj = debug_eval(input, binding)
- unless obj.kind_of? Module
- stdout.print "Should be Class/Module: ", input, "\n"
- else
- len = 0
- for v in obj.instance_methods.sort
- len += v.size + 1
- if len > 70
- len = v.size + 1
- stdout.print "\n"
- end
- stdout.print v, " "
- end
- stdout.print "\n"
- end
- end
- end
-
- def thnum(thread=Thread.current)
- num = DEBUGGER__.instance_eval{@thread_list[thread]}
- unless num
- DEBUGGER__.make_thread_list
- num = DEBUGGER__.instance_eval{@thread_list[thread]}
- end
- num
- end
-
- def processInput(input)
- binding, file, line, id = @frames[0]
- input.split(";").each {
- | singleCommand |
- readUserInput(binding, file, line, singleCommand.strip)
- }
- end
-
- def readUserInput(binding, binding_file, binding_line, input)
-
- @printer.debug("Processing #{input}, binding=%s", binding)
- @shouldResume = false
- frame_pos = 0
- previous_line = nil
- display_expressions(binding)
-
- case input
- when /^\s*tr(?:ace)?(?:\s+(on|off))?(?:\s+(all))?$/
- if defined?( $2 )
- if $1 == 'on'
- set_trace_all true
- else
- set_trace_all false
- end
- elsif defined?( $1 )
- if $1 == 'on'
- set_trace true
- else
- set_trace false
- end
- end
- if trace?
- stdout.print "Trace on.\n"
- else
- stdout.print "Trace off.\n"
- end
-
- when /^\s*b(?:reak)?\s+(?:(.+):)?([^.:]+)$/
- pos = $2
- file = File.basename($1)
- if pos =~ /^\d+$/
- pname = pos
- pos = pos.to_i
- else
- pname = pos = pos.intern.id2name
- end
- # TODO: pname is not used
- id = DEBUGGER__.next_breakpoint_id
- break_points[id] = Breakpoint.new(true, 0, file, pos)
- @printer.printXml("<breakpointAdded no=\"%d\" location=\"%s:%s\"/>", id, file, pos)
-
- when /^\s*delete\s+(.*)$/
- arg = $1
- if arg !~ /(?:^\d+$)/
- @printer.printError "Delete argument '#{arg}' needs to be positive number"
- else
- breakpoint_id = arg.to_i
- if break_points.delete(breakpoint_id)
- @printer.printXml("<breakpointDeleted no=\"%d\"/>", breakpoint_id)
- else
- @printer.printError("No breakpoint with id: %d. Currently following breakpoints defined: %s",
- breakpoint_id, break_points.keys.join(', '))
- end
- end
-
- # when /^\s*wat(?:ch)?\s+(.+)$/
- # exp = $1
- # break_points.push [true, 1, exp]
- # stdout.printf "Set watchpoint %d\n", break_points.size, exp
-
- # when /^\s*b(?:reak)?$/
- # if break_points.find{|b| b[1] == 0}
- # n = 1
- # stdout.print "Breakpoints:\n"
- # for b in break_points
- # if b[0] and b[1] == 0
- # stdout.printf " %d %s:%s\n", n, b[2], b[3]
- # end
- # n += 1
- # end
- # end
- # if break_points.find{|b| b[1] == 1}
- # n = 1
- # stdout.print "\n"
- # stdout.print "Watchpoints:\n"
- # for b in break_points
- # if b[0] and b[1] == 1
- # stdout.printf " %d %s\n", n, b[2]
- # end
- # n += 1
- # end
- # end
- # if break_points.size == 0
- # stdout.print "No breakpoints\n"
- # else
- # stdout.print "\n"
- # end
-
- # when /^\s*disp(?:lay)?\s+(.+)$/
- # exp = $1
- # display.push [true, exp]
- # stdout.printf "%d: ", display.size
- # display_expression(exp, binding)
- #
- # when /^\s*disp(?:lay)?$/
- # display_expressions(binding)
- #
- # when /^\s*undisp(?:lay)?(?:\s+(\d+))?$/
- # pos = $1
- # unless pos
- # input = readline("Clear all expressions? (y/n) ", false)
- # if input == "y"
- # for d in display
- # d[0] = false
- # end
- # end
- # else
- # pos = pos.to_i
- # if display[pos-1]
- # display[pos-1][0] = false
- # else
- # stdout.printf "Display expression %d is not defined\n", pos
- # end
- # end
-
- when /^\s*c(?:ont)?$/
- @shouldResume = true
-
- when /^\s*s(?:tep)?(?:\s+(\d+))?$/
- if $1
- lev = $1.to_i
- else
- lev = 1
- end
- @stop_next = lev
- @shouldResume = true
-
- when /^\s*n(?:ext)?(?:\s+(\d+))?$/
- if $1
- lev = $1.to_i
- else
- lev = 1
- end
- @stop_next = lev
- @no_step = @frames.size - frame_pos
- @shouldResume = true
-
- when /^\s*w(?:here)?$/, /^\s*f(?:rame)?$/
- display_frames(frame_pos)
-
- # when /^\s*fin(?:ish)?$/
- # if frame_pos == @frames.size
- # stdout.print "\"finish\" not meaningful in the outermost frame.\n"
- # else
- # @finish_pos = @frames.size - frame_pos
- # frame_pos = 0
- # prompt = false
- # end
- when /^\s*f(?:rame)?\s+(\d+)\s*$/
- @printer.debug("Setting frame to #{$1}")
- @current_frame = $1.to_i
-
-
- when /^\s*cat(?:ch)?(?:\s+(.+))?$/
- # $1 can also be nil
- @catch = $1
- @catch = nil if @catch == 'off'
- if @catch then
- @printer.debug("Catchpoint set to #{@catch}")
- else
- @printer.debug("Catchpoints disabled")
- end
-
-
- when /^\s*v(?:ar)?\s+/
- debug_variable_info($', binding)
-
- when /^\s*m(?:ethod)?\s+/
- debug_method_info($', binding)
-
- when /^\s*th(?:read)?\s+/
- DEBUGGER__.debug_thread_info($', binding)
-
- when /^\s*p\s+/
- stdout.printf "%s\n", debug_eval($', binding).inspect
-
- when /^\s*load\s+/
- @printer.debug("loading file: %s", $')
- begin
- load $'
- @printer.printLoadResult($')
- rescue Exception => error
- @printer.printLoadResult($', error)
- end
-
- when /^\s*exit$/
- @printer.printMessage("finished")
- set_trace_func nil
- @socket.close
- exit!
-
- else
- @printer.printMessage("Unknown input: %s", input)
- end
-
- end
-
- def display_expressions(binding)
- n = 1
- for d in display
- if d[0]
- stdout.printf "%d: ", n
- display_expression(d[1], binding)
- end
- n += 1
- end
- end
-
- def display_expression(exp, binding)
- stdout.printf "%s = %s\n", exp, debug_silent_eval(exp, binding).to_s
- end
-
- def frame_set_pos(binding, file, line, id)
- if @frames[0] then
- @frames[0][0] = binding
- @frames[0][1] = file
- @frames[0][2] = line
- @frames[0][3] = id
- else
- @frames[0] = [binding, file, line, id]
- end
- end
-
- def display_frames(pos)
- pos += 1
- n = 0
- at = @frames
- @printer.printXml("<frames>")
- for bind, file, line, id in at
- n += 1
- break unless bind
- @printer.printFrame(pos, n, file, line, id)
- end
- @printer.printXml("</frames>")
- end
-
- def debug_funcname(id)
- if id.nil?
- "toplevel"
- else
- id.id2name
- end
- end
-
- def debug_command(file, line, id, binding)
- @printer.debug("debug_command, @stop_next=%s, @frames.size=%s", @stop_next, @frames.size)
- if @stop_next == 0 && @frames.size > 0 then
- # write suspended only if the suspension was originated by stepping and not before the start
- # of the program
- @printer.printStepEnd(file, line, @frames.size)
- end
- set_last_thread(Thread.current)
-
- #readUserInput(binding, file, line )
- #Thread.stop
- end
-
- def check_break_points(file, pos, binding, id)
- return false if break_points.empty?
- file = File.basename(file)
- n = 1
- break_points.each_value do |b|
-# @printer.debug("file=%s, pos=%s; breakpoint=[valid=%s, type=%s, file=%s, pos=%s]\n ",
-# file, pos, b.valid, b.type, b.file, b.pos)
- if b.valid
- if b.type == 0 and b.file == file and b.pos == pos # breakpoint
- @printer.printBreakpoint(n, debug_funcname(id), file, pos)
- return true
- elsif b.type == 1 # watchpoint
- if debug_silent_eval(b.file, binding)
- stdout.printf "Watchpoint %d, %s at %s:%s\n", n, debug_funcname(id), file, pos
- return true
- end
- end
- end
- n += 1
- end
- return false
- end
-
- def excn_handle(file, line, id, binding)
-
- if $!.class <= SystemExit
- @printer.debug( "SystemExit at %s:%d: `%s' (%s)\n", file, line, $!, $!.class )
- set_trace_func nil
- exit
- end
- if @catch and ($!.class.ancestors.find { |e| e.to_s == @catch })
- @printer.printException(file, line, $!)
- fs = @frames.size
- tb = caller(0)[-fs..-1]
- stopCurrentThread
- @frames[0] = [binding, file, line, id]
- debug_command(file, line, id, binding)
- end
-
- end
-
- def trace_func(event, file, line, id, binding, klass)
- Tracer.trace_func(event, file, line, id, binding, klass) if trace?
-
- @file = file
- @line = line
- case event
- when 'line'
- # DEBUGGER__.printer().debug("trace line, file=%s, line=%s, stop_next=%d, binding=%s", file, line, @stop_next, binding)
- frame_set_pos(binding, file, line, id)
- if !@no_step or @frames.size == @no_step
- @stop_next -= 1
- @stop_next = -1 if @stop_next < 0
- elsif @frames.size < @no_step
- @stop_next = 0 # break here before leaving...
- else
- # nothing to do. skipped
- end
- if @stop_next == 0 or check_break_points(file, line, binding, id)
- @no_step = nil
- debug_command(file, line, id, binding)
- stopCurrentThread
- end
-
- when 'call'
-# DEBUGGER__.printer().debug("trace call, file=%s, line=%s, method=%s", file, line, id.id2name)
- @frames.unshift [binding, file, line, id]
- if check_break_points(file, id.id2name, binding, id) or
- check_break_points(klass.to_s, id.id2name, binding, id) then
- stopCurrentThread
- debug_command(file, line, id, binding)
- end
-
- when 'c-call'
- if @frames[0] then
- @frames[0][1] = file
- @frames[0][2] = line
- else
- @frames[0] = [binding, file, line, id]
- end
-
- when 'class'
- @frames.unshift [binding, file, line, id]
-
- when 'return', 'end'
-# DEBUGGER__.printer().debug("trace return and end, file=%s, line=%s", file, line)
- if @frames.size == @finish_pos
- @stop_next = 1
- @finish_pos = 0
- end
- @frames.shift
-
- when 'end'
-# DEBUGGER__.printer().debug("trace end, file=%s, line=%s", file, line)
- @frames.shift
-
- when 'raise'
- excn_handle(file, line, id, binding)
-
- end
- @last_file = file
- end
- end
-
- trap("INT") { DEBUGGER__.interrupt }
- @last_thread = Thread::main
- @max_thread = 1
- @max_breakpoint_id = 0
- @thread_list = {Thread::main => 1}
- @break_points = {} # id => Breakpoint
- @display = []
- @waiting = []
- @stdout = STDOUT
-
- class << DEBUGGER__
- def stdout
- @stdout
- end
-
- def stdout=(s)
- @stdout = s
- end
-
- def display
- @display
- end
-
- def break_points
- @break_points
- end
-
- def waiting
- @waiting
- end
-
- def set_trace( arg )
- Thread.critical = true
- make_thread_list
- for th in @thread_list
- context(th[0]).set_trace arg
- end
- Thread.critical = false
- end
-
- def set_last_thread(th)
- @last_thread = th
- end
-
- def suspend
- printer.debug("Suspending all")
- Thread.critical = true
- make_thread_list
- for th in @thread_list
- next if th[0] == Thread.current
- context(th[0]).set_suspend
- end
- Thread.critical = false
- # Schedule other threads to suspend as soon as possible.
- Thread.pass
- end
-
- def resume
- Thread.critical = true
- make_thread_list
- for th in @thread_list
- next if th[0] == Thread.current
- context(th[0]).clear_suspend
- end
- waiting.each do |th|
- th.run
- end
- waiting.clear
- Thread.critical = false
- # Schedule other threads to restart as soon as possible.
- Thread.pass
- end
-
- def context(thread=Thread.current)
- c = thread[:__debugger_data__]
- unless c
- thread[:__debugger_data__] = c = Context.new
- end
- c
- end
-
- def findThread(context)
- for thread in Thread::list
- if context == thread[:__debugger_data__]
- return thread
- end
- end
- end
-
- def interrupt
- context(@last_thread).stop_next
- end
-
- def get_thread(num)
- th = @thread_list.index(num)
- unless th
- printer.debug("No thread ##{num}\n")
- end
- th
- end
-
- def get_thread_num(thread=Thread.current)
- make_thread_list
- @thread_list[thread]
- end
-
- def print_thread(thread)
- num = @thread_list[thread]
- printer.printThread(num, thread)
- end
-
- def thread_list_all
- printer.printXml("<threads>")
- for num in @thread_list.values.sort
- printer.printThread(num, get_thread(num))
- end
- printer.printXml("</threads>")
- end
-
- def make_thread_list
- hash = {}
- for th in Thread::list
- next if th == @@inputReader
- if @thread_list.key? th
- hash[th] = @thread_list[th]
- else
- @max_thread += 1
- hash[th] = @max_thread
- end
- end
- @thread_list = hash
- end
-
- def debug_thread_info(input, binding)
- case input
- when /^l(?:ist)?/
- make_thread_list
- thread_list_all
-
- when /^c(?:ur(?:rent)?)?$/
- make_thread_list
- print_thread()
-
- when /^(?:sw(?:itch)?\s+)?(\d+)/
- make_thread_list
- th = get_thread($1.to_i)
- if th == Thread.current
- @stdout.print "It's the current thread.\n"
- else
- print_thread(th)
- context(th).stop_next
- th.run
- return
- end
-
- when /^stop\s+(\d+)/
- make_thread_list
- th = get_thread($1.to_i)
- if th == Thread.current
- @stdout.print "It's the current thread.\n"
- elsif th.stop?
- @stdout.print "Already stopped.\n"
- else
- print_thread(th)
- context(th).suspend
- end
-
- when /^resume\s+(\d+)/
- make_thread_list
- th = get_thread($1.to_i)
- if th == Thread.current
- @stdout.print "It's the current thread.\n"
- elsif !th.stop?
- @stdout.print "Already running."
- else
- print_thread(th)
- th.run
- end
-
- when /^change\s+(\d+)/
- make_thread_list
- th = get_thread($1.to_i)
- print_thread(th)
- return context(th)
- end
- end
-
- def next_breakpoint_id
- @max_breakpoint_id += 1
- end
- end
-
- @@socket = nil
- @@printer = nil
- @@inputReader = nil
- @@isStarted = false
-
- def DEBUGGER__.printer
- @@printer
- end
-
- def DEBUGGER__.socket
- @@socket
- end
-
- def DEBUGGER__.isStarted
- @@isStarted
- end
-
- def DEBUGGER__.setStarted
- @@isStarted = true
- end
-
-
- def DEBUGGER__.inputReader
- @@inputReader
- end
-
- def DEBUGGER__.traceOn()
- set_trace_func @@traceProc
- Thread.critical = false
- end
-
- def DEBUGGER__.traceOff()
- Thread.critical = true
- set_trace_func nil
- end
-
- def DEBUGGER__.readCommandLoop()
- sleep(1.0) # workaround for large files with ruby 1.6.8, otherwise parse exceptions
- loop do
- sleep(0.1)
- new_data, _, _ = IO.select( [socket], nil, nil, 0.001 )
- next unless new_data
- DEBUGGER__.traceOff()
- input = new_data[0].gets
- unless input
- @@printer.debug "Socket #{socket} closed. Ending."
- break
- end
- input.chomp!
- input.strip!
- @@printer.debug("READ #{input}")
- if !DEBUGGER__.isStarted && input == "cont" then
- DEBUGGER__.setStarted()
- DEBUGGER__.traceOn()
- next
- end
- input =~ /^th\s+(\d+)\s*;\s*/
- if $~ then
- @@printer.debug("Using context for thread: %s", $1.to_i)
- context = DEBUGGER__.context(get_thread($1.to_i))
- input = input[$~[0].length..input.length]
- else
- @@printer.debug("Using context for main thread : %s", Thread.main)
- context = DEBUGGER__.context(Thread.main)
- end
- context.processInput(input)
- if context.shouldResume then
- threadToResume = DEBUGGER__.findThread(context)
- end
- DEBUGGER__.traceOn()
- next unless threadToResume
- threadToResume.run()
- end
- end
-
- # use 127.0.0.1 instead of localhost because OSX 10.4
- server = TCPServer.new('127.0.0.1', REMOTE_DEBUG_PORT)
- puts "ruby #{RUBY_VERSION} debugger listens on port #{REMOTE_DEBUG_PORT}"
- $stdout.flush
- STDERR.sync = true
- @@socket = server.accept
- @@printer = XmlPrinter.new(@@socket)
- @@printer.debug("Socket connection established.")
-
- @@printer.debug("Starting command reader loop.")
- @@inputReader = Thread.new {
- begin
- DEBUGGER__.readCommandLoop()
- rescue ScriptError, StandardError => error
- y error
- y error.backtrace
- end
- }
-
- @@traceProc = proc { |event, file, line, id, binding, klass, *rest|
-
- #@@printer.debug("trace %s, %s:%s", event, file, line)
- next if Thread.current == DEBUGGER__.inputReader
- next if file =~ /classic-debug.rb$/
- #@@printer.debug("trace %s, %s:%s", event, file, line)
- while (!DEBUGGER__.isStarted) do
- @@printer.debug("Debugging not yet started.")
- sleep(1)
- end
- DEBUGGER__.context.trace_func event, file, line, id, binding, klass
- }
-
- @@printer.debug("Setting trace func: %s", @@traceProc)
- set_trace_func @@traceProc
-end
+# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+# Copyright (C) 2000 Information-technology Promotion Agency, Japan
+
+require 'cgi'
+require 'thread'
+require 'yaml'
+require 'socket'
+require 'tracer'
+require 'xml_printer'
+require 'context'
+
+# REMOTE_DEBUG_PORT is the port on which the debugger waits for commands from a
+# front-end.
+#
+# RDT note: if you change this, you must also change the corresponding port in
+# org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy
+REMOTE_DEBUG_PORT = (defined? $RemoteDebugPort) ? $RemoteDebugPort : 1098
+
+# VERBOSE_DEBUGGER prints the communication between a front-end and ruby
+# debugger on stderr. If you have started a front-end debug session (and use
+# default preferences for colors of streams), the communication will be printed
+# in red letters to the front-end console.
+VERBOSE_DEBUGGER = defined? DebugVerbose
+
+class Tracer
+ def Tracer.trace_func(*vars)
+ Single.trace_func(*vars)
+ end
+end
+
+SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
+
+class DC_DEBUGGER__
+
+ # type: 0 - breakpoint, 1 - watchpoint
+ Breakpoint = Struct.new("Breakpoint", :valid, :type, :file, :pos)
+
+ trap("INT") { DC_DEBUGGER__.interrupt }
+ @last_thread = Thread::main
+ @max_thread = 1
+ @max_breakpoint_id = 0
+ @thread_list = {Thread::main => 1}
+ @break_points = {} # id => Breakpoint
+ @display = []
+ @waiting = []
+ @stdout = STDOUT
+
+ class << DC_DEBUGGER__
+ def stdout
+ @stdout
+ end
+
+ def stdout=(s)
+ @stdout = s
+ end
+
+ def display
+ @display
+ end
+
+ def break_points
+ @break_points
+ end
+
+ def waiting
+ @waiting
+ end
+
+ def set_trace( arg )
+ Thread.critical = true
+ make_thread_list
+ for th in @thread_list
+ context(th[0]).set_trace arg
+ end
+ Thread.critical = false
+ end
+
+ def set_last_thread(th)
+ @last_thread = th
+ end
+
+ def suspend
+ printer.debug("Suspending all")
+ Thread.critical = true
+ make_thread_list
+ for th in @thread_list
+ next if th[0] == Thread.current
+ context(th[0]).set_suspend
+ end
+ Thread.critical = false
+ # Schedule other threads to suspend as soon as possible.
+ Thread.pass
+ end
+
+ def resume
+ Thread.critical = true
+ make_thread_list
+ for th in @thread_list
+ next if th[0] == Thread.current
+ context(th[0]).clear_suspend
+ end
+ waiting.each do |th|
+ th.run
+ end
+ waiting.clear
+ Thread.critical = false
+ # Schedule other threads to restart as soon as possible.
+ Thread.pass
+ end
+
+ def context(thread=Thread.current)
+ c = thread[:__debugger_data__]
+ unless c
+ thread[:__debugger_data__] = c = DC_DEBUGGER__::Context.new
+ end
+ c
+ end
+
+ def find_thread(context)
+ for thread in Thread::list
+ if context == thread[:__debugger_data__]
+ return thread
+ end
+ end
+ @@printer.debug("thread for context '#{context}' was not found")
+ nil
+ end
+
+ def interrupt
+ context(@last_thread).stop_next
+ end
+
+ def get_thread(num)
+ th = @thread_list.index(num)
+ unless th
+ printer.debug("No thread ##{num}\n")
+ end
+ th
+ end
+
+ def get_thread_num(thread=Thread.current)
+ Thread.critical = true
+ make_thread_list
+ n = @thread_list[thread]
+ Thread.critical = false
+ n
+ end
+
+ def print_thread(thread)
+ num = @thread_list[thread]
+ printer.print_thread(num, thread)
+ end
+
+ def thread_list_all
+ printer.synchronize do
+ printer.print_xml("<threads>")
+ for num in @thread_list.values.sort
+ printer.print_thread(num, get_thread(num))
+ end
+ printer.print_xml("</threads>")
+ end
+ end
+
+ def make_thread_list
+ hash = {}
+ for th in Thread::list
+ next if th == @@input_reader
+ if @thread_list.key? th
+ hash[th] = @thread_list[th]
+ else
+ @max_thread += 1
+ hash[th] = @max_thread
+ end
+ end
+ @thread_list = hash
+ end
+
+ def debug_thread_info(input, binding)
+ case input
+ when /^l(?:ist)?/
+ make_thread_list
+ thread_list_all
+
+ when /^c(?:ur(?:rent)?)?$/
+ make_thread_list
+ print_thread()
+
+ when /^(?:sw(?:itch)?\s+)?(\d+)/
+ make_thread_list
+ th = get_thread($1.to_i)
+ if th == Thread.current
+ @stdout.print "It's the current thread.\n"
+ else
+ print_thread(th)
+ context(th).stop_next
+ th.run
+ return
+ end
+
+ when /^stop\s+(\d+)/
+ make_thread_list
+ th = get_thread($1.to_i)
+ if th == Thread.current
+ @stdout.print "It's the current thread.\n"
+ elsif th.stop?
+ @stdout.print "Already stopped.\n"
+ else
+ print_thread(th)
+ context(th).suspend
+ end
+
+ when /^resume\s+(\d+)/
+ make_thread_list
+ th = get_thread($1.to_i)
+ if th == Thread.current
+ @stdout.print "It's the current thread.\n"
+ elsif !th.stop?
+ @stdout.print "Already running."
+ else
+ print_thread(th)
+ th.run
+ end
+
+ when /^change\s+(\d+)/
+ make_thread_list
+ th = get_thread($1.to_i)
+ print_thread(th)
+ return context(th)
+ end
+ end
+
+ def next_breakpoint_id
+ @max_breakpoint_id += 1
+ end
+ end
+
+ @@socket = nil
+ @@printer = nil
+ @@input_reader = nil
+ @@is_started = false
+
+ def DC_DEBUGGER__.printer
+ @@printer
+ end
+
+ def DC_DEBUGGER__.socket
+ @@socket
+ end
+
+ def DC_DEBUGGER__.is_started
+ @@is_started
+ end
+
+ def DC_DEBUGGER__.set_started
+ @@is_started = true
+ end
+
+
+ def DC_DEBUGGER__.input_reader
+ @@input_reader
+ end
+
+ def DC_DEBUGGER__.trace_on()
+ debug_commons_set_trace_func @@trace_proc
+ Thread.critical = false
+ end
+
+ def DC_DEBUGGER__.trace_off()
+ Thread.critical = true
+ debug_commons_set_trace_func nil
+ end
+
+ def DC_DEBUGGER__.read_command_loop()
+ sleep(1.0) # workaround for large files with ruby 1.6.8, otherwise parse exceptions
+ loop do
+ sleep(0.1)
+ new_data, _, _ = IO.select( [socket], nil, nil, 0.001 )
+ next unless new_data
+ DC_DEBUGGER__.trace_off()
+ input = new_data[0].gets
+ unless input
+ @@printer.debug "Socket #{socket} closed. Ending."
+ break
+ end
+ input.chomp!
+ input.strip!
+ @@printer.debug("READ #{input}")
+ if !DC_DEBUGGER__.is_started && input == "cont" then
+ DC_DEBUGGER__.set_started()
+ DC_DEBUGGER__.trace_on()
+ next
+ end
+ input =~ /^th\s+(\d+)\s*;\s*/
+ if $~ then
+ @@printer.debug("Using context for thread: %s", $1.to_i)
+ th = get_thread($1.to_i)
+ unless th
+ @@printer.debug("Cannot find thread ##{$1.to_i}. Skipping command '#{input}'")
+ DC_DEBUGGER__.trace_on()
+ next
+ end
+ context = DC_DEBUGGER__.context(th)
+ input = input[$~[0].length..input.length]
+ else
+ @@printer.debug("Using context for main thread : %s", Thread.main)
+ context = DC_DEBUGGER__.context(Thread.main)
+ end
+ context.process_input(input)
+ if context.should_resume then
+ thread_to_resume = DC_DEBUGGER__.find_thread(context)
+ end
+ DC_DEBUGGER__.trace_on()
+ next unless thread_to_resume
+ thread_to_resume.run()
+ end
+ end
+
+ # use 127.0.0.1 instead of localhost because OSX 10.4
+ server = TCPServer.new('127.0.0.1', REMOTE_DEBUG_PORT)
+ puts "ruby #{RUBY_VERSION} debugger listens on port #{REMOTE_DEBUG_PORT}"
+ $stdout.flush
+ STDERR.sync = true
+ @@socket = server.accept
+ @@printer = DC_DEBUGGER__::XmlPrinter.new(@@socket)
+ @@printer.debug("Socket connection established.")
+
+ @@printer.debug("Starting command reader loop.")
+ @@input_reader = Thread.new {
+ begin
+ DC_DEBUGGER__.read_command_loop()
+ rescue ScriptError, StandardError => error
+ y error
+ y error.backtrace
+ end
+ }
+
+ @@trace_proc = proc { |event, file, line, id, binding, klass, *rest|
+ #@@printer.debug("trace %s, %s:%s", event, file, line)
+ next if Thread.current == DC_DEBUGGER__.input_reader
+ next if file =~ /classic-debug.rb$/
+ #@@printer.debug("trace %s, %s:%s", event, file, line)
+ while (!DC_DEBUGGER__.is_started) do
+ @@printer.debug("Debugging not yet started.")
+ sleep(1)
+ end
+ DC_DEBUGGER__.context.trace_func(event, file, line, id, binding, klass)
+ }
+
+ @@printer.debug("Setting trace func: %s", @@trace_proc)
+ Kernel.module_eval(<<-"end;"
+ alias_method(:debug_commons_set_trace_func, :set_trace_func)
+ def set_trace_func(proc)
+ raise "Cannot call 'set_trace_func' method during debugging session."
+ end
+ end;
+ )
+ debug_commons_set_trace_func @@trace_proc
+
+end
Added: trunk/org.rubypeople.rdt.launching/ruby/classic-debug.txt
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/classic-debug.txt (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/classic-debug.txt 2007-08-09 12:52:23 UTC (rev 2947)
@@ -0,0 +1,108 @@
+Here you will find information about Classic Debugger. [WORK IN PROGRESS]
+
+Q: How can I change the default port (1098) on which Classic Debugger is
+ listening?
+
+A: During its startup, classic-debug.rb, takes a look whether $RemoteDebugPort
+ global variable is defined. If yes the debugger will use the value of
+ $RemoteDebugPort variable, otherwise default port (1098) is used. So you may
+ start the debugger with requiring a script with "$RemoteDebugPort=46951" as
+ the only content. E.g.:
+
+ $ ruby -r classic-debug.rb test.rb # default port will be used
+ ruby 1.8.5 debugger listens on port 1098
+
+ $ cat my_port.rb
+ $RemoteDebugPort=12345
+ $ ruby -r my_port.rb -r classic-debug.rb test.rb # port 12345 will be used
+ ruby 1.8.5 debugger listens on port 12345
+
+
+========================================================================
+========================================================================
+
+Protocol Specification:
+-----------------------
+
+ <frame_no> ::= <int>
+ <id> ::= <int>
+ <line_no> ::= <int>
+ <path> ::= [path_to_script]
+ <status> ::= run|sleep
+
+========================================================================
+Adding breakpoint
+-----------------
+
+Command:
+
+ b <script>:<line_no>
+ b test.rb:2
+
+Answer:
+
+ <breakpointAdded no="<id>" location="<script>:<line_no>"/>
+ <breakpointAdded no="1" location="test.rb:2"/>
+
+========================================================================
+Breakpoint hit event
+--------------------
+
+ <breakpoint file="<script>" line="<line_no>" threadId="<id>"/>
+ <breakpoint file="test.rb" line="2" threadId="1"/>
+
+========================================================================
+Thread listing
+--------------
+
+Command:
+
+ th l
+
+Answer:
+
+ <threads>
+ <thread id="<id>" status="<status>"/>
+ <thread id="2" status="sleep"/>
+ </threads>
+
+========================================================================
+Frame listing
+-------------
+
+Command:
+
+ th 1; w
+
+Answer:
+
+ <frames>
+ <frame no="<frame_no>" file="<script>" line="<line_no>"/>
+ </frames>
+
+========================================================================
+Variables listing
+-----------------
+
+Command:
+
+ frame 1; v local
+
+Answer:
+
+ <variables>
+ <variable name="array" kind="local" value="Array (2 element(s))" type="Array" hasChildren="true" objectId="-0x2418a904"/>
+ </variables>
+
+Command:
+
+ v i array
+
+Answer:
+
+ <variables>
+ <variable name="[0]" kind="instance" value="1" type="Fixnum" hasChildren="false" objectId="+0x3"/>
+ <variable name="[1]" kind="instance" value="2" type="Fixnum" hasChildren="false" objectId="+0x5"/>
+ </variables>
+
+========================================================================
Property changes on: trunk/org.rubypeople.rdt.launching/ruby/classic-debug.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.launching/ruby/context.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/context.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/context.rb 2007-08-09 12:52:23 UTC (rev 2947)
@@ -0,0 +1,625 @@
+class DC_DEBUGGER__
+
+ class Context
+
+ attr_reader :should_resume
+
+ def initialize
+ @printer = DC_DEBUGGER__.printer
+ @socket = DC_DEBUGGER__.socket
+ @stop_next = 0
+ @last_file = nil
+ @file = nil
+ @line = nil
+ @no_step = nil
+ @frames = []
+ @current_frame = -1
+ @finish_pos = 0
+ @trace = false
+ @catch = nil # "StandardError"
+ @suspend_next = false
+ @should_resume = false
+ end
+
+ def stop_next(n=1)
+ @stop_next = n
+ end
+
+ def set_suspend
+ @suspend_next = true
+ end
+
+ def clear_suspend
+ @suspend_next = false
+ end
+
+ def stop_current_thread
+ @printer.debug("Suspending : %s", Thread.current)
+ Thread.stop()
+ @printer.debug("Resumed : %s", Thread.current)
+ end
+
+ def trace?
+ @trace
+ end
+
+ def set_trace(arg)
+ @trace = arg
+ end
+
+ def stdout
+ if @socket then
+ @socket
+ else
+ DC_DEBUGGER__.stdout
+ end
+ end
+
+ def break_points
+ DC_DEBUGGER__.break_points
+ end
+
+ def display
+ DC_DEBUGGER__.display
+ end
+
+ def context(th)
+ DC_DEBUGGER__.context(th)
+ end
+
+ def set_trace_all(arg)
+ DC_DEBUGGER__.set_trace(arg)
+ end
+
+ def set_last_thread(th)
+ DC_DEBUGGER__.set_last_thread(th)
+ end
+
+ def debug_eval_private(str, binding)
+ # evaluates str like "var.@instance_var.@instance_var"
+ # and "var.private_method"
+ # return value might be nil
+ # the scan must detect array and hash accesses, which might
+ # themselves contain point separated expressions, e.g.
+ # array[Test.getX].y
+ names = str.scan(/[^\[\]]*(?=\.)|.*\[.*\](?=\.)|.*$/)
+ # names can contain empty strings
+ obj = eval(names[0], binding)
+ (1..names....
[truncated message content] |
|
From: <caw...@us...> - 2007-08-09 12:50:12
|
Revision: 2946
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2946&view=rev
Author: cawilliams
Date: 2007-08-09 05:50:11 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby/loadpath.rb
Deleted: trunk/org.rubypeople.rdt.launching/ruby/loadpath.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/loadpath.rb 2007-08-09 12:49:59 UTC (rev 2945)
+++ trunk/org.rubypeople.rdt.launching/ruby/loadpath.rb 2007-08-09 12:50:11 UTC (rev 2946)
@@ -1,2 +0,0 @@
-puts RUBY_VERSION
-puts $LOAD_PATH - ['.']
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:50:00
|
Revision: 2945
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2945&view=rev
Author: cawilliams
Date: 2007-08-09 05:49:59 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
move loadpath grabbing script into own folder to try and help avoid filename collisions
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/standard_vm_type/
trunk/org.rubypeople.rdt.launching/ruby/standard_vm_type/loadpath.rb
Copied: trunk/org.rubypeople.rdt.launching/ruby/standard_vm_type/loadpath.rb (from rev 2706, trunk/org.rubypeople.rdt.launching/ruby/loadpath.rb)
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/standard_vm_type/loadpath.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/standard_vm_type/loadpath.rb 2007-08-09 12:49:59 UTC (rev 2945)
@@ -0,0 +1,2 @@
+puts RUBY_VERSION
+puts $LOAD_PATH - ['.']
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java 2007-08-09 12:41:34 UTC (rev 2944)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java 2007-08-09 12:49:59 UTC (rev 2945)
@@ -145,7 +145,7 @@
private LibraryInfo generateLibraryInfo(File rubyHome, File rubyExecutable) {
LibraryInfo info = null;
//locate the script to grab us our loadpaths
- File file = LaunchingPlugin.getFileInPlugin(new Path("ruby/loadpath.rb")); //$NON-NLS-1$
+ File file = LaunchingPlugin.getFileInPlugin(new Path("ruby").append("standard_vm_type").append("loadpath.rb")); //$NON-NLS-1$
if (file.exists()) {
String rubyExecutablePath = rubyExecutable.getAbsolutePath();
String[] cmdLine = new String[] {rubyExecutablePath, file.getAbsolutePath()}; //$NON-NLS-1$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:41:35
|
Revision: 2944
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2944&view=rev
Author: cawilliams
Date: 2007-08-09 05:41:34 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
move stream flush script to it's own directory to further try to minimze possibility of having added it's folder to loadpath from causing filename load collisions.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/flush/rdt_stream_sync.rb
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb
Copied: trunk/org.rubypeople.rdt.launching/ruby/flush/rdt_stream_sync.rb (from rev 2941, trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb)
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/flush/rdt_stream_sync.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/flush/rdt_stream_sync.rb 2007-08-09 12:41:34 UTC (rev 2944)
@@ -0,0 +1,2 @@
+STDOUT.sync = true
+STDERR.sync = true
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb 2007-08-09 12:41:26 UTC (rev 2943)
+++ trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb 2007-08-09 12:41:34 UTC (rev 2944)
@@ -1,2 +0,0 @@
-STDOUT.sync = true
-STDERR.sync = true
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-09 12:41:26 UTC (rev 2943)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-09 12:41:34 UTC (rev 2944)
@@ -268,7 +268,7 @@
}
protected void addStreamSync(List<String> arguments) {
- File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby").append(STREAM_FLUSH_SCRIPT));
+ File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby").append("flush").append(STREAM_FLUSH_SCRIPT));
arguments.add(LOADPATH_SWITCH);
arguments.add(sync.getParent());
arguments.add("-r" + STREAM_FLUSH_SCRIPT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:41:27
|
Revision: 2943
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2943&view=rev
Author: cawilliams
Date: 2007-08-09 05:41:26 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
move stream flush script to it's own directory to further try to minimze possibility of having added it's folder to loadpath from causing filename load collisions.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-08-09 12:37:48 UTC (rev 2942)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-08-09 12:41:26 UTC (rev 2943)
@@ -110,7 +110,7 @@
buffer.append(" -I ");
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
- buffer.append(LaunchingPlugin.getFileInPlugin(new Path("ruby").append(StandardVMRunner.STREAM_FLUSH_SCRIPT)).getParent());
+ buffer.append(LaunchingPlugin.getFileInPlugin(new Path("ruby").append("flush").append(StandardVMRunner.STREAM_FLUSH_SCRIPT)).getParent());
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
buffer.append(" -r" + StandardVMRunner.STREAM_FLUSH_SCRIPT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:37:49
|
Revision: 2942
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2942&view=rev
Author: cawilliams
Date: 2007-08-09 05:37:48 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/flush/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:30:50
|
Revision: 2941
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2941&view=rev
Author: cawilliams
Date: 2007-08-09 05:30:46 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
fix #5493 - RDT's sync.rb stream flushing script clashes names with a ruby Standard library file
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby/sync.rb
Copied: trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb (from rev 2801, trunk/org.rubypeople.rdt.launching/ruby/sync.rb)
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/rdt_stream_sync.rb 2007-08-09 12:30:46 UTC (rev 2941)
@@ -0,0 +1,2 @@
+STDOUT.sync = true
+STDERR.sync = true
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.launching/ruby/sync.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/sync.rb 2007-08-09 12:30:38 UTC (rev 2940)
+++ trunk/org.rubypeople.rdt.launching/ruby/sync.rb 2007-08-09 12:30:46 UTC (rev 2941)
@@ -1,2 +0,0 @@
-STDOUT.sync = true
-STDERR.sync = true
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-09 12:30:38 UTC (rev 2940)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-09 12:30:46 UTC (rev 2941)
@@ -33,8 +33,8 @@
public class StandardVMRunner extends AbstractVMRunner {
+ public static final String STREAM_FLUSH_SCRIPT = "rdt_stream_sync.rb";
private static final String LOADPATH_SWITCH = "-I";
-
protected static final String END_OF_OPTIONS_DELIMITER = "--";
protected IVMInstall fVMInstance;
@@ -268,10 +268,10 @@
}
protected void addStreamSync(List<String> arguments) {
- File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby/sync.rb"));
+ File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby").append(STREAM_FLUSH_SCRIPT));
arguments.add(LOADPATH_SWITCH);
arguments.add(sync.getParent());
- arguments.add("-rsync.rb");
+ arguments.add("-r" + STREAM_FLUSH_SCRIPT);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-09 12:30:41
|
Revision: 2940
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2940&view=rev
Author: cawilliams
Date: 2007-08-09 05:30:38 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
fix #5493 - RDT's sync.rb stream flushing script clashes names with a ruby Standard library file
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-08-08 16:50:16 UTC (rev 2939)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-08-09 12:30:38 UTC (rev 2940)
@@ -110,10 +110,10 @@
buffer.append(" -I ");
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
- buffer.append(LaunchingPlugin.getFileInPlugin(new Path("ruby/sync.rb")).getParent());
+ buffer.append(LaunchingPlugin.getFileInPlugin(new Path("ruby").append(StandardVMRunner.STREAM_FLUSH_SCRIPT)).getParent());
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
- buffer.append(" -rsync.rb");
+ buffer.append(" -r" + StandardVMRunner.STREAM_FLUSH_SCRIPT);
}
public void testDebugEnabled() throws Exception {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-08 16:50:18
|
Revision: 2939
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2939&view=rev
Author: cawilliams
Date: 2007-08-08 09:50:16 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
handle getGemInstallPath returning null inside getGemPath (http://www.aptana.com/forums/viewtopic.php?p=9244#9244)
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-08 14:12:35 UTC (rev 2938)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-08 16:50:16 UTC (rev 2939)
@@ -640,9 +640,11 @@
public IPath getGemPath(String gemName) {
IPath path = getGemInstallPath();
+ if (path == null) return null;
path = path.append("gems");
File gemFolder = path.toFile();
File[] gems = gemFolder.listFiles();
+ if (gems == null) return null;
for (int i = 0; i < gems.length; i++) {
if (gems[i].getName().startsWith(gemName))
return new Path(gems[i].getAbsolutePath()).append("lib");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-08 14:12:37
|
Revision: 2938
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2938&view=rev
Author: cawilliams
Date: 2007-08-08 07:12:35 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-08-08 14:10:42 UTC (rev 2937)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-08-08 14:12:35 UTC (rev 2938)
@@ -133,7 +133,7 @@
import org.rubypeople.rdt.ui.actions.OpenEditorActionGroup;
import org.rubypeople.rdt.ui.actions.RubyActionGroup;
import org.rubypeople.rdt.ui.actions.RubySearchActionGroup;
-import org.rubypeople.rdt.ui.actions.ShowInPackageViewAction;
+import org.rubypeople.rdt.ui.actions.ShowInRubyResourcesViewAction;
import org.rubypeople.rdt.ui.actions.SurroundWithBeginRescueAction;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProvider;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProviderExtension;
@@ -277,7 +277,7 @@
WorkbenchHelp.setHelp(action, IRubyHelpContextIds.TOGGLE_COMMENT_ACTION);
configureToggleCommentAction();
- action= new ShowInPackageViewAction(this);
+ action= new ShowInRubyResourcesViewAction(this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.SHOW_IN_RUBY_RESOURCES_VIEW);
setAction("ShowInPackageView", action); //$NON-NLS-1$
Deleted: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java 2007-08-08 14:10:42 UTC (rev 2937)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java 2007-08-08 14:12:35 UTC (rev 2938)
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.ui.actions;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.PlatformUI;
-import org.rubypeople.rdt.core.IOpenable;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
-import org.rubypeople.rdt.internal.ui.RubyPlugin;
-import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
-import org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView;
-import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
-/**
- * This action reveals the currently selected Ruby element in the
- * package explorer.
- * <p>
- * The action is applicable to selections containing elements of type
- * <code>IRubyElement</code>.
- *
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class ShowInPackageViewAction extends SelectionDispatchAction {
-
- private RubyEditor fEditor;
-
- /**
- * Creates a new <code>ShowInPackageViewAction</code>. The action requires
- * that the selection provided by the site's selection provider is of type
- * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
- *
- * @param site the site providing context information for this action
- */
- public ShowInPackageViewAction(IWorkbenchSite site) {
- super(site);
- setText(ActionMessages.ShowInPackageViewAction_label);
- setDescription(ActionMessages.ShowInPackageViewAction_description);
- setToolTipText(ActionMessages.ShowInPackageViewAction_tooltip);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.SHOW_IN_PACKAGEVIEW_ACTION);
- }
-
- /**
- * Note: This constructor is for internal use only. Clients should not call this constructor.
- * @param editor the Ruby editor
- */
- public ShowInPackageViewAction(RubyEditor editor) {
- this(editor.getEditorSite());
- fEditor= editor;
- setEnabled(SelectionConverter.canOperateOn(fEditor));
- }
-
- /* (non-Rubydoc)
- * Method declared on SelectionDispatchAction.
- */
- public void selectionChanged(ITextSelection selection) {
- }
-
- /* (non-Rubydoc)
- * Method declared on SelectionDispatchAction.
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(checkEnabled(selection));
- }
-
- private boolean checkEnabled(IStructuredSelection selection) {
- if (selection.size() != 1)
- return false;
- return selection.getFirstElement() instanceof IRubyElement;
- }
-
- /* (non-Rubydoc)
- * Method declared on SelectionDispatchAction.
- */
- public void run(ITextSelection selection) {
- try {
- IRubyElement element= SelectionConverter.getElementAtOffset(fEditor);
- if (element != null)
- run(element);
- } catch (RubyModelException e) {
- RubyPlugin.log(e);
- String message= ActionMessages.ShowInPackageViewAction_error_message;
- ErrorDialog.openError(getShell(), getDialogTitle(), message, e.getStatus());
- }
- }
-
- /* (non-Rubydoc)
- * Method declared on SelectionDispatchAction.
- */
- public void run(IStructuredSelection selection) {
- if (!checkEnabled(selection))
- return;
- run((IRubyElement)selection.getFirstElement());
- }
-
- /*
- * No Rubydoc. The method should be internal but can't be changed since
- * we shipped it with a public visibility
- */
- public void run(IRubyElement element) {
- if (element == null)
- return;
-
- // reveal the top most element only
- IOpenable openable= element.getOpenable();
- if (openable instanceof IRubyElement)
- element= (IRubyElement)openable;
-
- RubyResourcesView view= RubyResourcesView.openInActivePerspective();
- view.tryToReveal(element);
- }
-
- private static String getDialogTitle() {
- return ActionMessages.ShowInPackageViewAction_dialog_title;
- }
-}
Copied: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java (from rev 2936, trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java)
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInRubyResourcesViewAction.java 2007-08-08 14:12:35 UTC (rev 2938)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.IOpenable;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
+import org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView;
+import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
+/**
+ * This action reveals the currently selected Ruby element in the
+ * package explorer.
+ * <p>
+ * The action is applicable to selections containing elements of type
+ * <code>IRubyElement</code>.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ * @since 2.0
+ */
+public class ShowInRubyResourcesViewAction extends SelectionDispatchAction {
+
+ private RubyEditor fEditor;
+
+ /**
+ * Creates a new <code>ShowInPackageViewAction</code>. The action requires
+ * that the selection provided by the site's selection provider is of type
+ * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param site the site providing context information for this action
+ */
+ public ShowInRubyResourcesViewAction(IWorkbenchSite site) {
+ super(site);
+ setText(ActionMessages.ShowInPackageViewAction_label);
+ setDescription(ActionMessages.ShowInPackageViewAction_description);
+ setToolTipText(ActionMessages.ShowInPackageViewAction_tooltip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.SHOW_IN_PACKAGEVIEW_ACTION);
+ }
+
+ /**
+ * Note: This constructor is for internal use only. Clients should not call this constructor.
+ * @param editor the Ruby editor
+ */
+ public ShowInRubyResourcesViewAction(RubyEditor editor) {
+ this(editor.getEditorSite());
+ fEditor= editor;
+ setEnabled(SelectionConverter.canOperateOn(fEditor));
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void selectionChanged(ITextSelection selection) {
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ setEnabled(checkEnabled(selection));
+ }
+
+ private boolean checkEnabled(IStructuredSelection selection) {
+ if (selection.size() != 1)
+ return false;
+ return selection.getFirstElement() instanceof IRubyElement;
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void run(ITextSelection selection) {
+ try {
+ IRubyElement element= SelectionConverter.getElementAtOffset(fEditor);
+ if (element != null)
+ run(element);
+ } catch (RubyModelException e) {
+ RubyPlugin.log(e);
+ String message= ActionMessages.ShowInPackageViewAction_error_message;
+ ErrorDialog.openError(getShell(), getDialogTitle(), message, e.getStatus());
+ }
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void run(IStructuredSelection selection) {
+ if (!checkEnabled(selection))
+ return;
+ run((IRubyElement)selection.getFirstElement());
+ }
+
+ /*
+ * No Rubydoc. The method should be internal but can't be changed since
+ * we shipped it with a public visibility
+ */
+ public void run(IRubyElement element) {
+ if (element == null)
+ return;
+
+ // reveal the top most element only
+ IOpenable openable= element.getOpenable();
+ if (openable instanceof IRubyElement)
+ element= (IRubyElement)openable;
+
+ RubyResourcesView view= RubyResourcesView.openInActivePerspective();
+ view.tryToReveal(element);
+ }
+
+ private static String getDialogTitle() {
+ return ActionMessages.ShowInPackageViewAction_dialog_title;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-08 14:10:43
|
Revision: 2937
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2937&view=rev
Author: cawilliams
Date: 2007-08-08 07:10:42 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
add boolean flag to installgem so we can decide whether to install with dependencies
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java 2007-08-08 14:10:19 UTC (rev 2936)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java 2007-08-08 14:10:42 UTC (rev 2937)
@@ -20,9 +20,24 @@
*/
public Set<Gem> getRemoteGems();
+ /**
+ * Install the supplied gem including it's dependencies
+ *
+ * @param gem
+ * @return
+ */
public boolean installGem(Gem gem);
/**
+ * Install teh supplied gem
+ *
+ * @param gem
+ * @param includeDependencies
+ * @return
+ */
+ public boolean installGem(Gem gem, boolean includeDependencies);
+
+ /**
* Removes or uninstalls the supplied gem.
*
* @param gem
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-08 14:10:19 UTC (rev 2936)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-08 14:10:42 UTC (rev 2937)
@@ -61,6 +61,7 @@
public class GemManager implements IGemManager {
+ private static final String INCLUDE_DEPENDENCIES_SWITCH = "-y";
private static final String LOCAL_SWITCH = "-l";
private static final String LIST_COMMAND = "list";
private static final String INSTALL_COMMAND = "install";
@@ -446,10 +447,17 @@
/*
* (non-Javadoc)
- *
- * @see com.aptana.rdt.internal.gems.IGemManager#installGem(com.aptana.rdt.internal.gems.Gem)
+ * @see com.aptana.rdt.core.gems.IGemManager#installGem(com.aptana.rdt.core.gems.Gem)
*/
public boolean installGem(final Gem gem) {
+ return installGem(gem, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.aptana.rdt.core.gems.IGemManager#installGem(com.aptana.rdt.core.gems.Gem, boolean)
+ */
+ public boolean installGem(final Gem gem, boolean includeDependencies) {
if (!isRubyGemsInstalled()) return false;
try {
String command = INSTALL_COMMAND + " " + gem.getName();
@@ -457,6 +465,9 @@
&& gem.getVersion().trim().length() > 0) {
command += " " + VERSION_SWITCH + " " + gem.getVersion();
}
+ if (includeDependencies) {
+ command += " " + INCLUDE_DEPENDENCIES_SWITCH;
+ }
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
Job job = new Job("Installing gem " + gem.getName()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-08 14:10:22
|
Revision: 2936
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2936&view=rev
Author: cawilliams
Date: 2007-08-08 07:10:19 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
add Ruby Resources view as possible option for "show in" on Ruby Editor
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RdtActionConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-08-08 14:10:19 UTC (rev 2936)
@@ -186,6 +186,7 @@
<perspectiveShortcut
id="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
</perspectiveShortcut>
+ <showInPart id="org.rubypeople.rdt.ui.ViewRubyResources"/>
</perspectiveExtension>
<perspectiveExtension
targetID="org.rubypeople.rdt.ui.RubyBrowsingPerspective">
@@ -631,6 +632,12 @@
id="org.rubypeople.rdt.ui.navigate.ruby.open.structure">
</command>
<command
+ name="%ActionDefinition.showInPackageView.name"
+ description="%ActionDefinition.showInPackageView.description"
+ categoryId="org.eclipse.ui.category.navigate"
+ id="org.rubypeople.rdt.ui.edit.text.ruby.show.in.ruby.resources.view">
+ </command>
+ <command
name="%ActionDefinition.toggleComment.name"
description="%ActionDefinition.toggleComment.description"
categoryId="org.rubypeople.rdt.ui.category.source"
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/resourcesview/RubyResourcesView.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -12,6 +12,10 @@
package org.rubypeople.rdt.internal.ui.resourcesview;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -19,10 +23,17 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.IShowInTarget;
+import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.views.navigator.ResourceNavigator;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.RubyViewerFilter;
+import org.rubypeople.rdt.internal.ui.rubyeditor.ExternalRubyFileEditorInput;
+import org.rubypeople.rdt.internal.ui.rubyeditor.IRubyScriptEditorInput;
+import org.rubypeople.rdt.ui.RubyUI;
-public class RubyResourcesView extends ResourceNavigator {
+public class RubyResourcesView extends ResourceNavigator implements IShowInTarget {
private static String IS_RUBY_FILES_ONLY_MEMENTO_KEY = "isRubyFilesOnlyFilterActivated";
private boolean isRubyFilesOnlyFilterActivated = false; // default value if
@@ -82,4 +93,96 @@
}
super.editorActivated(editor) ;
}
+
+ public static RubyResourcesView openInActivePerspective() {
+ try {
+ return (RubyResourcesView)RubyPlugin.getActivePage().showView(RubyUI.ID_RUBY_RESOURCE_VIEW);
+ } catch(PartInitException pe) {
+ return null;
+ }
+ }
+
+ public boolean tryToReveal(Object element) {
+ if (revealElementOrParent(element))
+ return true;
+ return false;
+ }
+
+ private boolean revealElementOrParent(Object element) {
+ if (revealAndVerify(element))
+ return true;
+ element= getVisibleParent(element);
+ if (element != null) {
+ if (revealAndVerify(element))
+ return true;
+ if (element instanceof IRubyElement) {
+ IResource resource= ((IRubyElement)element).getResource();
+ if (resource != null) {
+ if (revealAndVerify(resource))
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean revealAndVerify(Object element) {
+ if (element == null)
+ return false;
+ selectReveal(new StructuredSelection(element));
+ return ! getSite().getSelectionProvider().getSelection().isEmpty();
+ }
+
+ private Object getVisibleParent(Object object) {
+ if (object == null)
+ return null;
+ if (!(object instanceof IRubyElement))
+ return object;
+ IRubyElement element2= (IRubyElement) object;
+ switch (element2.getElementType()) {
+ case IRubyElement.IMPORT_DECLARATION:
+ case IRubyElement.IMPORT_CONTAINER:
+ case IRubyElement.TYPE:
+ case IRubyElement.METHOD:
+ case IRubyElement.FIELD:
+ // select parent script
+ element2= (IRubyElement)element2.getOpenable();
+ break;
+ case IRubyElement.RUBY_MODEL:
+ element2= null;
+ break;
+ }
+ return element2;
+ }
+
+ public boolean show(ShowInContext context) {
+ ISelection selection= context.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ // fix for 64634 Navigate/Show in/Package Explorer doesn't work
+ IStructuredSelection structuredSelection= ((IStructuredSelection) selection);
+ if (structuredSelection.size() == 1 && tryToReveal(structuredSelection.getFirstElement()))
+ return true;
+ }
+
+ Object input= context.getInput();
+ if (input instanceof IEditorInput) {
+ Object elementOfInput= getElementOfInput((IEditorInput)context.getInput());
+ return elementOfInput != null && tryToReveal(elementOfInput);
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the element contained in the EditorInput
+ */
+ Object getElementOfInput(IEditorInput input) {
+ if (input instanceof IRubyScriptEditorInput)
+ return ((IRubyScriptEditorInput)input).getRubyScript();
+ else if (input instanceof IFileEditorInput)
+ return ((IFileEditorInput)input).getFile();
+ else if (input instanceof ExternalRubyFileEditorInput)
+ return ((ExternalRubyFileEditorInput)input).getStorage();
+ return null;
+ }
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -8,7 +8,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -133,6 +133,7 @@
import org.rubypeople.rdt.ui.actions.OpenEditorActionGroup;
import org.rubypeople.rdt.ui.actions.RubyActionGroup;
import org.rubypeople.rdt.ui.actions.RubySearchActionGroup;
+import org.rubypeople.rdt.ui.actions.ShowInPackageViewAction;
import org.rubypeople.rdt.ui.actions.SurroundWithBeginRescueAction;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProvider;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProviderExtension;
@@ -276,6 +277,10 @@
WorkbenchHelp.setHelp(action, IRubyHelpContextIds.TOGGLE_COMMENT_ACTION);
configureToggleCommentAction();
+ action= new ShowInPackageViewAction(this);
+ action.setActionDefinitionId(IRubyEditorActionDefinitionIds.SHOW_IN_RUBY_RESOURCES_VIEW);
+ setAction("ShowInPackageView", action); //$NON-NLS-1$
+
action= new GotoMatchingBracketAction(this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
@@ -757,8 +762,7 @@
}
protected void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
-
+ super.editorContextMenuAboutToShow(menu);
menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
ActionContext context= new ActionContext(getSelectionProvider().getSelection());
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -12,6 +12,11 @@
public static String SurroundWithBeginRescueAction_dialog_title;
public static String QuickMenuAction_menuTextWithShortcut;
+ public static String ShowInPackageViewAction_label;
+ public static String ShowInPackageViewAction_description;
+ public static String ShowInPackageViewAction_tooltip;
+ public static String ShowInPackageViewAction_error_message;
+ public static String ShowInPackageViewAction_dialog_title;
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -173,4 +173,11 @@
*/
public static final String OPEN_HIERARCHY= "org.rubypeople.rdt.ui.edit.text.ruby.open.hierarchy"; //$NON-NLS-1$
+
+ /**
+ * Action definition ID of the navigate -> show in ruby resources view action
+ * (value <code>"org.rubypeople.rdt.ui.edit.text.ruby.show.in.ruby.resources.view"</code>).
+ */
+ public static final String SHOW_IN_RUBY_RESOURCES_VIEW= "org.rubypeople.rdt.ui.edit.text.ruby.show.in.ruby.resources.view"; //$NON-NLS-1$
+
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RdtActionConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RdtActionConstants.java 2007-08-08 14:08:55 UTC (rev 2935)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RdtActionConstants.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -96,5 +96,9 @@
*/
public static final String FIND_WRITE_ACCESS_IN_WORKING_SET= "org.rubypeople.rdt.ui.actions.WriteAccessInWorkingSet"; //$NON-NLS-1$
-
+ /**
+ * Navigate menu: name of standard Show in Ruby Resources View global action
+ * (value <code>"org.rubypeople.rdt.ui.actions.ShowInRubyResourcesView"</code>).
+ */
+ public static final String SHOW_IN_RESOURCES_VIEW= "org.rubypeople.rdt.ui.actions.ShowInRubyResourcesView"; //$NON-NLS-1$
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java 2007-08-08 14:10:19 UTC (rev 2936)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.ui.actions;
+
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.IOpenable;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.SelectionConverter;
+import org.rubypeople.rdt.internal.ui.resourcesview.RubyResourcesView;
+import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
+/**
+ * This action reveals the currently selected Ruby element in the
+ * package explorer.
+ * <p>
+ * The action is applicable to selections containing elements of type
+ * <code>IRubyElement</code>.
+ *
+ * <p>
+ * This class may be instantiated; it is not intended to be subclassed.
+ * </p>
+ * @since 2.0
+ */
+public class ShowInPackageViewAction extends SelectionDispatchAction {
+
+ private RubyEditor fEditor;
+
+ /**
+ * Creates a new <code>ShowInPackageViewAction</code>. The action requires
+ * that the selection provided by the site's selection provider is of type
+ * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
+ *
+ * @param site the site providing context information for this action
+ */
+ public ShowInPackageViewAction(IWorkbenchSite site) {
+ super(site);
+ setText(ActionMessages.ShowInPackageViewAction_label);
+ setDescription(ActionMessages.ShowInPackageViewAction_description);
+ setToolTipText(ActionMessages.ShowInPackageViewAction_tooltip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.SHOW_IN_PACKAGEVIEW_ACTION);
+ }
+
+ /**
+ * Note: This constructor is for internal use only. Clients should not call this constructor.
+ * @param editor the Ruby editor
+ */
+ public ShowInPackageViewAction(RubyEditor editor) {
+ this(editor.getEditorSite());
+ fEditor= editor;
+ setEnabled(SelectionConverter.canOperateOn(fEditor));
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void selectionChanged(ITextSelection selection) {
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ setEnabled(checkEnabled(selection));
+ }
+
+ private boolean checkEnabled(IStructuredSelection selection) {
+ if (selection.size() != 1)
+ return false;
+ return selection.getFirstElement() instanceof IRubyElement;
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void run(ITextSelection selection) {
+ try {
+ IRubyElement element= SelectionConverter.getElementAtOffset(fEditor);
+ if (element != null)
+ run(element);
+ } catch (RubyModelException e) {
+ RubyPlugin.log(e);
+ String message= ActionMessages.ShowInPackageViewAction_error_message;
+ ErrorDialog.openError(getShell(), getDialogTitle(), message, e.getStatus());
+ }
+ }
+
+ /* (non-Rubydoc)
+ * Method declared on SelectionDispatchAction.
+ */
+ public void run(IStructuredSelection selection) {
+ if (!checkEnabled(selection))
+ return;
+ run((IRubyElement)selection.getFirstElement());
+ }
+
+ /*
+ * No Rubydoc. The method should be internal but can't be changed since
+ * we shipped it with a public visibility
+ */
+ public void run(IRubyElement element) {
+ if (element == null)
+ return;
+
+ // reveal the top most element only
+ IOpenable openable= element.getOpenable();
+ if (openable instanceof IRubyElement)
+ element= (IRubyElement)openable;
+
+ RubyResourcesView view= RubyResourcesView.openInActivePerspective();
+ view.tryToReveal(element);
+ }
+
+ private static String getDialogTitle() {
+ return ActionMessages.ShowInPackageViewAction_dialog_title;
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ShowInPackageViewAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-08 14:08:56
|
Revision: 2935
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2935&view=rev
Author: cawilliams
Date: 2007-08-08 07:08:55 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
don't block on opening preference page dialog
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyInstalledDetector.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyInstalledDetector.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyInstalledDetector.java 2007-08-07 17:27:41 UTC (rev 2934)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyInstalledDetector.java 2007-08-08 14:08:55 UTC (rev 2935)
@@ -45,6 +45,7 @@
private void openPreferencePage(String pageId) {
PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(Display.getDefault().getActiveShell(), pageId, null, null);
+ prefDialog.setBlockOnOpen(false);
prefDialog.open();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 17:27:44
|
Revision: 2934
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2934&view=rev
Author: cawilliams
Date: 2007-08-07 10:27:41 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
fix #5315 - Add preference for disabling hovers
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorAppearanceConfigurationBlock.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.java 2007-08-07 16:06:18 UTC (rev 2933)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.java 2007-08-07 17:27:41 UTC (rev 2934)
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.internal.ui.ImageDescriptorRegistry;
@@ -594,6 +595,10 @@
* @since 1.0
*/
public RubyEditorTextHoverDescriptor[] getRubyEditorTextHoverDescriptors() {
+ Preferences prefs = getPluginPreferences();
+ if (prefs != null && !prefs.getBoolean(PreferenceConstants.HOVERS_ENABLED)) {
+ return new RubyEditorTextHoverDescriptor[0];
+ }
if (fRubyEditorTextHoverDescriptors == null) {
fRubyEditorTextHoverDescriptors= RubyEditorTextHoverDescriptor.getContributedHovers();
ConfigurationElementSorter sorter= new ConfigurationElementSorter() {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java 2007-08-07 16:06:18 UTC (rev 2933)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java 2007-08-07 17:27:41 UTC (rev 2934)
@@ -191,6 +191,7 @@
public static String KeywordInputDialog_error_comma;
public static String KeywordInputDialog_error_entryExists;
public static String KeywordInputDialog_error_noSpace;
+ public static String RubyEditorPreferencePage_enableHovers;
static {
NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2007-08-07 16:06:18 UTC (rev 2933)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2007-08-07 17:27:41 UTC (rev 2934)
@@ -95,6 +95,8 @@
RubyEditorPreferencePage_enable= Enab&le
RubyEditorPreferencePage_folding_title= &Folding
+RubyEditorPreferencePage_enableHovers= Enable ruby code hovers
+
# coloring
RubyEditorPreferencePage_coloring_category_ruby=Ruby
RubyEditorColoringConfigurationBlock_link= Default colors and font can be configured on the <a href=\"org.eclipse.ui.preferencePages.GeneralTextEditor\">Text Editors</a> and on the <a href=\"org.eclipse.ui.preferencePages.ColorsAndFonts\">Colors and Fonts</a> preference page.
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorAppearanceConfigurationBlock.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorAppearanceConfigurationBlock.java 2007-08-07 16:06:18 UTC (rev 2933)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorAppearanceConfigurationBlock.java 2007-08-07 17:27:41 UTC (rev 2934)
@@ -70,8 +70,9 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
ArrayList overlayKeys= new ArrayList();
-
+
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.HOVERS_ENABLED));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END));
@@ -208,6 +209,9 @@
label= PreferencesMessages.RubyEditorPreferencePage_highlightMatchingBrackets;
addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
+ label= PreferencesMessages.RubyEditorPreferencePage_enableHovers;
+ addCheckBox(appearanceComposite, label, PreferenceConstants.HOVERS_ENABLED, 0);
+
Label l= new Label(appearanceComposite, SWT.LEFT );
gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 2;
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java 2007-08-07 16:06:18 UTC (rev 2933)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java 2007-08-07 17:27:41 UTC (rev 2934)
@@ -388,6 +388,14 @@
* @see org.eclipse.jface.preference.PreferenceConverter
*/
public final static String EDITOR_MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls if the Ruby hovers get created.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ */
+ public final static String HOVERS_ENABLED = "hovers_enabled"; //$NON-NLS-1$
/**
* A named preference that controls if the Ruby code assist gets auto
@@ -870,6 +878,7 @@
store.setDefault(PreferenceConstants.EDITOR_MATCHING_BRACKETS, true);
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
+ store.setDefault(PreferenceConstants.HOVERS_ENABLED, true);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 200);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 16:07:38
|
Revision: 2933
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2933&view=rev
Author: cawilliams
Date: 2007-08-07 09:06:18 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
search test type hierarchy
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenTestAction.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenTestAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenTestAction.java 2007-08-07 16:05:43 UTC (rev 2932)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenTestAction.java 2007-08-07 16:06:18 UTC (rev 2933)
@@ -18,6 +18,7 @@
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.ISourceRange;
import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.ITypeHierarchy;
import org.rubypeople.rdt.core.RubyConventions;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.util.Messages;
@@ -53,16 +54,16 @@
return type;
IMethod method= findMethod(type);
-// if (method == null) { FIXME When we have type hierarchies implemented, uncomment this!
-// ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null);
-// IType[] types= typeHierarchy.getAllSuperclasses(type);
-// for (int i= 0; i < types.length; i++) {
-// method= findMethod(types[i]);
-// if (method != null)
-// break;
-// }
-// }
if (method == null) {
+ ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null);
+ IType[] types= typeHierarchy.getAllSuperclasses(type);
+ for (int i= 0; i < types.length; i++) {
+ method= findMethod(types[i]);
+ if (method != null)
+ break;
+ }
+ }
+ if (method == null) {
String title= TestUnitMessages.OpenTestAction_error_title;
String message= Messages.format(TestUnitMessages.OpenTestAction_error_methodNoFound, fMethodName);
MessageDialog.openInformation(getShell(), title, message);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 16:06:45
|
Revision: 2932
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2932&view=rev
Author: cawilliams
Date: 2007-08-07 09:05:43 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
remove debug output
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-08-07 16:04:51 UTC (rev 2931)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-08-07 16:05:43 UTC (rev 2932)
@@ -148,7 +148,6 @@
String className = getClassName();
String methodName = getMethodName();
if (className != null) {
- System.err.println("MethodName: " + methodName);
manager.add(new OpenTestAction(fRunnerViewPart, className, methodName, true));
manager.add(new Separator());
manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 16:05:06
|
Revision: 2931
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2931&view=rev
Author: cawilliams
Date: 2007-08-07 09:04:51 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java 2007-08-07 15:47:24 UTC (rev 2930)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestHierarchyTab.java 2007-08-07 16:04:51 UTC (rev 2931)
@@ -19,6 +19,7 @@
import java.util.Map;
import java.util.Vector;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -43,6 +44,7 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
+import org.rubypeople.rdt.core.RubyConventions;
import org.rubypeople.rdt.testunit.ITestRunListener;
/*
@@ -439,7 +441,8 @@
}
private boolean testClassExists(String className) {
- return true; // FIXME We need to re-implement this!
+ IStatus status = RubyConventions.validateRubyTypeName(className);
+ return status.isOK();
}
public void newTreeEntry(String treeEntry) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 15:47:27
|
Revision: 2930
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2930&view=rev
Author: cawilliams
Date: 2007-08-07 08:47:24 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-08-07 15:39:53 UTC (rev 2929)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-08-07 15:47:24 UTC (rev 2930)
@@ -106,6 +106,7 @@
private IFile workspaceFile;
public SourceElement(String aFilename, RubySourceLocator pSourceLocator) {
filename = aFilename;
+ if (filename == null) return;
if (filename.startsWith("./") && pSourceLocator.projectName != null && pSourceLocator.projectName.trim().length() > 0) {
filename = "/" + pSourceLocator.projectName + filename.substring(1);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 15:43:27
|
Revision: 2929
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2929&view=rev
Author: cawilliams
Date: 2007-08-07 08:39:53 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
fix #5375 - Right clicking on test case method in Test::Unit panel causes eclipse to temporarily freeze for about 10 seconds.
If you right-click/double click the full file path in the hierarchy view it would freeze up for a while. Now we shortcut that particular case.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java 2007-08-07 13:58:18 UTC (rev 2928)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java 2007-08-07 15:39:53 UTC (rev 2929)
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -24,6 +25,7 @@
import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.RubyConventions;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.ui.rubyeditor.EditorUtility;
@@ -94,6 +96,9 @@
if (visitedProjects.contains(project))
return null;
+ IStatus status = RubyConventions.validateRubyTypeName(className);
+ if (!status.isOK()) return null;
+
IType type= project.findType(className, (IProgressMonitor) null);
if (type != null)
return type;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 13:58:19
|
Revision: 2928
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2928&view=rev
Author: cawilliams
Date: 2007-08-07 06:58:18 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
add test and fix for #5448 - Error when opening authenticated_generator.rb file (restful_athentication plugin)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-08-07 13:58:13 UTC (rev 2927)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-08-07 13:58:18 UTC (rev 2928)
@@ -363,5 +363,20 @@
assertContentType(RubyPartitionScanner.RUBY_STRING, code, 79); // case'}'
assertContentType(RubyPartitionScanner.RUBY_STRING, code, 112); // EN'D'
}
+
+ public void testBug5448() {
+ String code = "m.class_collisions controller_class_path, \"#{controller_class_name}Controller\", # Sessions Controller\r\n" +
+ " \"#{controller_class_name}Helper\"";
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 40);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 48);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 50);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 51);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 71);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 72);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 83);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 84);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 86);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-07 13:58:17
|
Revision: 2927
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2927&view=rev
Author: cawilliams
Date: 2007-08-07 06:58:13 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
add test and fix for #5448 - Error when opening authenticated_generator.rb file (restful_athentication plugin)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-08-02 18:59:27 UTC (rev 2926)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-08-07 13:58:13 UTC (rev 2927)
@@ -14,6 +14,7 @@
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
import org.jruby.ast.CommentNode;
+import org.jruby.ast.Node;
import org.jruby.common.NullWarnings;
import org.jruby.lexer.yacc.LexState;
import org.jruby.lexer.yacc.LexerSource;
@@ -159,8 +160,8 @@
addClosingBraceToken();
setLexerPastDynamicSectionOfString();
return popTokenOffQueue();
- } else if (lexerToken == Tokens.tSTRING_BEG) {
- String opening = fContents.substring(fOffset - origOffset, lexerSource.getOffset());
+ } else if (lexerToken == Tokens.tSTRING_BEG) {
+ String opening = getOpeningString();
int index = indexOf(opening, ", +");
if (opening.trim().startsWith("<<") && index != -1) {
addHereDocStartToken(index);
@@ -194,6 +195,7 @@
// end of parsing
else
fLength = getOffset() - fOffset;
+ Assert.isTrue(fLength >= 0);
return new Token(RUBY_DEFAULT);
} catch (IOException e) {
RubyPlugin.log(e);
@@ -360,7 +362,7 @@
case Tokens.tSTRING_CONTENT:
return new Token(fContentType);
case Tokens.tSTRING_BEG:
- fOpeningString = fContents.substring(fOffset - origOffset, lexerSource.getOffset()).trim();
+ fOpeningString = getOpeningString();
if (fOpeningString.equals("'") || fOpeningString.startsWith("%q")) {
inSingleQuote = true;
} else if (fOpeningString.startsWith("<<")) { // here-doc
@@ -369,11 +371,11 @@
fContentType = RUBY_STRING;
return new Token(RUBY_STRING);
case Tokens.tXSTRING_BEG:
- fOpeningString = fContents.substring(fOffset - origOffset, lexerSource.getOffset()).trim();
+ fOpeningString = getOpeningString();
fContentType = RUBY_COMMAND;
return new Token(RUBY_COMMAND);
case Tokens.tQWORDS_BEG:
- fOpeningString = fContents.substring(fOffset - origOffset, lexerSource.getOffset()).trim();
+ fOpeningString = getOpeningString();
fContentType = RUBY_STRING;
return new Token(RUBY_STRING);
case Tokens.tSTRING_END:
@@ -382,7 +384,7 @@
inSingleQuote = false;
return new Token(oldContentType);
case Tokens.tREGEXP_BEG:
- fOpeningString = fContents.substring(fOffset - origOffset, lexerSource.getOffset()).trim();
+ fOpeningString = getOpeningString();
fContentType = RUBY_REGULAR_EXPRESSION;
return new Token(RUBY_REGULAR_EXPRESSION);
case Tokens.tREGEXP_END:
@@ -393,6 +395,17 @@
}
}
+ private String getOpeningString() {
+ int start = fOffset - origOffset;
+ List comments = result.getCommentNodes();
+ if (comments != null && !comments.isEmpty()) {
+ Node comment = (Node) comments.get(comments.size() - 1);
+ int end = comment.getPosition().getEndOffset();
+ start = end;
+ }
+ return fContents.substring(start, lexerSource.getOffset()).trim();
+ }
+
/**
* correct start offset, since when a line with nothing but spaces on it appears before comment,
* we get messed up positions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-02 18:59:30
|
Revision: 2926
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2926&view=rev
Author: cawilliams
Date: 2007-08-02 11:59:27 -0700 (Thu, 02 Aug 2007)
Log Message:
-----------
fix #5430 - Add code check for dynamic variable which aliases local variable
Modified Paths:
--------------
trunk/com.aptana.rdt/plugin.xml
trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
Added Paths:
-----------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/DynamicVariableAliasesLocal.java
Modified: trunk/com.aptana.rdt/plugin.xml
===================================================================
--- trunk/com.aptana.rdt/plugin.xml 2007-08-02 18:41:26 UTC (rev 2925)
+++ trunk/com.aptana.rdt/plugin.xml 2007-08-02 18:59:27 UTC (rev 2926)
@@ -86,7 +86,11 @@
<error
categoryId="org.rubypeople.rdt.errors.potentialProblems"
label="method_missing defined without re-defined respond_to"
- prefKey="com.aptana.rdt.compiler.problem.methodMissingWithoutRespondTo"/>
+ prefKey="com.aptana.rdt.compiler.problem.methodMissingWithoutRespondTo"/>
+ <error
+ categoryId="org.rubypeople.rdt.errors.potentialProblems"
+ label="Dynamic variables Aliases Local Variable"
+ prefKey="com.aptana.rdt.compiler.problem.dynamicVariableAliasesLocal"/>
</extension>
<!-- =================================================================================== -->
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-08-02 18:41:26 UTC (rev 2925)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/AptanaRDTPlugin.java 2007-08-02 18:59:27 UTC (rev 2926)
@@ -210,6 +210,13 @@
*/
public static final String COMPILER_PB_METHOD_MISSING_NO_RESPOND_TO = PLUGIN_ID + "com.aptana.rdt.compiler.problem.methodMissingWithoutRespondTo";
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 1.0.0
+ */
+ public static final String COMPILER_PB_DYNAMIC_VARIABLE_ALIASES_LOCAL = PLUGIN_ID + "com.aptana.rdt.compiler.problem.dynamicVariableAliasesLocal";
+
// The shared instance
private static AptanaRDTPlugin plugin;
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/DynamicVariableAliasesLocal.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/DynamicVariableAliasesLocal.java (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/DynamicVariableAliasesLocal.java 2007-08-02 18:59:27 UTC (rev 2926)
@@ -0,0 +1,56 @@
+package com.aptana.rdt.internal.parser.warnings;
+
+import java.util.List;
+
+import org.jruby.ast.ArrayNode;
+import org.jruby.ast.IterNode;
+import org.jruby.ast.ListNode;
+import org.jruby.ast.LocalAsgnNode;
+import org.jruby.ast.MultipleAsgnNode;
+import org.jruby.ast.Node;
+import org.jruby.evaluator.Instruction;
+import org.rubypeople.rdt.internal.core.parser.warnings.RubyLintVisitor;
+
+import com.aptana.rdt.AptanaRDTPlugin;
+
+public class DynamicVariableAliasesLocal extends RubyLintVisitor {
+
+ public DynamicVariableAliasesLocal(String contents) {
+ super(contents);
+ }
+
+ @Override
+ protected String getOptionKey() {
+ return AptanaRDTPlugin.COMPILER_PB_DYNAMIC_VARIABLE_ALIASES_LOCAL;
+ }
+
+ @Override
+ public Instruction visitIterNode(IterNode iVisited) {
+ checkNode(iVisited.getVarNode());
+ return super.visitIterNode(iVisited);
+ }
+
+ private void checkNode(Node varNode) {
+ if (varNode == null) return;
+ if (varNode instanceof ListNode) {
+ checkListNode((ListNode)varNode);
+ } else if (varNode instanceof MultipleAsgnNode) {
+ MultipleAsgnNode multi = (MultipleAsgnNode) varNode;
+ checkList(multi.childNodes());
+ } else if (varNode instanceof LocalAsgnNode) {
+ createProblem(varNode.getPosition(), "Dynamic variable aliases local");
+ }
+ }
+
+ private void checkListNode(ListNode node) {
+ checkList(node.childNodes());
+ }
+
+ private void checkList(List list) {
+ for (Object child : list) {
+ Node childNode = (Node) child;
+ checkNode(childNode);
+ }
+
+ }
+}
Property changes on: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/DynamicVariableAliasesLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java 2007-08-02 18:41:26 UTC (rev 2925)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java 2007-08-02 18:59:27 UTC (rev 2926)
@@ -28,6 +28,7 @@
public static final long AssignmentPrecedence = 0x200000;
public static final long MethodMissingWithoutRespondTo = 0x400000;
public static final long ConstantNamingConvention = 0x800000;
+ public static final long DynamicVariableAliasesLocal = 0x1000000;
public static final String ERROR = RubyCore.ERROR;
public static final String WARNING = RubyCore.WARNING;
@@ -48,6 +49,7 @@
| SubclassDoesntCallSuper
| MethodMissingWithoutRespondTo
| ConstantNamingConvention
+ | DynamicVariableAliasesLocal
/*| NullReference -- keep RubyCore#getDefaultOptions comment in sync */;
public int maxLocals = 5;
@@ -77,6 +79,7 @@
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_ENUMERABLE_MISSING_METHOD, getSeverityString(EnumerableMissingMethod));
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_CONSTANT_NAMING_CONVENTION, getSeverityString(ConstantNamingConvention));
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_METHOD_MISSING_NO_RESPOND_TO, getSeverityString(MethodMissingWithoutRespondTo));
+ optionsMap.put(AptanaRDTPlugin.COMPILER_PB_DYNAMIC_VARIABLE_ALIASES_LOCAL, getSeverityString(DynamicVariableAliasesLocal));
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_MAX_ARGUMENTS, String.valueOf(maxArguments));
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_MAX_LINES, String.valueOf(maxLines));
optionsMap.put(AptanaRDTPlugin.COMPILER_PB_MAX_LOCALS, String.valueOf(maxLocals));
@@ -114,6 +117,7 @@
if ((optionValue = optionsMap.get(AptanaRDTPlugin.COMPILER_PB_ASSIGNMENT_PRECEDENCE)) != null) updateSeverity(AssignmentPrecedence, optionValue);
if ((optionValue = optionsMap.get(AptanaRDTPlugin.COMPILER_PB_CONSTANT_NAMING_CONVENTION)) != null) updateSeverity(ConstantNamingConvention, optionValue);
if ((optionValue = optionsMap.get(AptanaRDTPlugin.COMPILER_PB_METHOD_MISSING_NO_RESPOND_TO)) != null) updateSeverity(MethodMissingWithoutRespondTo, optionValue);
+ if ((optionValue = optionsMap.get(AptanaRDTPlugin.COMPILER_PB_DYNAMIC_VARIABLE_ALIASES_LOCAL)) != null) updateSeverity(DynamicVariableAliasesLocal, optionValue);
if ((optionValue = optionsMap.get(AptanaRDTPlugin.COMPILER_PB_MAX_LOCALS)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-02 18:41:26 UTC (rev 2925)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-02 18:59:27 UTC (rev 2926)
@@ -84,6 +84,7 @@
visitors.add(new AndOrUsedOnRighthandAssignment(contents));
visitors.add(new ConstantNamingConvention(contents));
visitors.add(new MethodMissingWithoutRespondTo(contents));
+ visitors.add(new DynamicVariableAliasesLocal(contents));
List<RubyLintVisitor> filtered = new ArrayList<RubyLintVisitor>();
for (RubyLintVisitor visitor : visitors) {
if (visitor.isIgnored()) continue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-02 18:41:27
|
Revision: 2925
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2925&view=rev
Author: cawilliams
Date: 2007-08-02 11:41:26 -0700 (Thu, 02 Aug 2007)
Log Message:
-----------
fix to work with latest JRuby
Modified Paths:
--------------
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2007-08-02 18:37:46 UTC (rev 2924)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2007-08-02 18:41:26 UTC (rev 2925)
@@ -120,8 +120,8 @@
public Node getRootNode() {
LexerSource lexerSource;
try {
- lexerSource = new LexerSource(getName(), new InputStreamReader(getContents()), 1);
- return parser.parse(new RubyParserConfiguration(), lexerSource).getAST();
+ lexerSource = new LexerSource(getName(), new InputStreamReader(getContents()), 1, true);
+ return parser.parse(new RubyParserConfiguration(false), lexerSource).getAST();
} catch (CoreException e) {
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-02 18:37:47
|
Revision: 2924
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2924&view=rev
Author: cawilliams
Date: 2007-08-02 11:37:46 -0700 (Thu, 02 Aug 2007)
Log Message:
-----------
only execute RubyLintVisitor if it's results won't be ignored. (this should avoid uneccesary CPU and memory usage for visitors whose results were just ignored).
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-02 18:37:42 UTC (rev 2923)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-02 18:37:46 UTC (rev 2924)
@@ -84,6 +84,11 @@
visitors.add(new AndOrUsedOnRighthandAssignment(contents));
visitors.add(new ConstantNamingConvention(contents));
visitors.add(new MethodMissingWithoutRespondTo(contents));
- return visitors;
+ List<RubyLintVisitor> filtered = new ArrayList<RubyLintVisitor>();
+ for (RubyLintVisitor visitor : visitors) {
+ if (visitor.isIgnored()) continue;
+ filtered.add(visitor);
+ }
+ return filtered;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-02 18:37:47
|
Revision: 2923
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2923&view=rev
Author: cawilliams
Date: 2007-08-02 11:37:42 -0700 (Thu, 02 Aug 2007)
Log Message:
-----------
only execute RubyLintVisitor if it's results won't be ignored. (this should avoid uneccesary CPU and memory usage for visitors whose results were just ignored).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-08-02 17:54:52 UTC (rev 2922)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-08-02 18:37:42 UTC (rev 2923)
@@ -46,6 +46,13 @@
public List<CategorizedProblem> getProblems() {
return problems;
}
+
+ public boolean isIgnored() {
+ String value = getSeverity();
+ if (value != null && value.equals(RubyCore.IGNORE))
+ return true;
+ return false;
+ }
protected void createProblem(ISourcePosition position, String message) {
String value = getSeverity();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|