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-04-04 14:26:06
|
Revision: 2272
http://svn.sourceforge.net/rubyeclipse/?rev=2272&view=rev
Author: cawilliams
Date: 2007-04-04 07:25:31 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
add tests for false positive symbols, add fix, also clean up token scanner a bit
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-04 14:02:18 UTC (rev 2271)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-04 14:25:31 UTC (rev 2272)
@@ -25,6 +25,12 @@
public class RubyTokenScanner extends AbstractRubyTokenScanner {
+ private static final int MIN_KEYWORD = 257;
+ private static final int MAX_KEYWORD = 303;
+ private static final int COMMA = 44;
+ private static final int COLON = 58;
+ private static final int NEWLINE = 10;
+
protected String[] keywords;
private static String[] fgTokenProperties = { IRubyColorConstants.RUBY_KEYWORD, IRubyColorConstants.RUBY_DEFAULT,
@@ -54,6 +60,7 @@
private int fSavedLength = -1;
private int fSavedOffset = -1;
private boolean lastWasComment;
+ private boolean inAlias;
public RubyTokenScanner(IColorManager manager, IPreferenceStore store) {
super(manager, store);
@@ -165,31 +172,29 @@
return super.getToken(key);
}
- private IToken token(int i) {
+ private IToken token(int i) {
if (isInSymbol) {
- if ((i == Tokens.tAREF) || (i == Tokens.tASET) || (i == Tokens.tIDENTIFIER)
- || (i == Tokens.tIVAR) || (i == Tokens.tCVAR) || (i == Tokens.tMINUS)
- || (i == Tokens.tPLUS) || (i == Tokens.tPIPE) || (i == Tokens.tCARET)
- || (i == Tokens.tLT) || (i == Tokens.tGT) || (i == Tokens.tAMPER)
- || (i == Tokens.tSTAR2) || (i == Tokens.tDIVIDE) || (i == Tokens.tPERCENT)
- || (i == Tokens.tBACK_REF2) || (i == Tokens.tTILDE) || (i == Tokens.tCONSTANT)
- || (i == Tokens.tFID) || (i == 10) /* Newline */
- || ( i >= 257 && i <= 303) /* keywords */) {
+ if (isSymbolTerminator(i)) {
isInSymbol = false; // we're at the end of the symbol
- if (i == 10) // newline ends it and is actually default, not symbol
+ if (shouldReturnDefault(i))
return doGetToken(IRubyColorConstants.RUBY_DEFAULT);
return doGetToken(IRubyColorConstants.RUBY_SYMBOL);
}
- if (i == Tokens.tASSOC || i == 44 /* ',' */) {
- isInSymbol = false;
- return doGetToken(IRubyColorConstants.RUBY_DEFAULT);
- }
}
- if (i >= 257 && i <= 303)
+ // The next two conditionals work around a JRuby parsing bug
+ // JRuby returns the number for ':' on second symbol's beginning in alias calls
+ if (i == Tokens.kALIAS) {
+ inAlias = true;
+ }
+ if (i == COLON && inAlias) {
+ isInSymbol = true;
+ inAlias = false;
+ return doGetToken(IRubyColorConstants.RUBY_SYMBOL);
+ } // end JRuby parsing hack for alias
+ if (isKeyword(i))
return doGetToken(IRubyColorConstants.RUBY_KEYWORD);
switch (i) {
- case Tokens.tSYMBEG:
- case 58: // ':' FIXME JRuby returns the number for ':' on second symbol's beginning in alias calls
+ case Tokens.tSYMBEG:
isInSymbol = true;
return doGetToken(IRubyColorConstants.RUBY_SYMBOL);
case Tokens.tGVAR:
@@ -222,6 +227,52 @@
}
}
+ private boolean shouldReturnDefault(int i) {
+ switch (i) {
+ case NEWLINE:
+ case COMMA:
+ case Tokens.tASSOC:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private boolean isSymbolTerminator(int i) {
+ if (isKeyword(i)) return true;
+ switch (i) {
+ case Tokens.tAREF:
+ case Tokens.tCVAR:
+ case Tokens.tMINUS:
+ case Tokens.tPLUS:
+ case Tokens.tPIPE:
+ case Tokens.tCARET:
+ case Tokens.tLT:
+ case Tokens.tGT:
+ case Tokens.tAMPER:
+ case Tokens.tSTAR2:
+ case Tokens.tDIVIDE:
+ case Tokens.tPERCENT:
+ case Tokens.tBACK_REF2:
+ case Tokens.tTILDE:
+ case Tokens.tCONSTANT:
+ case Tokens.tFID:
+ case Tokens.tASET:
+ case Tokens.tIDENTIFIER:
+ case Tokens.tIVAR:
+ case Tokens.tASSOC:
+ case COMMA:
+ case NEWLINE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private boolean isKeyword(int i) {
+ return (i >= MIN_KEYWORD && i <= MAX_KEYWORD);
+ }
+
public void setRange(IDocument document, int offset, int length) {
lexer.reset();
lexer.setState(LexState.EXPR_BEG);
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-04 14:02:18 UTC (rev 2271)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-04 14:25:31 UTC (rev 2272)
@@ -179,6 +179,34 @@
assertToken(IRubyColorConstants.RUBY_SYMBOL, 20, 10); // 'repository'
assertToken(IRubyColorConstants.RUBY_DEFAULT, 30, 1); // ']'
}
+
+ public void testTertiaryConditional() {
+ String code = "multiparameter_name = true ? value.method : value";
+ setUpScanner(code);
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 0, 19); // 'multiparameter_name'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 19, 2); // ' ='
+ assertToken(IRubyColorConstants.RUBY_KEYWORD, 21, 5); // ' true'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 26, 2); // ' ?'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 28, 6); // ' value'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 34, 1); // '.'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 35, 6); // 'method'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 41, 2); // ' :'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 43, 6); // ' value'
+ }
+
+ public void testWhen() {
+ String code = "case value\n" +
+ "when FalseClass: 0\n" +
+ "else value\n" +
+ "end";
+ setUpScanner(code);
+ assertToken(IRubyColorConstants.RUBY_KEYWORD, 0, 4); // 'case'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 4, 6); // ' value'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 10, 1); // '\n'
+ assertToken(IRubyColorConstants.RUBY_KEYWORD, 11, 4); // 'when'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 15, 11); // ' FalseClass'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 26, 1); // ':'
+ assertToken(IRubyColorConstants.RUBY_FIXNUM, 27, 2); // ' 0'
+ }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-04 14:02:19
|
Revision: 2271
http://svn.sourceforge.net/rubyeclipse/?rev=2271&view=rev
Author: cawilliams
Date: 2007-04-04 07:02:18 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
another fix for Ticket #249
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-04 14:02:03 UTC (rev 2270)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-04 14:02:18 UTC (rev 2271)
@@ -173,7 +173,8 @@
|| (i == Tokens.tLT) || (i == Tokens.tGT) || (i == Tokens.tAMPER)
|| (i == Tokens.tSTAR2) || (i == Tokens.tDIVIDE) || (i == Tokens.tPERCENT)
|| (i == Tokens.tBACK_REF2) || (i == Tokens.tTILDE) || (i == Tokens.tCONSTANT)
- || (i == 10) /* Newline */ || ( i >= 257 && i <= 303) /* keywords */) {
+ || (i == Tokens.tFID) || (i == 10) /* Newline */
+ || ( i >= 257 && i <= 303) /* keywords */) {
isInSymbol = false; // we're at the end of the symbol
if (i == 10) // newline ends it and is actually default, not symbol
return doGetToken(IRubyColorConstants.RUBY_DEFAULT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-04 14:02:05
|
Revision: 2270
http://svn.sourceforge.net/rubyeclipse/?rev=2270&view=rev
Author: cawilliams
Date: 2007-04-04 07:02:03 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
avoid some common null pointer cases (external scripts)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java 2007-04-04 13:44:45 UTC (rev 2269)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/hyperlinks/RubyHyperLinkDetector.java 2007-04-04 14:02:03 UTC (rev 2270)
@@ -86,6 +86,7 @@
SelectionEngine engine = new SelectionEngine();
IWorkingCopyManager manager = RubyPlugin.getDefault().getWorkingCopyManager();
IRubyScript script = manager.getWorkingCopy(fEditorInput);
+ if (script == null) return null;
RubyParser parser = new RubyParser();
try {
Node root = parser.parse((IFile) script.getResource(), new StringReader(script.getSource()));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-04 13:44:46
|
Revision: 2269
http://svn.sourceforge.net/rubyeclipse/?rev=2269&view=rev
Author: cawilliams
Date: 2007-04-04 06:44:45 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
fix problem where user tries to enter a new comment on a blank (whitespace only) line, so EOF followed comment in lexer: it would end up moving the cursor back two spaces, causing text to come out backwards when users typed!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-03 18:02:35 UTC (rev 2268)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-04 13:44:45 UTC (rev 2269)
@@ -129,7 +129,6 @@
fSavedLength = getOffset() - fSavedOffset;
} else {
fSavedOffset--;
- tokenLength -= 2;
fSavedLength = 0;
}
lastWasComment = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 18:02:38
|
Revision: 2268
http://svn.sourceforge.net/rubyeclipse/?rev=2268&view=rev
Author: cawilliams
Date: 2007-04-03 11:02:35 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
add new interface that search will be using
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/IJob.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/IJob.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/IJob.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/IJob.java 2007-04-03 18:02:35 UTC (rev 2268)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.internal.core.search.processing;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface IJob {
+
+ /* Waiting policies */
+ int ForceImmediate = 1;
+ int CancelIfNotReady = 2;
+ int WaitUntilReady = 3;
+
+ /* Job's result */
+ boolean FAILED = false;
+ boolean COMPLETE = true;
+
+ /**
+ * Answer true if the job belongs to a given family (tag)
+ */
+ public boolean belongsTo(String jobFamily);
+ /**
+ * Asks this job to cancel its execution. The cancellation
+ * can take an undertermined amount of time.
+ */
+ public void cancel();
+ /**
+ * Ensures that this job is ready to run.
+ */
+ public void ensureReadyToRun();
+ /**
+ * Execute the current job, answer whether it was successful.
+ */
+ public boolean execute(IProgressMonitor progress);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 18:02:20
|
Revision: 2267
http://svn.sourceforge.net/rubyeclipse/?rev=2267&view=rev
Author: cawilliams
Date: 2007-04-03 11:02:19 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 18:02:13
|
Revision: 2266
http://svn.sourceforge.net/rubyeclipse/?rev=2266&view=rev
Author: cawilliams
Date: 2007-04-03 11:02:11 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
fix mis-spelling in comment
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java 2007-04-03 18:02:06 UTC (rev 2265)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/ExperimentalIndex.java 2007-04-03 18:02:11 UTC (rev 2266)
@@ -42,7 +42,7 @@
processDelta(event.getDelta());
}
- // FIXME We're ding poor man's scoping by passing in the script. We should actually create scope classes which could tell if a document fell in our out of it...
+ // FIXME We're doing poor man's scoping by passing in the script. We should actually create scope classes which could tell if a document fell in our out of it...
public static Set<String> getTypeNames(IRubyScript script) {
return getElementNames(IRubyElement.TYPE, script);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 18:02:08
|
Revision: 2265
http://svn.sourceforge.net/rubyeclipse/?rev=2265&view=rev
Author: cawilliams
Date: 2007-04-03 11:02:06 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
remove AST traversing stuff from RubyScriptStructureBuilder and instead put it on top of our new ISourceElementRequestor API. Now we can be notified at a much higher level of ruby element constructs from the code (rather than traversing the AST in order and maintaining all sorts of state like visibiltiies, etc)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java
trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-04-03 18:00:43 UTC (rev 2264)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-04-03 18:02:06 UTC (rev 2265)
@@ -39,7 +39,8 @@
RubyParser parser = new RubyParser();
Node node = parser.parse(null, new CharArrayReader(contents));
RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
- if (node != null) node.accept(visitor);
+ SourceParser sp = new SourceParser(visitor);
+ if (node != null) node.accept(sp);
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-04-03 18:00:43 UTC (rev 2264)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-04-03 18:02:06 UTC (rev 2265)
@@ -60,6 +60,7 @@
import org.rubypeople.rdt.core.WorkingCopyOwner;
import org.rubypeople.rdt.core.compiler.CategorizedProblem;
import org.rubypeople.rdt.internal.codeassist.CompletionEngine;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor;
import org.rubypeople.rdt.internal.core.buffer.BufferManager;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.util.MementoTokenizer;
@@ -135,8 +136,9 @@
RubyParser parser = new RubyParser();
ast = parser.parse((IFile) getResource(), new CharArrayReader(contents));
lastGoodAST = ast;
- RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
- if (ast != null) ast.accept(visitor);
+ ISourceElementRequestor requestor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
+ SourceParser sp = new SourceParser(requestor);
+ if (ast != null) ast.accept(sp);
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java 2007-04-03 18:00:43 UTC (rev 2264)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java 2007-04-03 18:02:06 UTC (rev 2265)
@@ -26,140 +26,31 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.jruby.ast.AliasNode;
-import org.jruby.ast.AndNode;
-import org.jruby.ast.ArgsCatNode;
-import org.jruby.ast.ArgsNode;
-import org.jruby.ast.ArgsPushNode;
-import org.jruby.ast.ArrayNode;
-import org.jruby.ast.AttrAssignNode;
-import org.jruby.ast.BackRefNode;
-import org.jruby.ast.BeginNode;
-import org.jruby.ast.BignumNode;
-import org.jruby.ast.BlockArgNode;
-import org.jruby.ast.BlockNode;
-import org.jruby.ast.BlockPassNode;
-import org.jruby.ast.BreakNode;
-import org.jruby.ast.CallNode;
-import org.jruby.ast.CaseNode;
-import org.jruby.ast.ClassNode;
-import org.jruby.ast.ClassVarAsgnNode;
-import org.jruby.ast.ClassVarDeclNode;
-import org.jruby.ast.ClassVarNode;
-import org.jruby.ast.Colon2Node;
-import org.jruby.ast.Colon3Node;
-import org.jruby.ast.ConstDeclNode;
-import org.jruby.ast.ConstNode;
-import org.jruby.ast.DAsgnNode;
-import org.jruby.ast.DRegexpNode;
-import org.jruby.ast.DStrNode;
-import org.jruby.ast.DSymbolNode;
-import org.jruby.ast.DVarNode;
-import org.jruby.ast.DXStrNode;
-import org.jruby.ast.DefinedNode;
-import org.jruby.ast.DefnNode;
-import org.jruby.ast.DefsNode;
-import org.jruby.ast.DotNode;
-import org.jruby.ast.EnsureNode;
-import org.jruby.ast.EvStrNode;
-import org.jruby.ast.FCallNode;
-import org.jruby.ast.FalseNode;
-import org.jruby.ast.FixnumNode;
-import org.jruby.ast.FlipNode;
-import org.jruby.ast.FloatNode;
-import org.jruby.ast.ForNode;
-import org.jruby.ast.GlobalAsgnNode;
-import org.jruby.ast.GlobalVarNode;
-import org.jruby.ast.HashNode;
-import org.jruby.ast.IfNode;
-import org.jruby.ast.InstAsgnNode;
-import org.jruby.ast.InstVarNode;
-import org.jruby.ast.IterNode;
-import org.jruby.ast.LocalAsgnNode;
-import org.jruby.ast.LocalVarNode;
-import org.jruby.ast.Match2Node;
-import org.jruby.ast.Match3Node;
-import org.jruby.ast.MatchNode;
-import org.jruby.ast.ModuleNode;
-import org.jruby.ast.MultipleAsgnNode;
-import org.jruby.ast.NewlineNode;
-import org.jruby.ast.NextNode;
-import org.jruby.ast.NilNode;
-import org.jruby.ast.Node;
-import org.jruby.ast.NotNode;
-import org.jruby.ast.NthRefNode;
-import org.jruby.ast.OpAsgnAndNode;
-import org.jruby.ast.OpAsgnNode;
-import org.jruby.ast.OpAsgnOrNode;
-import org.jruby.ast.OpElementAsgnNode;
-import org.jruby.ast.OptNNode;
-import org.jruby.ast.OrNode;
-import org.jruby.ast.PostExeNode;
-import org.jruby.ast.RedoNode;
-import org.jruby.ast.RegexpNode;
-import org.jruby.ast.RescueBodyNode;
-import org.jruby.ast.RescueNode;
-import org.jruby.ast.RetryNode;
-import org.jruby.ast.ReturnNode;
-import org.jruby.ast.RootNode;
-import org.jruby.ast.SClassNode;
-import org.jruby.ast.SValueNode;
-import org.jruby.ast.SelfNode;
-import org.jruby.ast.SplatNode;
-import org.jruby.ast.StrNode;
-import org.jruby.ast.SuperNode;
-import org.jruby.ast.SymbolNode;
-import org.jruby.ast.ToAryNode;
-import org.jruby.ast.TrueNode;
-import org.jruby.ast.UndefNode;
-import org.jruby.ast.UntilNode;
-import org.jruby.ast.VAliasNode;
-import org.jruby.ast.VCallNode;
-import org.jruby.ast.WhenNode;
-import org.jruby.ast.WhileNode;
-import org.jruby.ast.XStrNode;
-import org.jruby.ast.YieldNode;
-import org.jruby.ast.ZArrayNode;
-import org.jruby.ast.ZSuperNode;
-import org.jruby.ast.visitor.NodeVisitor;
-import org.jruby.evaluator.Instruction;
-import org.jruby.lexer.yacc.ISourcePosition;
-import org.jruby.runtime.Visibility;
-import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.internal.core.parser.RubyParser;
-import org.rubypeople.rdt.internal.core.util.ASTUtil;
+import org.rubypeople.rdt.core.compiler.CategorizedProblem;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor;
/**
* @author Chris
*
*/
-public class RubyScriptStructureBuilder implements NodeVisitor {
+public class RubyScriptStructureBuilder implements ISourceElementRequestor {
- private static final String MODULE = "Module";
- private static final String MODULE_KEYWORD = "module";
- private static final String METHOD_KEYWORD = "def";
- private static final String CONSTRUCTOR_NAME = "initialize";
- private static final String NAMESPACE_DELIMETER = "::";
- private static final String CLASS_KEYWORD = "class";
- private static final String OBJECT = "Object";
- private InfoStack infoStack = new InfoStack();
- private HandleStack modelStack = new HandleStack();
+ private InfoStack infoStack;
+ private HandleStack modelStack;
private RubyScriptElementInfo scriptInfo;
private IRubyScript script;
- private Visibility currentVisibility = Visibility.PUBLIC;
private Map newElements;
private RubyElementInfo importContainerInfo;
- private boolean DEBUG = false;
- private boolean inSingletonClass;
/**
*
@@ -172,278 +63,18 @@
* RubyModelManager. It holds elements below the level of a
* RubyScript in our hierarchy.
*/
- public RubyScriptStructureBuilder(IRubyScript script,
- RubyScriptElementInfo info, Map newElements) {
+ public RubyScriptStructureBuilder(IRubyScript script, RubyScriptElementInfo info, Map newElements) {
this.script = script;
this.scriptInfo = info;
this.newElements = newElements;
+ infoStack = new InfoStack();
+ modelStack = new HandleStack();
+
modelStack.push(script);
infoStack.push(scriptInfo);
- DEBUG = RubyParser.isDebugging();
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitAliasNode(org.jruby.ast.AliasNode)
- */
- public Instruction visitAliasNode(AliasNode iVisited) {
- handleNode(iVisited);
-
- String name = iVisited.getNewName();
-
- // TODO Use the visibility for the original method that this is aliasing
- Visibility visibility = currentVisibility;
- if (name.equals(CONSTRUCTOR_NAME))
- visibility = Visibility.PROTECTED;
-
- // TODO Find the existing method and steal it's parameter names
- String[] parameterNames = new String[0];
- RubyMethod method = new RubyMethod(getCurrentType(), name,
- parameterNames);
- modelStack.push(method);
-
- RubyElementInfo parentInfo = infoStack.peek();
- parentInfo.addChild(method);
-
- RubyMethodElementInfo info = new RubyMethodElementInfo();
- info.setVisibility(convertVisibility(visibility));
- ISourcePosition pos = iVisited.getPosition();
- setKeywordRange("alias", pos, info, ":" + name);
- infoStack.push(info);
- newElements.put(method, info);
-
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitAndNode(org.jruby.ast.AndNode)
- */
- public Instruction visitAndNode(AndNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitArgsNode(org.jruby.ast.ArgsNode)
- */
- public Instruction visitArgsNode(ArgsNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBlockArgNode());
- if (iVisited.getOptArgs() != null) {
- visitIter(iVisited.getOptArgs().childNodes().iterator());
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitArgsCatNode(org.jruby.ast.ArgsCatNode)
- */
- public Instruction visitArgsCatNode(ArgsCatNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitArrayNode(org.jruby.ast.ArrayNode)
- */
- public Instruction visitArrayNode(ArrayNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
/**
- * @param iterator
- */
- private Instruction visitIter(Iterator iterator) {
- while (iterator.hasNext()) {
- visitNode((Node) iterator.next());
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBackRefNode(org.jruby.ast.BackRefNode)
- */
- public Instruction visitBackRefNode(BackRefNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBeginNode(org.jruby.ast.BeginNode)
- */
- public Instruction visitBeginNode(BeginNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBignumNode(org.jruby.ast.BignumNode)
- */
- public Instruction visitBignumNode(BignumNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBlockArgNode(org.jruby.ast.BlockArgNode)
- */
- public Instruction visitBlockArgNode(BlockArgNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBlockNode(org.jruby.ast.BlockNode)
- */
- public Instruction visitBlockNode(BlockNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBlockPassNode(org.jruby.ast.BlockPassNode)
- */
- public Instruction visitBlockPassNode(BlockPassNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitBreakNode(org.jruby.ast.BreakNode)
- */
- public Instruction visitBreakNode(BreakNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitConstDeclNode(org.jruby.ast.ConstDeclNode)
- */
- public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
- handleNode(iVisited);
- String name = iVisited.getName();
- RubyElement type = getCurrentType();
- RubyConstant handle = new RubyConstant(type, name);
- modelStack.push(handle);
- RubyElementInfo parentInfo = getCurrentTypeInfo();
- parentInfo.addChild(handle);
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- ISourcePosition pos = iVisited.getPosition();
- setTokenRange(pos, info, name);
- // TODO Add more information about the variable
- infoStack.push(info);
- newElements.put(handle, info);
- visitNode(iVisited.getValueNode());
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitClassVarAsgnNode(org.jruby.ast.ClassVarAsgnNode)
- */
- public Instruction visitClassVarAsgnNode(ClassVarAsgnNode iVisited) {
- handleNode(iVisited);
- String name = iVisited.getName();
- RubyElement type = getCurrentType();
- RubyClassVar handle = new RubyClassVar(type, name);
- modelStack.push(handle);
-
- RubyElementInfo parentInfo = getCurrentTypeInfo();
- parentInfo.addChild(handle);
-
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- setTokenRange(iVisited.getPosition(), info, name);
- // TODO Add more information about the variable
- infoStack.push(info);
-
- newElements.put(handle, info);
-
- visitNode(iVisited.getValueNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitClassVarDeclNode(org.jruby.ast.ClassVarDeclNode)
- */
- public Instruction visitClassVarDeclNode(ClassVarDeclNode iVisited) {
- handleNode(iVisited);
- String name = iVisited.getName();
- RubyElement type = getCurrentType();
- RubyClassVar var = new RubyClassVar(type, iVisited.getName());
-
- RubyElementInfo parentInfo = infoStack.peek();
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- setTokenRange(iVisited.getPosition(), info, name);
-
- parentInfo.addChild(var);
-
- newElements.put(var, info);
-
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitClassVarNode(org.jruby.ast.ClassVarNode)
- */
- public Instruction visitClassVarNode(ClassVarNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /**
* @return
*/
private RubyElementInfo getCurrentTypeInfo() {
@@ -454,7 +85,8 @@
element = infoStack.peek();
if (element == null)
break;
- }
+ }
+ Collections.reverse(extras); // Need to reverse extra before pushing back on the stack!
for (Iterator iter = extras.iterator(); iter.hasNext();) {
infoStack.push((RubyElementInfo) iter.next());
}
@@ -463,90 +95,16 @@
return element;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitCallNode(org.jruby.ast.CallNode)
- */
- public Instruction visitCallNode(CallNode iVisited) {
- handleNode(iVisited);
- // FIXME Evaluate the receiver and check to see if the method exists!
- if (DEBUG)
- System.out.println(iVisited.getName());
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getIterNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitCaseNode(org.jruby.ast.CaseNode)
- */
- public Instruction visitCaseNode(CaseNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getCaseNode());
- visitNode(iVisited.getFirstWhenNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitClassNode(org.jruby.ast.ClassNode)
- */
- public Instruction visitClassNode(ClassNode iVisited) {
- handleNode(iVisited);
-
- // This resets the visibility when opening or declaring a class to
- // public
- currentVisibility = Visibility.PUBLIC;
-
- String name = getFullyQualifiedName(iVisited.getCPath());
- RubyType handle = new RubyType(modelStack.peek(), name);
- RubyElement parent = modelStack.peek();
- RubyType existing = findChild(parent, IRubyElement.TYPE, name);
- if (existing != null) {
- // FIXME Should we just increment the occurence count like I do here, or should we conglomerate the types into one LogicalType?
- handle.occurrenceCount = existing.occurrenceCount + 1;
- }
- modelStack.push(handle);
-
- RubyElementInfo parentInfo = infoStack.peek();
- parentInfo.addChild(handle);
-
- RubyTypeElementInfo info = new RubyTypeElementInfo();
- info.setHandle(handle);
- ISourcePosition pos = iVisited.getPosition();
- setKeywordRange(CLASS_KEYWORD, pos, info, name);
-
- if (!name.equals(OBJECT)) {
- String superClass = getSuperClassName(iVisited.getSuperNode());
- info.setSuperclassName(superClass);
- }
-// TODO Collect the included modules and set them here!
- info.setIncludedModuleNames(new String[] {});
- infoStack.push(info);
-
- newElements.put(handle, info);
-
- visitNode(iVisited.getSuperNode());
- visitNode(iVisited.getBodyNode());
-
-
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
private RubyType findChild(RubyElement parent, int type, String name) {
try {
- // FIXME What shoudl we do when resource doesn't "exist" (is external?)
- if (!parent.exists()) return null;
- ArrayList<IRubyElement> children = parent.getChildrenOfType(type);
+ // FIXME What should we do when resource doesn't "exist" (is
+ // external?)
+ if (!parent.exists())
+ return null;
+ List<IRubyElement> children = parent.getChildrenOfType(type);
for (IRubyElement element : children) {
- if (element.getElementName().equals(name)) return (RubyType) element;
+ if (element.getElementName().equals(name))
+ return (RubyType) element;
}
} catch (RubyModelException e) {
RubyCore.log(e);
@@ -555,249 +113,8 @@
}
/**
- * Build up the fully qualified name of the super class for a class
- * declaration
- *
- * @param superNode
* @return
*/
- private String getSuperClassName(Node superNode) {
- if (superNode == null)
- return OBJECT;
- return getFullyQualifiedName(superNode);
- }
-
- private String getFullyQualifiedName(Node node) {
- if (node == null)
- return "";
- if (node instanceof ConstNode) {
- ConstNode constNode = (ConstNode) node;
- return constNode.getName();
- }
- if (node instanceof Colon2Node) {
- Colon2Node colonNode = (Colon2Node) node;
- String prefix = getFullyQualifiedName(colonNode.getLeftNode());
- if (prefix.length() > 0)
- prefix = prefix + NAMESPACE_DELIMETER;
- return prefix + colonNode.getName();
- }
- return "";
- }
-
- /**
- * @param keyword
- * @param pos
- * @param info
- * @param name
- */
- private void setKeywordRange(String keyword, ISourcePosition pos,
- MemberElementInfo info, String name) {
- // TODO Actually check nodes which make up the name for their position!
- int nameStart = pos.getStartOffset() + keyword.length() + 1; // the
- // extra
- // 1 is
- // for a
- // space
- // after
- // the
- // keyword
- info.setNameSourceStart(nameStart);
- info.setNameSourceEnd(nameStart + name.length() - 1);
- info.setSourceRangeStart(pos.getStartOffset());
- info.setSourceRangeEnd(pos.getEndOffset() - 1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitColon2Node(org.jruby.ast.Colon2Node)
- */
- public Instruction visitColon2Node(Colon2Node iVisited) {
- handleNode(iVisited);
- if (DEBUG)
- System.out.println(iVisited.getName());
- visitNode(iVisited.getLeftNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitColon3Node(org.jruby.ast.Colon3Node)
- */
- public Instruction visitColon3Node(Colon3Node iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitConstNode(org.jruby.ast.ConstNode)
- */
- public Instruction visitConstNode(ConstNode iVisited) {
- handleNode(iVisited);
- if (DEBUG)
- System.out.println(iVisited.getName());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDAsgnNode(org.jruby.ast.DAsgnNode)
- */
- public Instruction visitDAsgnNode(DAsgnNode iVisited) {
- handleNode(iVisited);
- RubyDynamicVar var = new RubyDynamicVar(modelStack.peek(), iVisited
- .getName());
- modelStack.push(var);
-
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- infoStack.push(info);
-
- newElements.put(var, info);
-
- if (DEBUG)
- System.out.println(iVisited.getName());
- visitNode(iVisited.getValueNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDRegxNode(org.jruby.ast.DRegexpNode)
- */
- public Instruction visitDRegxNode(DRegexpNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDStrNode(org.jruby.ast.DStrNode)
- */
- public Instruction visitDStrNode(DStrNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDSymbolNode(org.jruby.ast.DSymbolNode)
- */
- public Instruction visitDSymbolNode(DSymbolNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDVarNode(org.jruby.ast.DVarNode)
- */
- public Instruction visitDVarNode(DVarNode iVisited) {
- handleNode(iVisited);
- if (DEBUG)
- System.out.println(iVisited.getName());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDXStrNode(org.jruby.ast.DXStrNode)
- */
- public Instruction visitDXStrNode(DXStrNode iVisited) {
- handleNode(iVisited);
- visitIter(iVisited.childNodes().iterator());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDefinedNode(org.jruby.ast.DefinedNode)
- */
- public Instruction visitDefinedNode(DefinedNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getExpressionNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDefnNode(org.jruby.ast.DefnNode)
- */
- public Instruction visitDefnNode(DefnNode iVisited) {
- handleNode(iVisited);
-
- String name = iVisited.getName();
-
- Visibility visibility = currentVisibility;
- if (name.equals(CONSTRUCTOR_NAME))
- visibility = Visibility.PROTECTED;
-
- RubyElement type = getCurrentType();
- String[] parameterNames = ASTUtil.getArgs(iVisited.getArgsNode(), iVisited.getScope());
- RubyMethod method = createMethod(name, type, parameterNames);
- modelStack.push(method);
-
- RubyElementInfo parentInfo = infoStack.peek();
- parentInfo.addChild(method);
-
- RubyMethodElementInfo info = new RubyMethodElementInfo();
- info.setArgumentNames(parameterNames);
- // TODO Set more information
- info.setVisibility(convertVisibility(visibility));
- ISourcePosition pos = iVisited.getPosition();
- setKeywordRange(METHOD_KEYWORD, pos, info, name);
- infoStack.push(info);
-
- newElements.put(method, info);
-
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getBodyNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
- }
-
- private RubyMethod createMethod(String name, RubyElement type, String[] parameterNames) {
- if (inSingletonClass)
- return new RubySingletonMethod(type, name, parameterNames);
- return new RubyMethod(type, name, parameterNames);
- }
-
- /**
- * @param visibility
- * @return
- */
- private int convertVisibility(Visibility visibility) {
- // FIXME What about the module function and public-protected
- // visibilities?
- if (visibility == Visibility.PUBLIC)
- return IMethod.PUBLIC;
- if (visibility == Visibility.PROTECTED)
- return IMethod.PROTECTED;
- return IMethod.PRIVATE;
- }
-
- /**
- * @return
- */
private RubyElement getCurrentType() {
List extras = new ArrayList();
IRubyElement element = modelStack.peek();
@@ -807,6 +124,7 @@
if (element == null)
break;
}
+ Collections.reverse(extras); // Need to reverse elements before pushing back onto stack!
for (Iterator iter = extras.iterator(); iter.hasNext();) {
modelStack.push((RubyElement) iter.next());
}
@@ -815,1008 +133,202 @@
return (RubyElement) element;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDefsNode(org.jruby.ast.DefsNode)
- */
- public Instruction visitDefsNode(DefsNode iVisited) {
- handleNode(iVisited);
+ public void acceptConstructorReference(String name, int argCount, int offset) {
+ // TODO Auto-generated method stub
- // Get the information no the current parent of this method
- RubyElementInfo parentInfo = infoStack.peek();
-
- /*
- * Get the name of the current static method and add the name of the
- * class or module to the beginning of it. This aInstructions instance
- * method naming conflicts. e.g.: class A def self.method; end def
- * method; end end will give us: A.method method in the Outline View.
- */
- String fullName;
- String receiver = ASTUtil.stringRepresentation(iVisited.getReceiverNode());
- if (receiver != null && receiver.trim().length() > 0) {
- fullName = receiver + "." + iVisited.getName();
- } else {
- fullName = iVisited.getName();
- }
-
- // Get the visibility of the current static method
- Visibility visibility = currentVisibility;
-
- String[] parameterNames = ASTUtil.getArgs(iVisited.getArgsNode(), iVisited.getScope());
-
- // Get the type of the current parent element
- RubyElement type = getCurrentType();
- RubyMethod method = new RubySingletonMethod(type, iVisited.getName(), parameterNames);
- modelStack.push(method);
-
- parentInfo.addChild(method);
-
- RubyMethodElementInfo info = new RubyMethodElementInfo();
-
- // TODO Set more info!
- infoStack.push(info);
- ISourcePosition pos = iVisited.getPosition();
- setKeywordRange(METHOD_KEYWORD, pos, info, fullName);
-
- info.setArgumentNames(parameterNames);
- info.setVisibility(convertVisibility(visibility));
-
- newElements.put(method, info);
-
- // FIXME Evaluate the receiver!
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getBodyNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitDotNode(org.jruby.ast.DotNode)
- */
- public Instruction visitDotNode(DotNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBeginNode());
- visitNode(iVisited.getEndNode());
- return null;
- }
+ public void acceptFieldReference(String name, int offset) {
+ // TODO Auto-generated method stub
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitEnsureNode(org.jruby.ast.EnsureNode)
- */
- public Instruction visitEnsureNode(EnsureNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getEnsureNode());
- visitNode(iVisited.getBodyNode());
- return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitEvStrNode(org.jruby.ast.EvStrNode)
- */
- public Instruction visitEvStrNode(EvStrNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBody());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitFCallNode(org.jruby.ast.FCallNode)
- */
- public Instruction visitFCallNode(FCallNode iVisited) {
- handleNode(iVisited);
- if (DEBUG)
- System.out.println(iVisited.getName());
- String functionName = iVisited.getName();
- if (functionName.equals("require") || functionName.equals("load")) {
- addImport(iVisited, functionName);
+ public void acceptImport(String value, int startOffset, int endOffset) {
+ ImportContainer importContainer = (ImportContainer) script.getImportContainer();
+ // create the import container and its info
+ if (this.importContainerInfo == null) {
+ this.importContainerInfo = new RubyElementInfo();
+ scriptInfo.addChild(importContainer);
+ this.newElements.put(importContainer, this.importContainerInfo);
}
-
- // Collect included mixins
- if ( functionName.equals("include") ) {
- includeModule(iVisited);
- }
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getIterNode());
- return null;
- }
+ RubyImport handle = new RubyImport(importContainer, value);
- private void addImport(FCallNode iVisited, String functionName) {
- ArrayNode node = (ArrayNode) iVisited.getArgsNode();
- String arg = getString(node);
- if (arg != null) {
- ImportContainer importContainer = (ImportContainer) script
- .getImportContainer();
- // create the import container and its info
- if (this.importContainerInfo == null) {
- this.importContainerInfo = new RubyElementInfo();
- scriptInfo.addChild(importContainer);
- this.newElements.put(importContainer,
- this.importContainerInfo);
- }
- RubyImport handle = new RubyImport(importContainer, arg);
+ ImportDeclarationElementInfo info = new ImportDeclarationElementInfo();
+ info.setNameSourceStart(startOffset);
+ info.setNameSourceEnd(endOffset);
+ info.setSourceRangeStart(startOffset);
+ info.setSourceRangeEnd(endOffset);
+ info.name = value;
- ImportDeclarationElementInfo info = new ImportDeclarationElementInfo();
- setKeywordRange(functionName, node.getPosition(), info, arg);
- info.name = arg; // no trailing * if onDemand
-
- this.importContainerInfo.addChild(handle);
- this.newElements.put(handle, info);
- }
+ this.importContainerInfo.addChild(handle);
+ this.newElements.put(handle, info);
}
- private void includeModule(FCallNode iVisited) {
- List<String> mixins = new LinkedList<String>();
- Node argsNode = iVisited.getArgsNode();
- Iterator iter = null;
- if (argsNode instanceof SplatNode) {
- SplatNode splat = (SplatNode) argsNode;
- iter = splat.childNodes().iterator();
- }
- else if (argsNode instanceof ArrayNode) {
- ArrayNode arrayNode = (ArrayNode) iVisited.getArgsNode();
- iter = arrayNode.childNodes().iterator();
- }
- for (; iter.hasNext();) {
- Node mixinNameNode = (Node) iter.next();
- if ( mixinNameNode instanceof StrNode ) {
- mixins.add( ((StrNode)mixinNameNode).getValue().toString() );
- }
- if ( mixinNameNode instanceof DStrNode ) {
- Node next = (Node)((DStrNode)mixinNameNode).childNodes().iterator().next();
- if ( next instanceof StrNode ) {
- mixins.add( ((StrNode)next).getValue().toString() );
- }
- }
- if (mixinNameNode instanceof ConstNode) {
- mixins.add( ((ConstNode)mixinNameNode).getName() );
- }
- }
-
- // Push mixins into parent type, if available
- if ( infoStack.peek() instanceof RubyTypeElementInfo ) {
-
- // Get parent type
- RubyTypeElementInfo parentType = (RubyTypeElementInfo)infoStack.peek();
+ public void acceptMethodReference(String name, int argCount, int offset) {
+ // TODO Auto-generated method stub
- // Get existing imported module names
- String[] importedModuleNames = parentType.getIncludedModuleNames();
- List<String> mergedModuleNames = new LinkedList<String>();
-
- // Merge newly found module name(s)
- if ( importedModuleNames != null ) {
- mergedModuleNames.addAll( (Arrays.asList( importedModuleNames )));
- }
- mergedModuleNames.addAll( mixins );
-
- // Apply included module names back to parent type info
- String[] newIncludedModuleNames = mergedModuleNames.toArray(new String[]{});
- parentType.setIncludedModuleNames( newIncludedModuleNames );
- }
}
- /**
- * @param node
- * @return
- */
- private String getString(ArrayNode node) {
- Object tmp = node.childNodes().iterator().next();
- if (tmp instanceof DStrNode) {
- DStrNode dstrNode = (DStrNode) tmp;
- tmp = dstrNode.childNodes().iterator().next();
- }
- if (tmp instanceof StrNode) {
- StrNode strNode = (StrNode) tmp;
- return strNode.getValue().toString();
- }
- return null;
- }
+ public void acceptProblem(CategorizedProblem problem) {
+ // TODO Auto-generated method stub
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitFalseNode(org.jruby.ast.FalseNode)
- */
- public Instruction visitFalseNode(FalseNode iVisited) {
- handleNode(iVisited);
- return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitFixnumNode(org.jruby.ast.FixnumNode)
- */
- public Instruction visitFixnumNode(FixnumNode iVisited) {
- handleNode(iVisited);
- return null;
- }
+ public void acceptTypeReference(String name, int startOffset, int endOffset) {
+ // TODO Auto-generated method stub
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitFlipNode(org.jruby.ast.FlipNode)
- */
- public Instruction visitFlipNode(FlipNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBeginNode());
- visitNode(iVisited.getEndNode());
- return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitFloatNode(org.jruby.ast.FloatNode)
- */
- public Instruction visitFloatNode(FloatNode iVisited) {
- handleNode(iVisited);
- return null;
- }
+ public void acceptUnknownReference(String name, int startOffset, int endOffset) {
+ // TODO Auto-generated method stub
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitForNode(org.jruby.ast.ForNode)
- */
- public Instruction visitForNode(ForNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getVarNode());
- visitNode(iVisited.getIterNode());
- visitNode(iVisited.getBodyNode());
- return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitGlobalAsgnNode(org.jruby.ast.GlobalAsgnNode)
- */
- public Instruction visitGlobalAsgnNode(GlobalAsgnNode iVisited) {
- handleNode(iVisited);
-
- String name = iVisited.getName();
- RubyGlobal global = new RubyGlobal(script, name);
-
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
- ISourcePosition pos = iVisited.getPosition();
- setTokenRange(pos, info, name);
- // TODO Set more info!
-
- scriptInfo.addChild(global);
-
- newElements.put(global, info);
-
- visitNode(iVisited.getValueNode());
- return null;
+ public void enterConstructor(MethodInfo constructor) {
+ enterMethod(constructor);
}
- /**
- * @param pos
- * @param info
- */
- private void setTokenRange(ISourcePosition pos, RubyFieldElementInfo info,
- String name) {
- int realEnd = pos.getStartOffset() + name.length() - 1;
- info.setNameSourceStart(pos.getStartOffset());
- info.setNameSourceEnd(realEnd);
- info.setSourceRangeStart(pos.getStartOffset());
- info.setSourceRangeEnd(realEnd);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitGlobalVarNode(org.jruby.ast.GlobalVarNode)
- */
- public Instruction visitGlobalVarNode(GlobalVarNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitHashNode(org.jruby.ast.HashNode)
- */
- public Instruction visitHashNode(HashNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getListNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitInstAsgnNode(org.jruby.ast.InstAsgnNode)
- */
- public Instruction visitInstAsgnNode(InstAsgnNode iVisited) {
- handleNode(iVisited);
-
- String name = iVisited.getName();
- RubyElement type = getCurrentType();
- RubyInstVar var = new RubyInstVar(type, name);
-
- RubyElementInfo parentInfo = getCurrentTypeInfo();
- parentInfo.addChild(var);
-
+ public void enterField(FieldInfo field) {
+ RubyField handle;
+ if (field.name.startsWith("@@") ) {
+ handle = new RubyClassVar(getCurrentType(), field.name);
+ } else if (field.name.startsWith("@") ) {
+ handle = new RubyInstVar(getCurrentType(), field.name);
+ } else if (field.name.startsWith("$") ) {
+ handle = new RubyGlobal(script, field.name);
+ } else if (Character.isUpperCase(field.name.charAt(0))) {
+ handle = new RubyConstant(getCurrentType(), field.name);
+ } else {
+ int start = field.declarationStart - field.name.length() + 1;
+ int end = start + field.name.length();
+ handle = new RubyLocalVar(modelStack.peek(), field.name, start, end);
+ }
+ modelStack.push(handle);
+
+ // Add to enclosing type
+ RubyElementInfo parentInfo;
+ if (handle instanceof RubyLocalVar) {
+ parentInfo = infoStack.peek();
+ } else if (handle instanceof RubyGlobal){
+ parentInfo = scriptInfo; // FIXME Grab the project info?
+ } else {
+ parentInfo = getCurrentTypeInfo();
+ }
+ parentInfo.addChild(handle);
+
RubyFieldElementInfo info = new RubyFieldElementInfo();
- // TODO Add more information to the info object!
- ISourcePosition pos = iVisited.getPosition();
- setTokenRange(pos, info, name);
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
-
- newElements.put(var, info);
-
- visitNode(iVisited.getValueNode());
- return null;
+ info.setSourceRangeStart(field.declarationStart);
+ info.setNameSourceStart(field.nameSourceStart);
+ info.setNameSourceEnd(field.nameSourceEnd);
+
+ infoStack.push(info);
+ newElements.put(handle, info);
}
- /**
- * @param value
- * @return
- */
- private String estimateValueType(Node value) {
- if (value instanceof CallNode) {
- CallNode call = (CallNode) value;
- if (call.getName().equals("new")) {
- Node receiver = call.getReceiverNode();
- if (receiver instanceof ConstNode) {
- ConstNode constNode = (ConstNode) receiver;
- return constNode.getName();
- }
- }
- } else if (value instanceof DStrNode) {
- return "String";
-
- } else if (value instanceof FixnumNode) {
- return "Fixnum";
-
- } else if (value instanceof BignumNode) {
- return "Bignum";
+ public void enterMethod(MethodInfo methodInfo) {
+ RubyMethod method;
+ if (methodInfo.isClassLevel) {
+ method = new RubySingletonMethod(getCurrentType(), methodInfo.name, methodInfo.parameterNames);
+ } else {
+ method = new RubyMethod(getCurrentType(), methodInfo.name, methodInfo.parameterNames);
}
- return OBJECT;
- }
+ modelStack.push(method);
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitInstVarNode(org.jruby.ast.InstVarNode)
- */
- public Instruction visitInstVarNode(InstVarNode iVisited) {
- handleNode(iVisited);
- return null;
- }
+ infoStack.peek().addChild(method);
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitIfNode(org.jruby.ast.IfNode)
- */
- public Instruction visitIfNode(IfNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getCondition());
- visitNode(iVisited.getThenBody());
- visitNode(iVisited.getElseBody());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitIterNode(org.jruby.ast.IterNode)
- */
- public Instruction visitIterNode(IterNode iVisited) {
- handleNode(iVisited);
-
- RubyBlock block = new RubyBlock(modelStack.peek());
- modelStack.push(block);
-
- visitNode(iVisited.getVarNode());
- visitNode(iVisited.getBodyNode());
- if (DEBUG)
- System.out.println("Iter Node ended");
-
- modelStack.pop();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitLocalAsgnNode(org.jruby.ast.LocalAsgnNode)
- */
- public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited) {
- handleNode(iVisited);
-
- int start = iVisited.getPosition().getStartOffset()
- - iVisited.getName().length() + 1;
- int end = start + iVisited.getName().length();
- RubyLocalVar var = new RubyLocalVar(modelStack.peek(), iVisited
- .getName(), start, end);
- modelStack.push(var);
-
- RubyElementInfo parentInfo = infoStack.peek();
- parentInfo.addChild(var);
-
- RubyFieldElementInfo info = new RubyFieldElementInfo();
- info.setTypeName(estimateValueType(iVisited.getValueNode()));
-
- ISourcePosition pos = iVisited.getPosition();
- setTokenRange(pos, info, iVisited.getName());
+ RubyMethodElementInfo info = new RubyMethodElementInfo();
+ info.setArgumentNames(methodInfo.parameterNames);
+ info.setVisibility(methodInfo.visibility);
+ info.setNameSourceStart(methodInfo.nameSourceStart);
+ info.setNameSourceEnd(methodInfo.nameSourceEnd);
+ info.setSourceRangeStart(methodInfo.declarationStart);
infoStack.push(info);
-
- newElements.put(var, info);
-
- visitNode(iVisited.getValueNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
+ newElements.put(method, info);
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitLocalVarNode(org.jruby.ast.LocalVarNode)
- */
- public Instruction visitLocalVarNode(LocalVarNode iVisited) {
- handleNode(iVisited);
- return null;
+ public void enterScript() {
+ // do nothing
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitMultipleAsgnNode(org.jruby.ast.MultipleAsgnNode)
- */
- public Instruction visitMultipleAsgnNode(MultipleAsgnNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getHeadNode());
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitMatch2Node(org.jruby.ast.Match2Node)
- */
- public Instruction visitMatch2Node(Match2Node iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitMatch3Node(org.jruby.ast.Match3Node)
- */
- public Instruction visitMatch3Node(Match3Node iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitMatchNode(org.jruby.ast.MatchNode)
- */
- public Instruction visitMatchNode(MatchNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getRegexpNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitModuleNode(org.jruby.ast.ModuleNode)
- */
- public Instruction visitModuleNode(ModuleNode iVisited) {
- handleNode(iVisited);
- String name = getFullyQualifiedName(iVisited.getCPath());
- RubyModule module = new RubyModule(modelStack.peek(), name);
+ public void enterType(TypeInfo type) {
+ RubyType handle;
+ if (type.isModule) {
+ handle = new RubyModule(modelStack.peek(), type.name);
+ } else {
+ handle = new RubyType(modelStack.peek(), type.name);
+ }
RubyElement parent = modelStack.peek();
- RubyType existing = findChild(parent, IRubyElement.TYPE, name);
+ RubyType existing = findChild(parent, IRubyElement.TYPE, type.name);
if (existing != null) {
- // FIXME Should we just increment the occurence count like I do here, or should we conglomerate the types into one LogicalType?
- module.occurrenceCount = existing.occurrenceCount + 1;
+ // FIXME Should we just increment the occurence count like I do
+ // here, or should we conglomerate the types into one LogicalType?
+ handle.occurrenceCount = existing.occurrenceCount + 1;
}
- modelStack.push(module);
+ modelStack.push(handle);
- RubyElementInfo parentInfo = infoStack.peek();
- parentInfo.addChild(module);
+ infoStack.peek().addChild(handle);
RubyTypeElementInfo info = new RubyTypeElementInfo();
- info.setHandle(module);
- ISourcePosition pos = iVisited.getPosition();
- setKeywordRange(MODULE_KEYWORD, pos, info, name);
+ info.setHandle(handle);
+ info.setNameSourceStart(type.nameSourceStart);
+ info.setNameSourceEnd(type.nameSourceEnd);
+ info.setSourceRangeStart(type.declarationStart);
+ info.setSuperclassName(type.superclass);
+ info.setIncludedModuleNames(type.modules);
infoStack.push(info);
- newElements.put(module, info);
-
- visitNode(iVisited.getBodyNode());
-
- modelStack.pop();
- infoStack.pop();
- return null;
+ newElements.put(handle, info);
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitNewlineNode(org.jruby.ast.NewlineNode)
- */
- public Instruction visitNewlineNode(NewlineNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getNextNode());
- return null;
+ public void exitConstructor(int endOffset) {
+ exitMethod(endOffset);
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitNextNode(org.jruby.ast.NextNode)
- */
- public Instruction visitNextNode(NextNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValueNode());
- return null;
+ public void exitField(int endOffset) {
+ RubyFieldElementInfo info = (RubyFieldElementInfo) infoStack.pop();
+ info.setSourceRangeEnd(endOffset); // TODO Does this also update the
+ // instance in newElements?
+ modelStack.pop();
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitNilNode(org.jruby.ast.NilNode)
- */
- public Instruction visitNilNode(NilNode iVisited) {
- handleNode(iVisited);
- return null;
+ public void exitMethod(int endOffset) {
+ RubyMethodElementInfo info = (RubyMethodElementInfo) infoStack.pop();
+ info.setSourceRangeEnd(endOffset); // TODO Does this also update the
+ // instance in newElements?
+ modelStack.pop();
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitNotNode(org.jruby.ast.NotNode)
- */
- public Instruction visitNotNode(NotNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getConditionNode());
- return null;
+ public void exitScript(int endOffset) {
+ modelStack.pop();
+ infoStack.pop();
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitNthRefNode(org.jruby.ast.NthRefNode)
- */
- public Instruction visitNthRefNode(NthRefNode iVisited) {
- handleNode(iVisited);
- return null;
+ public void exitType(int endOffset) {
+ RubyTypeElementInfo info = (RubyTypeElementInfo) infoStack.pop();
+ info.setSourceRangeEnd(endOffset); // TODO Does this also update the
+ // instance in newElements?
+ modelStack.pop();
}
+
+ public void acceptMixin(String string) {
+ // Push mixins into parent type, if available
+ RubyElementInfo info = getCurrentTypeInfo();
+ if (!(info instanceof RubyTypeElementInfo)) return; // FIXME Include this in a default toplevel type for the script?!
+ RubyTypeElementInfo parentType = (RubyTypeElementInfo) info;
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOpElementAsgnNode(org.jruby.ast.OpElementAsgnNode)
- */
- public Instruction visitOpElementAsgnNode(OpElementAsgnNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getArgsNode());
- visitNode(iVisited.getValueNode());
- return null;
- }
+ // Get existing imported module names
+ String[] importedModuleNames = parentType.getIncludedModuleNames();
+ List<String> mergedModuleNames = new LinkedList<String>();
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOpAsgnNode(org.jruby.ast.OpAsgnNode)
- */
- public Instruction visitOpAsgnNode(OpAsgnNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOpAsgnAndNode(org.jruby.ast.OpAsgnAndNode)
- */
- public Instruction visitOpAsgnAndNode(OpAsgnAndNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOpAsgnOrNode(org.jruby.ast.OpAsgnOrNode)
- */
- public Instruction visitOpAsgnOrNode(OpAsgnOrNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOptNNode(org.jruby.ast.OptNNode)
- */
- public Instruction visitOptNNode(OptNNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitOrNode(org.jruby.ast.OrNode)
- */
- public Instruction visitOrNode(OrNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitPostExeNode(org.jruby.ast.PostExeNode)
- */
- public Instruction visitPostExeNode(PostExeNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitRedoNode(org.jruby.ast.RedoNode)
- */
- public Instruction visitRedoNode(RedoNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitRegexpNode(org.jruby.ast.RegexpNode)
- */
- public Instruction visitRegexpNode(RegexpNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitRescueBodyNode(org.jruby.ast.RescueBodyNode)
- */
- public Instruction visitRescueBodyNode(RescueBodyNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getExceptionNodes());
- visitNode(iVisited.getOptRescueNode());
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitRescueNode(org.jruby.ast.RescueNode)
- */
- public Instruction visitRescueNode(RescueNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getRescueNode());
- visitNode(iVisited.getBodyNode());
- visitNode(iVisited.getElseNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitRetryNode(org.jruby.ast.RetryNode)
- */
- public Instruction visitRetryNode(RetryNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitReturnNode(org.jruby.ast.ReturnNode)
- */
- public Instruction visitReturnNode(ReturnNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValueNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSClassNode(org.jruby.ast.SClassNode)
- */
- public Instruction visitSClassNode(SClassNode iVisited) {
- handleNode(iVisited);
-
- Node receiver = iVisited.getReceiverNode();
- if (receiver instanceof SelfNode) {
-// TODO We need to mark that we're in the singlteon class - this means all instance methods are actually singleton methods on the class we're in...
- inSingletonClass = true;
- visitNode(iVisited.getBodyNode());
- inSingletonClass = false;
- }
- return null;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSelfNode(org.jruby.ast.SelfNode)
- */
- public Instruction visitSelfNode(SelfNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSplatNode(org.jruby.ast.SplatNode)
- */
- public Instruction visitSplatNode(SplatNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValue());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitStrNode(org.jruby.ast.StrNode)
- */
- public Instruction visitStrNode(StrNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSuperNode(org.jruby.ast.SuperNode)
- */
- public Instruction visitSuperNode(SuperNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getArgsNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSValueNode(org.jruby.ast.SValueNode)
- */
- public Instruction visitSValueNode(SValueNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValue());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitSymbolNode(org.jruby.ast.SymbolNode)
- */
- public Instruction visitSymbolNode(SymbolNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitToAryNode(org.jruby.ast.ToAryNode)
- */
- public Instruction visitToAryNode(ToAryNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getValue());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitTrueNode(org.jruby.ast.TrueNode)
- */
- public Instruction visitTrueNode(TrueNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitUndefNode(org.jruby.ast.UndefNode)
- */
- public Instruction visitUndefNode(UndefNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitUntilNode(org.jruby.ast.UntilNode)
- */
- public Instruction visitUntilNode(UntilNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getConditionNode());
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitVAliasNode(org.jruby.ast.VAliasNode)
- */
- public Instruction visitVAliasNode(VAliasNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitVCallNode(org.jruby.ast.VCallNode)
- */
- public Instruction visitVCallNode(VCallNode iVisited) {
- handleNode(iVisited);
- // XXX If the call has arguments, we need to find the method athcing he symbols and mark their visibility differently
- String functionName = iVisited.getName();
- if (functionName.equals("public")) {
- currentVisibility = Visibility.PUBLIC;
- } else if (functionName.equals("private")) {
- currentVisibility = Visibility.PRIVATE;
- } else if (functionName.equals("protected")) {
- currentVisibility = Visibility.PROTECTED;
+ // Merge newly found module name(s)
+ if (importedModuleNames != null) {
+ mergedModuleNames.addAll((Arrays.asList(importedModuleNames)));
}
- return null;
- }
+ mergedModuleNames.add(string);
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitWhenNode(org.jruby.ast.WhenNode)
- */
- public Instruction visitWhenNode(WhenNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getExpressionNodes());
- visitNode(iVisited.getBodyNode());
- visitNode(iVisited.getNextCase());
- return null;
+ // Apply included module names back to parent type info
+ String[] newIncludedModuleNames = mergedModuleNames.toArray(new String[] {});
+ parentType.setIncludedModuleNames(newIncludedModuleNames);
}
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitWhileNode(org.jruby.ast.WhileNode)
- */
- public Instruction visitWhileNode(WhileNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getConditionNode());
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitXStrNode(org.jruby.ast.XStrNode)
- */
- public Instruction visitXStrNode(XStrNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitYieldNode(org.jruby.ast.YieldNode)
- */
- public Instruction visitYieldNode(YieldNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getArgsNode());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitZArrayNode(org.jruby.ast.ZArrayNode)
- */
- public Instruction visitZArrayNode(ZArrayNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jruby.ast.visitor.NodeVisitor#visitZSuperNode(org.jruby.ast.ZSuperNode)
- */
- public Instruction visitZSuperNode(ZSuperNode iVisited) {
- handleNode(iVisited);
- return null;
- }
-
- private Instruction visitNode(Node iVisited) {
- if (iVisited != null)
- iVisited.accept(this);
- return null;
- }
-
- /**
- * @param visited
- */
- private Instruction handleNode(Node visited) {
- // Uncomment for logging
- if (DEBUG)
- System.out.println(visited.toString() + ", position -> "
- + visited.getPosition());
- return null;
- }
-
- public Instruction visitArgsPushNode(ArgsPushNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getFirstNode());
- visitNode(iVisited.getSecondNode());
- return null;
- }
-
- public Instruction visitAttrAssignNode(AttrAssignNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getReceiverNode());
- visitNode(iVisited.getArgsNode());
- return null;
- }
-
- public Instruction visitRootNode(RootNode iVisited) {
- handleNode(iVisited);
- visitNode(iVisited.getBodyNode());
- return null;
- }
-
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java 2007-04-03 18:00:43 UTC (rev 2264)
+++ trunk/org.rubypeople.rdt.core.tests/src/RubyParserCmd.java 2007-04-03 18:02:06 UTC (rev 2265)
@@ -13,10 +13,12 @@
import org.jruby.ast.Node;
import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.eclipse.shams.resources.ShamFile;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor;
import org.rubypeople.rdt.internal.core.DefaultWorkingCopyOwner;
import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.RubyScriptElementInfo;
import org...
[truncated message content] |
|
From: <caw...@us...> - 2007-04-03 18:00:44
|
Revision: 2264
http://svn.sourceforge.net/rubyeclipse/?rev=2264&view=rev
Author: cawilliams
Date: 2007-04-03 11:00:43 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
add additional test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-03 18:00:37 UTC (rev 2263)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-03 18:00:43 UTC (rev 2264)
@@ -167,4 +167,18 @@
assertToken(IRubyColorConstants.RUBY_SYMBOL, 23, 2); // ' :'
assertToken(IRubyColorConstants.RUBY_SYMBOL, 25, 8); // 'each_key'
}
+
+ public void testSymbolInsideBracketsTwo() {
+ String code = "@repository=params[:repository]";
+ setUpScanner(code);
+ assertToken(IRubyColorConstants.RUBY_INSTANCE_VARIABLE, 0, 11); // '@repository'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 11, 1); // '='
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 12, 6); // 'params'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 18, 1); // '['
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 19, 1); // ':'
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 20, 10); // 'repository'
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 30, 1); // ']'
+ }
+
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 18:00:40
|
Revision: 2263
http://svn.sourceforge.net/rubyeclipse/?rev=2263&view=rev
Author: cawilliams
Date: 2007-04-03 11:00:37 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
fix broken test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyCodeAnalyzer.java
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java 2007-04-03 17:58:15 UTC (rev 2262)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java 2007-04-03 18:00:37 UTC (rev 2263)
@@ -48,11 +48,6 @@
syntaxExceptionArg = syntaxException;
}
- public void assertErrorCreated(ShamFile expectedFile, SyntaxException expectedSyntaxException) {
- Assert.assertEquals("file", expectedFile, fileArg);
- Assert.assertEquals("syntaxException", expectedSyntaxException, syntaxExceptionArg);
- }
-
public void createTasks(IFile file, List<TaskTag> tasks) throws CoreException {
fileArg = file;
tasksArg = tasks;
@@ -89,13 +84,6 @@
endOffsetArg = endOffset;
}
- public void createError(IFile file, String message, int startLine, int startOffset, int endOffset) {
- fileArg = file;
- ISourcePosition position = new RdtPosition(startLine, startOffset, endOffset);
- SyntaxException e = new SyntaxException(position, message);
- syntaxExceptionArg = e;
- }
-
public void addProblem(IFile file, IProblem problem) {
fileArg = file;
messageArg = problem.getMessage();
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyCodeAnalyzer.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyCodeAnalyzer.java 2007-04-03 17:58:15 UTC (rev 2262)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyCodeAnalyzer.java 2007-04-03 18:00:37 UTC (rev 2263)
@@ -20,6 +20,7 @@
import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.eclipse.shams.resources.ShamFile;
+import org.rubypeople.rdt.internal.core.parser.RdtPosition;
public class TC_RubyCodeAnalyzer extends TestCase {
@@ -64,12 +65,12 @@
public void testSyntaxException() throws Exception {
- SyntaxException syntaxException = new SyntaxException(null, "");
+ SyntaxException syntaxException = new SyntaxException(new RdtPosition(1, 0, 10), "");
parser.setExceptionToThrow(syntaxException);
compiler.compileFile(file);
file.assertContentStreamClosed();
- markerManager.assertErrorCreated(file, syntaxException);
+ markerManager.assertWarningAdded(file, "", 1, 0, 10);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-03 17:58:18
|
Revision: 2262
http://svn.sourceforge.net/rubyeclipse/?rev=2262&view=rev
Author: mbarchfe
Date: 2007-04-03 10:58:15 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
add RubyActionGroup to editor's source context menu
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.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/RubyActionGroup.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-04-03 15:39:54 UTC (rev 2261)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-04-03 17:58:15 UTC (rev 2262)
@@ -49,6 +49,7 @@
import org.rubypeople.rdt.refactoring.core.pushdown.PushDownRefactoring;
import org.rubypeople.rdt.refactoring.core.rename.RenameRefactoring;
import org.rubypeople.rdt.refactoring.core.splitlocal.SplitTempRefactoring;
+import org.rubypeople.rdt.ui.actions.RubyActionGroup;
public class RefactoringActionGroup extends ActionGroup {
@@ -57,7 +58,7 @@
public void fillContextMenu(IMenuManager menu) {
TextSelectionProvider selectionProvider = new TextSelectionProvider(null);
menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, getSourceMenu(selectionProvider));
+ menu.insertAfter(INSERT_AFTER_GROUP_NAME, getSourceMenu(menu, selectionProvider));
menu.insertAfter(INSERT_AFTER_GROUP_NAME, getRefactorMenu(selectionProvider));
menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
}
@@ -80,11 +81,11 @@
return submenu;
}
- private IMenuManager getSourceMenu(TextSelectionProvider selectionProvider) {
- IMenuManager submenu = new MenuManager(Messages.SourceActionGroup);
- submenu.add(new RefactoringAction(GenerateAccessorsRefactoring.class, GenerateAccessorsRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(GenerateConstructorRefactoring.class, GenerateConstructorRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(OverrideMethodRefactoring.class, OverrideMethodRefactoring.NAME, selectionProvider));
+ private IMenuManager getSourceMenu(IMenuManager menu, TextSelectionProvider selectionProvider) {
+ IMenuManager submenu = RubyActionGroup.getRubySourceMenu(menu) ;
+ submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateAccessorsRefactoring.class, GenerateAccessorsRefactoring.NAME, selectionProvider));
+ submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateConstructorRefactoring.class, GenerateConstructorRefactoring.NAME, selectionProvider));
+ submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(OverrideMethodRefactoring.class, OverrideMethodRefactoring.NAME, selectionProvider));
return submenu;
}
}
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-04-03 15:39:54 UTC (rev 2261)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPlugin.java 2007-04-03 17:58:15 UTC (rev 2262)
@@ -8,13 +8,18 @@
*/
package org.rubypeople.rdt.internal.ui;
+import java.io.IOException;
+import java.util.PropertyResourceBundle;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
@@ -68,7 +73,7 @@
private static final String ORG_ECLIPSE_UI_VIEWS_TASK_LIST = "org.eclipse.ui.views.TaskList";
private static final String ORG_ECLIPSE_UI_VIEWS_PROBLEM_VIEW = "org.eclipse.ui.views.ProblemView";
- protected static RubyPlugin plugin;
+ protected static RubyPlugin plugin;
public static final String PLUGIN_ID = "org.rubypeople.rdt.ui"; //$NON-NLS-1$
protected RubyTextTools textTools;
@@ -76,8 +81,11 @@
private IWorkingCopyManager fWorkingCopyManager;
private RubyDocumentProvider fDocumentProvider;
+ protected PropertyResourceBundle pluginProperties;
+
/**
* The combined preference store.
+ *
* @since 3.0
*/
private IPreferenceStore fCombinedPreferenceStore;
@@ -91,9 +99,9 @@
private MockupPreferenceStore fMockupPreferenceStore;
private RubyFoldingStructureProviderRegistry fFoldingStructureProviderRegistry;
- private boolean new060ViewsOpened;
- private ImageDescriptorRegistry fImageDescriptorRegistry;
- private MembersOrderPreferenceCache fMembersOrderPreferenceCache;
+ private boolean new060ViewsOpened;
+ private ImageDescriptorRegistry fImageDescriptorRegistry;
+ private MembersOrderPreferenceCache fMembersOrderPreferenceCache;
private RubyScriptDocumentProvider fExternalRubyDocumentProvider;
public RubyPlugin() {
@@ -108,7 +116,8 @@
* @return the mock-up preference store
*/
public MockupPreferenceStore getMockupPreferenceStore() {
- if (fMockupPreferenceStore == null) fMockupPreferenceStore = new MockupPreferenceStore();
+ if (fMockupPreferenceStore == null)
+ fMockupPreferenceStore = new MockupPreferenceStore();
return fMockupPreferenceStore;
}
@@ -127,7 +136,7 @@
// wrong order, changes to properties in the preferences page are not
// immediately updated
// within the ruby editors.
- //getTextTools();
+ // getTextTools();
// Here's where the magic happens that makes the IRubyScript's contents
// get re-routed to the IDocument's latest contents
@@ -136,70 +145,70 @@
public IBuffer createBuffer(IRubyScript workingCopy) {
IRubyScript original = workingCopy.getPrimary();
IResource resource = original.getResource();
- if (resource instanceof IFile) return new DocumentAdapter(workingCopy, (IFile) resource);
+ if (resource instanceof IFile)
+ return new DocumentAdapter(workingCopy, (IFile) resource);
return DocumentAdapter.NULL;
}
});
-
- IPreferenceStore store= getPreferenceStore();
- fMembersOrderPreferenceCache= new MembersOrderPreferenceCache();
- fMembersOrderPreferenceCache.install(store);
-
-
- RubyCore rubyCore = RubyCore.getPlugin();
- BlockingSymbolFinder symbolFinder = new BlockingSymbolFinder(rubyCore.getSymbolFinder(), new EclipseJobScheduler());
- rubyCore.setSymbolFinder(symbolFinder);
-
+
+ IPreferenceStore store = getPreferenceStore();
+ fMembersOrderPreferenceCache = new MembersOrderPreferenceCache();
+ fMembersOrderPreferenceCache.install(store);
+
+ RubyCore rubyCore = RubyCore.getPlugin();
+ BlockingSymbolFinder symbolFinder = new BlockingSymbolFinder(rubyCore.getSymbolFinder(), new EclipseJobScheduler());
+ rubyCore.setSymbolFinder(symbolFinder);
+
listenForNewProjects();
upgradeOldProjects();
String generateRdocOption = Platform.getDebugOption(RubyPlugin.PLUGIN_ID + "/generaterdoc");
RDocUtility.setDebugging(generateRdocOption == null ? false : generateRdocOption.equalsIgnoreCase("true"));
}
- private void listenForNewProjects() {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(new ProjectUpgradeListener(this));
- }
-
+ private void listenForNewProjects() {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(new ProjectUpgradeListener(this));
+ }
+
void upgradeOldProjects() {
- Job job = new Job("Upgrade Old Ruby Projects") {
-
- protected IStatus run(IProgressMonitor monitor) {
- try {
- boolean projectUpgraded = RubyCore.upgradeOldProjects();
-
- if (projectUpgraded) {
- openNew060Views();
- }
- } catch (CoreException e) {
- log(IStatus.WARNING, "While upgrading RDT projects", e);
- }
- return Status.OK_STATUS;
- }};
- job.schedule();
+ Job job = new Job("Upgrade Old Ruby Projects") {
+
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ boolean projectUpgraded = RubyCore.upgradeOldProjects();
+
+ if (projectUpgraded) {
+ openNew060Views();
+ }
+ } catch (CoreException e) {
+ log(IStatus.WARNING, "While upgrading RDT projects", e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
}
- private void openNew060Views() {
- if (new060ViewsOpened)
- return;
- WorkbenchJob job = new WorkbenchJob("Show Task View") {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- try{
- IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (dw != null) {
- IWorkbenchPage page = dw.getActivePage();
- if (page != null) {
- page.showView(ORG_ECLIPSE_UI_VIEWS_TASK_LIST);
- page.showView(ORG_ECLIPSE_UI_VIEWS_PROBLEM_VIEW);
- new060ViewsOpened = true;
- }
- }
- }catch (PartInitException ignored){
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
+ private void openNew060Views() {
+ if (new060ViewsOpened)
+ return;
+ WorkbenchJob job = new WorkbenchJob("Show Task View") {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ try {
+ IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (dw != null) {
+ IWorkbenchPage page = dw.getActivePage();
+ if (page != null) {
+ page.showView(ORG_ECLIPSE_UI_VIEWS_TASK_LIST);
+ page.showView(ORG_ECLIPSE_UI_VIEWS_PROBLEM_VIEW);
+ new060ViewsOpened = true;
+ }
+ }
+ } catch (PartInitException ignored) {}
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
/*
* (non-Javadoc)
@@ -221,12 +230,12 @@
textTools.dispose();
textTools = null;
}
-
- if (fMembersOrderPreferenceCache != null) {
- fMembersOrderPreferenceCache.dispose();
- fMembersOrderPreferenceCache= null;
- }
-
+
+ if (fMembersOrderPreferenceCache != null) {
+ fMembersOrderPreferenceCache.dispose();
+ fMembersOrderPreferenceCache = null;
+ }
+
} finally {
super.stop(context);
}
@@ -255,7 +264,8 @@
public static void log(IStatus status) {
getDefault().getLog().log(status);
System.out.println(status.getMessage());
- if (status.getException() != null) status.getException().printStackTrace();
+ if (status.getException() != null)
+ status.getException().printStackTrace();
}
public static void log(Throwable e) {
@@ -272,12 +282,13 @@
}
public synchronized RubyTextTools getRubyTextTools() {
- if (textTools == null) textTools = new RubyTextTools(getPreferenceStore(), RubyCore.getPlugin().getPluginPreferences());
+ if (textTools == null)
+ textTools = new RubyTextTools(getPreferenceStore(), RubyCore.getPlugin().getPluginPreferences());
return textTools;
}
public OldCodeFormatter getCodeFormatter() {
- return new OldCodeFormatter(RubyCore.getOptions());
+ return new OldCodeFormatter(RubyCore.getOptions());
}
protected void initializeDefaultPreferences(IPreferenceStore store) {
@@ -286,7 +297,7 @@
store.setDefault(RUBY_DEFAULT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
PreferenceConverter.setDefault(store, RUBY_KEYWORD, new RGB(164, 53, 122));
store.setDefault(RUBY_KEYWORD + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
- store.setDefault(RUBY_KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
+ store.setDefault(RUBY_KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
PreferenceConverter.setDefault(store, RUBY_ERROR, new RGB(255, 255, 255));
store.setDefault(RUBY_ERROR + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
store.setDefault(RUBY_ERROR + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
@@ -296,7 +307,7 @@
store.setDefault(RUBY_STRING + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
PreferenceConverter.setDefault(store, RUBY_REGEXP, new RGB(90, 30, 160));
store.setDefault(RUBY_REGEXP + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
- store.setDefault(RUBY_REGEXP + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
+ store.setDefault(RUBY_REGEXP + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
PreferenceConverter.setDefault(store, RUBY_COMMAND, new RGB(0, 128, 128));
store.setDefault(RUBY_COMMAND + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
store.setDefault(RUBY_COMMAND + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
@@ -306,15 +317,15 @@
PreferenceConverter.setDefault(store, RUBY_CHARACTER, new RGB(255, 128, 128));
store.setDefault(RUBY_CHARACTER + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
store.setDefault(RUBY_CHARACTER + PreferenceConstants.EDITOR_ITALIC_SUFFIX, true);
- PreferenceConverter.setDefault(store, RUBY_SYMBOL, new RGB(255, 64, 64));
- store.setDefault(RUBY_SYMBOL + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
- store.setDefault(RUBY_SYMBOL + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
- PreferenceConverter.setDefault(store, RUBY_INSTANCE_VARIABLE, new RGB(0, 64, 128));
- store.setDefault(RUBY_INSTANCE_VARIABLE + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
- store.setDefault(RUBY_INSTANCE_VARIABLE + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
- PreferenceConverter.setDefault(store, RUBY_GLOBAL, new RGB(255, 0, 0));
- store.setDefault(RUBY_GLOBAL + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
- store.setDefault(RUBY_GLOBAL + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
+ PreferenceConverter.setDefault(store, RUBY_SYMBOL, new RGB(255, 64, 64));
+ store.setDefault(RUBY_SYMBOL + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
+ store.setDefault(RUBY_SYMBOL + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
+ PreferenceConverter.setDefault(store, RUBY_INSTANCE_VARIABLE, new RGB(0, 64, 128));
+ store.setDefault(RUBY_INSTANCE_VARIABLE + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
+ store.setDefault(RUBY_INSTANCE_VARIABLE + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
+ PreferenceConverter.setDefault(store, RUBY_GLOBAL, new RGB(255, 0, 0));
+ store.setDefault(RUBY_GLOBAL + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
+ store.setDefault(RUBY_GLOBAL + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
PreferenceConverter.setDefault(store, RUBY_MULTI_LINE_COMMENT, new RGB(63, 127, 95));
store.setDefault(RUBY_MULTI_LINE_COMMENT + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
store.setDefault(RUBY_MULTI_LINE_COMMENT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
@@ -324,7 +335,7 @@
PreferenceConverter.setDefault(store, TASK_TAG, new RGB(127, 159, 191));
store.setDefault(TASK_TAG + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
store.setDefault(TASK_TAG + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
-
+
//
EditorsUI.useAnnotationsPreferencePage(store);
EditorsUI.useQuickDiffPreferencePage(store);
@@ -338,7 +349,8 @@
*/
public static IWorkbenchPage getActivePage() {
IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) return null;
+ if (window == null)
+ return null;
return getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
@@ -352,17 +364,23 @@
public IResource getSelectedResource() {
IWorkbenchPage page = RubyPlugin.getActivePage();
- if (page == null) { return null; }
+ if (page == null) {
+ return null;
+ }
// first try: a selection in the navigator or ruby resource view
ISelection selection = page.getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
Object obj = structuredSelection.getFirstElement();
- if (obj instanceof IResource) { return (IResource) obj; }
+ if (obj instanceof IResource) {
+ return (IResource) obj;
+ }
}
// second try: an editor is selected
IEditorPart part = page.getActiveEditor();
- if (part == null) { return null; }
+ if (part == null) {
+ return null;
+ }
IEditorInput input = part.getEditorInput();
return (IResource) input.getAdapter(IResource.class);
}
@@ -374,7 +392,9 @@
}
public boolean isRubyFile(IResource resource) {
- if (resource == null || !(resource instanceof IFile)) { return false; }
+ if (resource == null || !(resource instanceof IFile)) {
+ return false;
+ }
return isRubyFile((IFile) resource);
}
@@ -390,7 +410,8 @@
}
public synchronized RubyDocumentProvider getRubyDocumentProvider() {
- if (fDocumentProvider == null) fDocumentProvider = new RubyDocumentProvider();
+ if (fDocumentProvider == null)
+ fDocumentProvider = new RubyDocumentProvider();
return fDocumentProvider;
}
@@ -404,7 +425,8 @@
* @since 3.0
*/
public synchronized RubyFoldingStructureProviderRegistry getFoldingStructureProviderRegistry() {
- if (fFoldingStructureProviderRegistry == null) fFoldingStructureProviderRegistry = new RubyFoldingStructureProviderRegistry();
+ if (fFoldingStructureProviderRegistry == null)
+ fFoldingStructureProviderRegistry = new RubyFoldingStructureProviderRegistry();
return fFoldingStructureProviderRegistry;
}
@@ -431,8 +453,8 @@
*/
public IPreferenceStore getCombinedPreferenceStore() {
if (fCombinedPreferenceStore == null) {
- IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore();
- fCombinedPreferenceStore= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(RubyCore.getPlugin().getPluginPreferences()), generalTextStore });
+ IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
+ fCombinedPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(RubyCore.getPlugin().getPluginPreferences()), generalTextStore });
}
return fCombinedPreferenceStore;
}
@@ -450,7 +472,7 @@
public TemplateStore getTemplateStore() {
return RubyTemplateAccess.getDefault().getTemplateStore();
}
-
+
/**
* Returns the template context type registry for the ruby plugin.
*
@@ -461,49 +483,70 @@
return RubyTemplateAccess.getDefault().getContextTypeRegistry();
}
- public static boolean isDebug() {
- // TODO set to true based on debugging/tracing!
- return false;
- }
+ public static boolean isDebug() {
+ // TODO set to true based on debugging/tracing!
+ return false;
+ }
- /**
- * Creates the Java plugin standard groups in a context menu.
- *
- * @param menu the menu manager to be populated
- */
- public static void createStandardGroups(IMenuManager menu) {
- if (!menu.isEmpty())
- return;
- menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
- menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
- menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
- menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
- menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
- menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
- menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
- menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
- menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
- menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
- menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
- }
+ /**
+ * Creates the Java plugin standard groups in a context menu.
+ *
+ * @param menu
+ * the menu manager to be populated
+ */
+ public static void createStandardGroups(IMenuManager menu) {
+ if (!menu.isEmpty())
+ return;
+ menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
+ menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
+ menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
+ menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
+ menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
+ menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
+ menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
+ menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
+ menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
+ menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
+ menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
+ }
- public static ImageDescriptorRegistry getImageDescriptorRegistry() {
- return getDefault().internalGetImageDescriptorRegistry();
- }
- private synchronized ImageDescriptorRegistry internalGetImageDescriptorRegistry() {
- if (fImageDescriptorRegistry == null)
- fImageDescriptorRegistry= new ImageDescriptorRegistry();
- return fImageDescriptorRegistry;
- }
+ public static ImageDescriptorRegistry getImageDescriptorRegistry() {
+ return getDefault().internalGetImageDescriptorRegistry();
+ }
- public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() {
- // initialized on startup
- return fMembersOrderPreferenceCache;
- }
+ private synchronized ImageDescriptorRegistry internalGetImageDescriptorRegistry() {
+ if (fImageDescriptorRegistry == null)
+ fImageDescriptorRegistry = new ImageDescriptorRegistry();
+ return fImageDescriptorRegistry;
+ }
+ public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() {
+ // initialized on startup
+ return fMembersOrderPreferenceCache;
+ }
+
public synchronized RubyScriptDocumentProvider getExternalDocumentProvider() {
- if (fExternalRubyDocumentProvider == null)
- fExternalRubyDocumentProvider= new RubyScriptDocumentProvider();
- return fExternalRubyDocumentProvider;
+ if (fExternalRubyDocumentProvider == null)
+ fExternalRubyDocumentProvider = new RubyScriptDocumentProvider();
+ return fExternalRubyDocumentProvider;
}
+
+
+ public PropertyResourceBundle getPluginProperties() {
+
+ if (pluginProperties == null) {
+ try {
+
+ pluginProperties = new PropertyResourceBundle(
+
+ FileLocator.openStream(this.getBundle(),
+
+ new Path("plugin.properties"), false));
+
+ } catch (IOException e) {
+ log(e);
+ }
+ }
+ return pluginProperties;
+ }
}
\ No newline at end of file
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-04-03 15:39:54 UTC (rev 2261)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2007-04-03 17:58:15 UTC (rev 2262)
@@ -4,8 +4,6 @@
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
@@ -202,23 +200,23 @@
protected void createActions() {
super.createActions();
- Action action = new ContentAssistAction(RubyUIMessages.getResourceBundle(),
+ Action action = new ContentAssistAction(RubyPlugin.getDefault().getPluginProperties(),
"ContentAssistProposal.", this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction("ContentAssistProposal", action);
- action = new TextOperationAction(RubyUIMessages.getResourceBundle(), "Comment.", this,
+ action = new TextOperationAction(RubyPlugin.getDefault().getPluginProperties(), "CommentAction.", this,
ITextOperationTarget.PREFIX);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.COMMENT);
setAction("Comment", action);
- action = new TextOperationAction(RubyUIMessages.getResourceBundle(), "Uncomment.", this,
+ action = new TextOperationAction(RubyPlugin.getDefault().getPluginProperties(), "UncommentAction.", this,
ITextOperationTarget.STRIP_PREFIX);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.UNCOMMENT);
setAction("Uncomment", action);
- action = new ToggleCommentAction(RubyUIMessages.getResourceBundle(),
- "ToggleComment.", this); //$NON-NLS-1$
+ action = new ToggleCommentAction(RubyPlugin.getDefault().getPluginProperties(),
+ "ToggleCommentAction.", this); //$NON-NLS-1$
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.TOGGLE_COMMENT);
setAction("ToggleComment", action); //$NON-NLS-1$
markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
@@ -229,7 +227,7 @@
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
- action = new FormatAction(RubyUIMessages.getResourceBundle(), "Format.", this);
+ action = new FormatAction(RubyPlugin.getDefault().getPluginProperties(), "FormatAction.", this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.FORMAT);
setAction("Format", action);
@@ -698,7 +696,9 @@
protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
-
+
+ fActionGroups.fillContextMenu(menu) ;
+
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry
.getExtensionPoint("org.rubypeople.rdt.ui.editorPopupExtender");
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java 2007-04-03 15:39:54 UTC (rev 2261)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/RubyActionGroup.java 2007-04-03 17:58:15 UTC (rev 2262)
@@ -1,10 +1,13 @@
package org.rubypeople.rdt.ui.actions;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.ui.actions.ActionGroup;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
public class RubyActionGroup extends ActionGroup {
+ public static final String RUBY_SOURCE_SEPARATOR = "ruby.source.separator";
protected RubyEditor editor;
protected String menuGroupId;
@@ -15,11 +18,22 @@
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
+ IMenuManager rubySourceMenu = getRubySourceMenu(menu);
+ rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("SurroundWithBeginRescue"));
+ rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("ToggleComment"));
+ rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Comment"));
+ rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Uncomment"));
+ rubySourceMenu.insertBefore(RUBY_SOURCE_SEPARATOR, editor.getAction("Format"));
+ }
- menu.add(editor.getAction("ToggleComment"));
- menu.add(editor.getAction("SurroundWithBeginRescue"));
- menu.add(editor.getAction("Comment"));
- menu.add(editor.getAction("Uncomment"));
- menu.add(editor.getAction("Format"));
+ public static IMenuManager getRubySourceMenu(IMenuManager menu) {
+
+ IMenuManager sourceMenu = menu.findMenuUsingPath("ruby.source");
+ if (sourceMenu == null) {
+ sourceMenu = new MenuManager("Source", "ruby.source");
+ sourceMenu.add(new Separator(RUBY_SOURCE_SEPARATOR));
+ menu.insertAfter("group.edit", sourceMenu);
+ }
+ return sourceMenu;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-03 15:39:57
|
Revision: 2261
http://svn.sourceforge.net/rubyeclipse/?rev=2261&view=rev
Author: cawilliams
Date: 2007-04-03 08:39:54 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
start movings towards a slightly higher level API for consuming AST - pull out the common stuff for recognizing method/type/field creation, etc. from RubyScriptStructureBuilder. Then we can base RubyScriptStructureBuilder on top of this, as well as search engine stuff
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/ISourceElementRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceParser.java
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/ISourceElementRequestor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/ISourceElementRequestor.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/ISourceElementRequestor.java 2007-04-03 15:39:54 UTC (rev 2261)
@@ -0,0 +1,57 @@
+package org.rubypeople.rdt.internal.compiler;
+
+import org.rubypeople.rdt.core.compiler.CategorizedProblem;
+
+public interface ISourceElementRequestor {
+
+ public static class TypeInfo {
+ public int declarationStart;
+ public boolean isModule = false;
+ public String name;
+ public int nameSourceStart;
+ public int nameSourceEnd;
+ public String superclass;
+ public String[] modules;
+ public boolean secondary;
+ }
+
+ public static class MethodInfo {
+ public boolean isConstructor = false;
+ public boolean isClassLevel = false;
+ public int visibility;
+ public int declarationStart;
+ public String name;
+ public int nameSourceStart;
+ public int nameSourceEnd;
+ public String[] parameterNames;
+ }
+
+ public static class FieldInfo {
+ public int declarationStart;
+// public String type; TODO Pre populate our guesses at type?
+ public String name;
+ public int nameSourceStart;
+ public int nameSourceEnd;
+ }
+
+ public void enterMethod(MethodInfo method);
+ public void enterConstructor(MethodInfo constructor);
+ public void enterField(FieldInfo field);
+ public void enterType(TypeInfo type);
+ public void enterScript();
+
+ public void exitMethod(int endOffset);
+ public void exitConstructor(int endOffset);
+ public void exitField(int endOffset);
+ public void exitType(int endOffset);
+ public void exitScript(int endOffset);
+
+ public void acceptMethodReference(String name, int argCount, int offset);
+ public void acceptConstructorReference(String name, int argCount, int offset);
+ public void acceptFieldReference(String name, int offset);
+ public void acceptTypeReference(String name, int startOffset, int endOffset);
+ public void acceptImport(String value, int startOffset, int endOffset);
+ public void acceptUnknownReference(String name, int startOffset, int endOffset);
+ public void acceptProblem(CategorizedProblem problem);
+ public void acceptMixin(String string);
+}
Added: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceParser.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceParser.java 2007-04-03 15:39:54 UTC (rev 2261)
@@ -0,0 +1,452 @@
+/*
+ * Author: C.Williams
+ *
+ * Copyright (c) 2004 RubyPeople.
+ *
+ * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. You
+ * can get copy of the GPL along with further information about RubyPeople and
+ * third party software bundled with RDT in the file
+ * org.rubypeople.rdt.core_x.x.x/RDT.license or otherwise at
+ * http://www.rubypeople.org/RDT.license.
+ *
+ * RDT is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * RDT is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * RDT; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+package org.rubypeople.rdt.internal.core;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jruby.ast.AliasNode;
+import org.jruby.ast.ArrayNode;
+import org.jruby.ast.AssignableNode;
+import org.jruby.ast.ClassNode;
+import org.jruby.ast.ClassVarAsgnNode;
+import org.jruby.ast.Colon2Node;
+import org.jruby.ast.ConstDeclNode;
+import org.jruby.ast.ConstNode;
+import org.jruby.ast.DAsgnNode;
+import org.jruby.ast.DStrNode;
+import org.jruby.ast.DefnNode;
+import org.jruby.ast.DefsNode;
+import org.jruby.ast.FCallNode;
+import org.jruby.ast.GlobalAsgnNode;
+import org.jruby.ast.InstAsgnNode;
+import org.jruby.ast.IterNode;
+import org.jruby.ast.LocalAsgnNode;
+import org.jruby.ast.ModuleNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.RootNode;
+import org.jruby.ast.SClassNode;
+import org.jruby.ast.SelfNode;
+import org.jruby.ast.SplatNode;
+import org.jruby.ast.StrNode;
+import org.jruby.ast.VCallNode;
+import org.jruby.evaluator.Instruction;
+import org.jruby.runtime.Visibility;
+import org.rubypeople.rdt.core.IMethod;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor.FieldInfo;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor.MethodInfo;
+import org.rubypeople.rdt.internal.compiler.ISourceElementRequestor.TypeInfo;
+import org.rubypeople.rdt.internal.core.parser.InOrderVisitor;
+import org.rubypeople.rdt.internal.core.util.ASTUtil;
+
+/**
+ * @author Chris
+ *
+ */
+public class SourceParser extends InOrderVisitor {
+
+ private static final String EMPTY_STRING = "";
+ private static final String PROTECTED = "protected";
+ private static final String PRIVATE = "private";
+ private static final String PUBLIC = "public";
+ private static final String INCLUDE = "include";
+ private static final String LOAD = "load";
+ private static final String REQUIRE = "require";
+ private static final String ALIAS = "alias :";
+ private static final String MODULE = "Module";
+ private static final String CONSTRUCTOR_NAME = "initialize";
+ private static final String NAMESPACE_DELIMETER = "::";
+ private static final String OBJECT = "Object";
+ private Visibility currentVisibility = Visibility.PUBLIC;
+ private boolean inSingletonClass;
+ private ISourceElementRequestor requestor;
+
+ /**
+ *
+ * @param requestor The {@link ISourceElementRequestor} that wants to be notified of the source structure
+ */
+ public SourceParser(ISourceElementRequestor requestor) {
+ super();
+ this.requestor = requestor;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jruby.ast.visitor.NodeVisitor#visitClassNode(org.jruby.ast.ClassNode)
+ */
+ public Instruction visitClassNode(ClassNode iVisited) {
+ // This resets the visibility when opening or declaring a class to
+ // public
+ currentVisibility = Visibility.PUBLIC;
+
+ TypeInfo typeInfo = new TypeInfo();
+ typeInfo.name = getFullyQualifiedName(iVisited.getCPath());
+ typeInfo.declarationStart = iVisited.getPosition().getStartOffset();
+ typeInfo.nameSourceStart = iVisited.getCPath().getPosition().getStartOffset();
+ typeInfo.nameSourceEnd = iVisited.getCPath().getPosition().getEndOffset() - 1;
+ if (!typeInfo.name.equals(OBJECT)) {
+ String superClass = getSuperClassName(iVisited.getSuperNode());
+ typeInfo.superclass = superClass;
+ }
+ typeInfo.isModule = false;
+ typeInfo.modules = new String[0]; // FIXME Set up the modules as we go, or proactively dive into AST to grab these?
+ typeInfo.secondary = false; // TODO Set secondary to true if we're enclosed by another type?
+ requestor.enterType(typeInfo);
+
+ Instruction ins = super.visitClassNode(iVisited);
+
+ requestor.exitType(iVisited.getPosition().getEndOffset());
+ return ins;
+ }
+
+ @Override
+ public Instruction visitModuleNode(ModuleNode iVisited) {
+ TypeInfo typeInfo = new TypeInfo();
+ typeInfo.name = getFullyQualifiedName(iVisited.getCPath());
+ typeInfo.declarationStart = iVisited.getPosition().getStartOffset();
+ typeInfo.nameSourceStart = iVisited.getCPath().getPosition().getStartOffset();
+ typeInfo.nameSourceEnd = iVisited.getCPath().getPosition().getEndOffset() - 1;
+ typeInfo.superclass = MODULE; // FIXME Is this really true? Should it be null?
+ typeInfo.isModule = true;
+ typeInfo.modules = new String[0];
+ typeInfo.secondary = false; // TODO Set secondary to true if we're enclosed by another type?
+ requestor.enterType(typeInfo);
+
+ Instruction ins = super.visitModuleNode(iVisited);
+
+ requestor.exitType(iVisited.getPosition().getEndOffset());
+ return ins;
+ }
+
+ @Override
+ public Instruction visitDefnNode(DefnNode iVisited) {
+ Visibility visibility = currentVisibility;
+ MethodInfo methodInfo = new MethodInfo();
+ methodInfo.declarationStart = iVisited.getPosition().getStartOffset();
+ methodInfo.name = iVisited.getName();
+ methodInfo.nameSourceStart = iVisited.getNameNode().getPosition().getStartOffset();
+ methodInfo.nameSourceEnd = iVisited.getNameNode().getPosition().getEndOffset() - 1;
+ if (methodInfo.name.equals(CONSTRUCTOR_NAME)) {
+ visibility = Visibility.PROTECTED;
+ methodInfo.isConstructor = true;
+ } else {
+ methodInfo.isConstructor = false;
+ }
+ methodInfo.isClassLevel = inSingletonClass;
+ methodInfo.visibility = convertVisibility(visibility);
+ methodInfo.parameterNames = ASTUtil.getArgs(iVisited.getArgsNode(), iVisited.getScope());
+
+ if (methodInfo.isConstructor) {
+ requestor.enterConstructor(methodInfo);
+ } else {
+ requestor.enterMethod(methodInfo);
+ }
+
+ Instruction ins = super.visitDefnNode(iVisited); // now traverse it's body
+
+ if (methodInfo.isConstructor) {
+ requestor.exitConstructor(iVisited.getPosition().getEndOffset());
+ } else {
+ requestor.exitMethod(iVisited.getPosition().getEndOffset());
+ }
+ return ins;
+ }
+
+ @Override
+ public Instruction visitDefsNode(DefsNode iVisited) {
+ /*
+ * Get the name of the current static method and add the name of the
+ * class or module to the beginning of it. This aInstructions instance
+ * method naming conflicts. e.g.: class A def self.method; end def
+ * method; end end will give us: A.method method in the Outline View.
+ */
+ String fullName;
+ String receiver = ASTUtil.stringRepresentation(iVisited.getReceiverNode());
+ if (receiver != null && receiver.trim().length() > 0) {
+ fullName = receiver + "." + iVisited.getName();
+ } else {
+ fullName = iVisited.getName();
+ }
+
+ MethodInfo methodInfo = new MethodInfo();
+ methodInfo.declarationStart = iVisited.getPosition().getStartOffset();
+ methodInfo.name = fullName;
+ methodInfo.nameSourceStart = iVisited.getNameNode().getPosition().getStartOffset();
+ methodInfo.nameSourceEnd = iVisited.getNameNode().getPosition().getEndOffset() - 1;
+ methodInfo.isConstructor = false;
+ methodInfo.isClassLevel = true;
+ methodInfo.visibility = convertVisibility(currentVisibility);
+ methodInfo.parameterNames = ASTUtil.getArgs(iVisited.getArgsNode(), iVisited.getScope());
+ requestor.enterMethod(methodInfo);
+
+ Instruction ins = super.visitDefsNode(iVisited); // now traverse it's body
+
+ requestor.exitMethod(iVisited.getPosition().getEndOffset());
+ return ins;
+ }
+
+ /**
+ * @param visibility
+ * @return
+ */
+ private int convertVisibility(Visibility visibility) {
+ // FIXME What about the module function and public-protected
+ // visibilities?
+ if (visibility == Visibility.PUBLIC)
+ return IMethod.PUBLIC;
+ if (visibility == Visibility.PROTECTED)
+ return IMethod.PROTECTED;
+ return IMethod.PRIVATE;
+ }
+
+ @Override
+ public Instruction visitRootNode(RootNode iVisited) {
+ requestor.enterScript();
+ Instruction ins = super.visitRootNode(iVisited);
+ requestor.exitScript(-1); // FIXME Actually grab the correct end offset somehow!
+ return ins;
+ }
+
+ private String getFullyQualifiedName(Node node) {
+ if (node == null)
+ return EMPTY_STRING;
+ if (node instanceof ConstNode) {
+ ConstNode constNode = (ConstNode) node;
+ return constNode.getName();
+ }
+ if (node instanceof Colon2Node) {
+ Colon2Node colonNode = (Colon2Node) node;
+ String prefix = getFullyQualifiedName(colonNode.getLeftNode());
+ if (prefix.length() > 0)
+ prefix = prefix + NAMESPACE_DELIMETER;
+ return prefix + colonNode.getName();
+ }
+ return EMPTY_STRING;
+ }
+
+ /**
+ * Build up the fully qualified name of the super class for a class
+ * declaration
+ *
+ * @param superNode
+ * @return
+ */
+ private String getSuperClassName(Node superNode) {
+ if (superNode == null)
+ return OBJECT;
+ return getFullyQualifiedName(superNode);
+ }
+
+ @Override
+ public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
+ FieldInfo field = createFieldInfo(iVisited);
+ field.name = iVisited.getName();
+ requestor.enterField(field);
+ exitField(iVisited);
+ return super.visitConstDeclNode(iVisited);
+ }
+
+ public Instruction visitClassVarAsgnNode(ClassVarAsgnNode iVisited) {
+ FieldInfo field = createFieldInfo(iVisited);
+ field.name = iVisited.getName();
+ requestor.enterField(field);
+ exitField(iVisited);
+ return super.visitClassVarAsgnNode(iVisited);
+ }
+
+ public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited) {
+ FieldInfo field = createFieldInfo(iVisited);
+ field.name = iVisited.getName();
+ requestor.enterField(field);
+ exitField(iVisited);
+ return super.visitLocalAsgnNode(iVisited);
+ }
+
+ @Override
+ public Instruction visitInstAsgnNode(InstAsgnNode iVisited) {
+ FieldInfo field = createFieldInfo(iVisited);
+ field.name = iVisited.getName();
+ requestor.enterField(field);
+ exitField(iVisited);
+ return super.visitInstAsgnNode(iVisited);
+ }
+
+ @Override
+ public Instruction visitGlobalAsgnNode(GlobalAsgnNode iVisited) {
+ FieldInfo field = createFieldInfo(iVisited);
+ field.name = iVisited.getName();
+ requestor.enterField(field);
+ exitField(iVisited);
+ return super.visitGlobalAsgnNode(iVisited);
+ }
+
+ private void exitField(AssignableNode iVisited) {
+ requestor.exitField(iVisited.getPosition().getEndOffset() - 1);
+ }
+
+ private FieldInfo createFieldInfo(AssignableNode iVisited) {
+ FieldInfo field = new FieldInfo();
+ field.declarationStart = iVisited.getPosition().getStartOffset();
+ field.nameSourceStart = iVisited.getPosition().getStartOffset();
+ String name = ASTUtil.getNameReflectively(iVisited);
+ field.nameSourceEnd = iVisited.getPosition().getStartOffset() + name.length() - 1;
+ return field;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jruby.ast.visitor.NodeVisitor#visitIterNode(org.jruby.ast.IterNode)
+ */
+ public Instruction visitIterNode(IterNode iVisited) {
+// RubyBlock block = new RubyBlock(modelStack.peek()); FIXME Add method to notify of blocks?
+ return super.visitIterNode(iVisited);
+ }
+
+
+ @Override
+ public Instruction visitDAsgnNode(DAsgnNode iVisited) {
+// RubyDynamicVar var = new RubyDynamicVar(modelStack.peek(), iVisited.getName()); FIXME Notify like a normal local var?
+ return super.visitDAsgnNode(iVisited);
+ }
+
+ @Override
+ public Instruction visitSClassNode(SClassNode iVisited) {
+ Node receiver = iVisited.getReceiverNode();
+ if (receiver instanceof SelfNode) {
+ inSingletonClass = true;
+ Instruction ins = super.visitSClassNode(iVisited);
+ inSingletonClass = false;
+ return ins;
+ }
+ return super.visitSClassNode(iVisited);
+ }
+
+ public Instruction visitFCallNode(FCallNode iVisited) {
+ String functionName = iVisited.getName();
+ if (functionName.equals(REQUIRE) || functionName.equals(LOAD)) {
+ addImport(iVisited);
+ } else if (functionName.equals(INCLUDE)) { // Collect included mixins
+ includeModule(iVisited);
+ }
+ return super.visitFCallNode(iVisited);
+ }
+
+ private void addImport(FCallNode iVisited) {
+ ArrayNode node = (ArrayNode) iVisited.getArgsNode();
+ String arg = getString(node);
+ if (arg != null) {
+ requestor.acceptImport(arg, iVisited.getPosition().getStartOffset(), iVisited.getPosition().getEndOffset());
+ }
+ }
+
+ /**
+ * @param node
+ * @return
+ */
+ private String getString(ArrayNode node) {
+ Object tmp = node.childNodes().iterator().next();
+ if (tmp instanceof DStrNode) {
+ DStrNode dstrNode = (DStrNode) tmp;
+ tmp = dstrNode.childNodes().iterator().next();
+ }
+ if (tmp instanceof StrNode) {
+ StrNode strNode = (StrNode) tmp;
+ return strNode.getValue().toString();
+ }
+ return null;
+ }
+
+ private void includeModule(FCallNode iVisited) {
+ List<String> mixins = new LinkedList<String>();
+ Node argsNode = iVisited.getArgsNode();
+ Iterator iter = null;
+ if (argsNode instanceof SplatNode) {
+ SplatNode splat = (SplatNode) argsNode;
+ iter = splat.childNodes().iterator();
+ } else if (argsNode instanceof ArrayNode) {
+ ArrayNode arrayNode = (ArrayNode) iVisited.getArgsNode();
+ iter = arrayNode.childNodes().iterator();
+ }
+ for (; iter.hasNext();) {
+ Node mixinNameNode = (Node) iter.next();
+ if (mixinNameNode instanceof StrNode) {
+ mixins.add(((StrNode) mixinNameNode).getValue().toString());
+ }
+ if (mixinNameNode instanceof DStrNode) {
+ Node next = (Node) ((DStrNode) mixinNameNode).childNodes().iterator().next();
+ if (next instanceof StrNode) {
+ mixins.add(((StrNode) next).getValue().toString());
+ }
+ }
+ if (mixinNameNode instanceof ConstNode) {
+ mixins.add(((ConstNode) mixinNameNode).getName());
+ }
+ }
+ for (String string : mixins) {
+ requestor.acceptMixin(string);
+ }
+ }
+
+ public Instruction visitVCallNode(VCallNode iVisited) {
+ // XXX If the call has arguments, we need to find the method matching the
+ // symbols and mark their visibility differently
+ String functionName = iVisited.getName();
+ if (functionName.equals(PUBLIC)) {
+ currentVisibility = Visibility.PUBLIC;
+ } else if (functionName.equals(PRIVATE)) {
+ currentVisibility = Visibility.PRIVATE;
+ } else if (functionName.equals(PROTECTED)) {
+ currentVisibility = Visibility.PROTECTED;
+ }
+ return super.visitVCallNode(iVisited);
+ }
+
+ public Instruction visitAliasNode(AliasNode iVisited) {
+ String name = iVisited.getNewName();
+ MethodInfo method = new MethodInfo();
+ // TODO Use the visibility for the original method that this is aliasing?
+ Visibility visibility = currentVisibility;
+ if (name.equals(CONSTRUCTOR_NAME)) {
+ visibility = Visibility.PROTECTED;
+ method.isConstructor = true;
+ } else {
+ method.isConstructor = false;
+ }
+ method.declarationStart = iVisited.getPosition().getStartOffset();
+ method.isClassLevel = inSingletonClass;
+ method.name = name;
+ method.visibility = convertVisibility(visibility);
+ method.nameSourceStart = iVisited.getPosition().getStartOffset() + ALIAS.length();
+ method.nameSourceEnd = iVisited.getPosition().getStartOffset() + ALIAS.length() + iVisited.getNewName().length() - 1;
+ method.parameterNames = new String[0]; // TODO Find the existing method and steal it's parameter names
+ requestor.enterMethod(method);
+ requestor.exitMethod(iVisited.getPosition().getEndOffset());
+ return super.visitAliasNode(iVisited);
+ }
+}
\ 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-04-02 14:02:25
|
Revision: 2260
http://svn.sourceforge.net/rubyeclipse/?rev=2260&view=rev
Author: cawilliams
Date: 2007-04-02 07:02:24 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
Property Changed:
----------------
trunk/org.rubypeople.rdt.launching/ruby/
Property changes on: trunk/org.rubypeople.rdt.launching/ruby
___________________________________________________________________
Name: svn:ignore
- 1169734631473
1169734607958
1171920590095
fake
InterpreterOne
InterpreterTwo
vm_id
1173384296213
+ 116*
117*
fake
InterpreterOne
InterpreterTwo
vm_id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-02 14:01:23
|
Revision: 2259
http://svn.sourceforge.net/rubyeclipse/?rev=2259&view=rev
Author: cawilliams
Date: 2007-04-02 07:01:22 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
add test and fix for alias syntax (second symbol wasn't getting colored as a symbol). This highlights a strange JRuby inconsistency, the second symbol's beginning returns the colon character, whereas all other symbols beginnings return Tokens.SYMBEG
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-02 13:40:35 UTC (rev 2258)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-04-02 14:01:22 UTC (rev 2259)
@@ -189,6 +189,7 @@
return doGetToken(IRubyColorConstants.RUBY_KEYWORD);
switch (i) {
case Tokens.tSYMBEG:
+ case 58: // ':' FIXME JRuby returns the number for ':' on second symbol's beginning in alias calls
isInSymbol = true;
return doGetToken(IRubyColorConstants.RUBY_SYMBOL);
case Tokens.tGVAR:
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-02 13:40:35 UTC (rev 2258)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/ruby/TC_RubyTokenScanner.java 2007-04-02 14:01:22 UTC (rev 2259)
@@ -88,9 +88,9 @@
setUpScanner(code);
assertToken(IRubyColorConstants.RUBY_DEFAULT, 0, 4); // 'hash'
assertToken(IRubyColorConstants.RUBY_DEFAULT, 4, 2); // ' ='
- assertToken(IRubyColorConstants.RUBY_DEFAULT, 6, 2); // ' {'
- assertToken(IRubyColorConstants.RUBY_DEFAULT, 8, 4); // whitespace
+ assertToken(IRubyColorConstants.RUBY_DEFAULT, 6, 2); // ' {'
+ assertToken(IRubyColorConstants.RUBY_STRING, 8, 4); // whitespace
assertToken(IRubyColorConstants.RUBY_STRING, 12, 6);
assertToken(IRubyColorConstants.RUBY_STRING, 18, 1);
@@ -157,6 +157,14 @@
assertToken(IRubyColorConstants.RUBY_SYMBOL, 23, 8); // 'RedCloth'
assertToken(IRubyColorConstants.RUBY_DEFAULT, 31, 1); // ')'
}
-
+ public void testAliasWithTwoSymbols() {
+ String code = "alias :tsort_each_child :each_key";
+ setUpScanner(code);
+ assertToken(IRubyColorConstants.RUBY_KEYWORD, 0, 5); // 'alias'
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 5, 2); // ' :'
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 7, 16); // 'tsort_each_child'
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 23, 2); // ' :'
+ assertToken(IRubyColorConstants.RUBY_SYMBOL, 25, 8); // 'each_key'
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-02 13:41:25
|
Revision: 2258
http://svn.sourceforge.net/rubyeclipse/?rev=2258&view=rev
Author: cawilliams
Date: 2007-04-02 06:40:35 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
remove unused messages
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-04-02 13:14:50 UTC (rev 2257)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-04-02 13:40:35 UTC (rev 2258)
@@ -4,10 +4,6 @@
CopyTraceAction_problem=Problem Copying to Clipboard
CopyTraceAction_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
-CopyFailureList_action_label=Copy Failure List
-CopyFailureList_problem=Problem Copying Failure List to Clipboard
-CopyFailureList_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
-
CounterPanel_label_runs=Runs:
CounterPanel_label_errors=Errors:
CounterPanel_label_failures=Failures:
@@ -20,18 +16,9 @@
HierarchyRunView_tab_tooltip=Test Hierarchy
HierarchyRunView_tab_title=Hierarchy
-JUnitPlugin_error_cannotshow=Could not show JUnit Result View
-JUnitPlugin_searching=Searching
-
OpenEditorAction_action_label=&Go to File
-OpenEditorAction_message_cannotopen=Cannot open editor
-OpenTestAction_error_title=Go To Test
-OpenTestAction_error_methodNoFound=Method ''{0}'' not found. Opening the test class.
-
TestRunnerViewPart_jobName=Update JUnit
-TestRunnerViewPart_stopaction_text=Stop JUnit Test
-TestRunnerViewPart_stopaction_tooltip=Stop JUnit Test Run
TestRunnerViewPart_rerunaction_label=Rerun Last Test
TestRunnerViewPart_rerunaction_tooltip=Rerun Last Test
TestRunnerViewPart_error_cannotrerun=Could not rerun test
@@ -39,7 +26,6 @@
TestRunnerViewPart_message_launching=Launching...
TestRunnerViewPart_cannotrerun_title=Rerun Test
TestRunnerViewPart_cannotrerurn_message=To rerun tests they must be launched under the debugger\nand \'Keep Test::Unit running\' must be set in the launch configuration.
-TestRunnerViewPart_message_cannotshow=Could not show JUnit Result View
TestRunnerViewPart_label_failure=Failure Trace
TestRunnerViewPart_message_finish= Finished after {0} seconds
TestRunnerViewPart_message_stopped= Stopped
@@ -47,8 +33,6 @@
TestRunnerViewPart_message_failure= {0}({1}) had a failure
TestRunnerViewPart_message_error= {0}({1}) had an error
TestRunnerViewPart_message_success= {0}({1}) was successful
-TestRunnerViewPart_title= JUnit ({0})
-TestRunnerViewPart_title_no_type=JUnit
TestRunnerViewPart_configName=Rerun {0}
TestRunnerViewPart_layout_menu=Layout
TestRunnerViewPart_toggle_vertical_label=&Vertical View Orientation
@@ -57,10 +41,6 @@
TestRunnerViewPart_terminate_title=Run Last Test
TestRunnerViewPart_terminate_message=Terminate currently running tests?
-JUnitBaseLaunchConfiguration_error_invalidproject=Invalid project specified
-JUnitBaseLaunchConfiguration_error_novmrunner=Internal error: JRE {0} does not specify a VM Runner
-JUnitBaseLaunchConfiguration_error_notests=No tests found
-
JUnitMainTab_tab_label=Test
LaunchTestAction_message_selectConfiguration=Select a Test Configuration
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-02 13:14:52
|
Revision: 2257
http://svn.sourceforge.net/rubyeclipse/?rev=2257&view=rev
Author: cawilliams
Date: 2007-04-02 06:14:50 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
remove unused messages
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-04-01 11:41:14 UTC (rev 2256)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/TestUnitMessages.properties 2007-04-02 13:14:50 UTC (rev 2257)
@@ -23,36 +23,7 @@
JUnitPlugin_error_cannotshow=Could not show JUnit Result View
JUnitPlugin_searching=Searching
-JUnitPreferencePage_description=JUnit settings:
-JUnitPreferencePage_addfilterbutton_label=Add &Filter
-JUnitPreferencePage_addfilterbutton_tooltip=Type the Name of a New Stack Filter
-JUnitPreferencePage_addtypebutton_label=Add &Class...
-JUnitPreferencePage_addtypebutton_tooltip=Choose a Java Type and Add It to Stack Filters
-JUnitPreferencePage_addpackagebutton_label=Add &Packages...
-JUnitPreferencePage_addpackagebutton_tooltip=Choose Package(s) to Add to Stack Filters
-JUnitPreferencePage_removefilterbutton_label=&Remove
-JUnitPreferencePage_removefilterbutton_tooltip=Remove All Selected Stack Filters
-JUnitPreferencePage_enableallbutton_label=&Enable All
-JUnitPreferencePage_enableallbutton_tooltip=Enables All Stack Filters
-JUnitPreferencePage_disableallbutton_label=Disa&ble All
-JUnitPreferencePage_disableallbutton_tooltip=Disables All Stack Filters
-JUnitPreferencePage_filter_label=&Stack trace filter patterns (changes only apply to new test runs):
-JUnitPreferencePage_adddialog_title=Add Stack Filter Pattern
-JUnitPreferencePage_addialog_prompt=Enter Filter Pattern:
-JUnitPreferencePage_showcheck_label=Show the JUnit results &view only when an error or failure occurs
-JUnitPreferencePage_invalidstepfilterreturnescape=Invalid stack filter. Press Enter to continue editing or Escape to cancel.
-JUnitPreferencePage_addtypedialog_title=Add Class to Stack Filters
-JUnitPreferencePage_addtypedialog_message=&Select a class to filter in the failure stack trace.
-JUnitPreferencePage_addtypedialog_error_message=Could not open type selection dialog for stack filters.
-JUnitPreferencePage_addpackagedialog_title=Add Packages to Stack Filters
-JUnitPreferencePage_addpackagedialog_message=&Select a package to filter in the failure stack trace.
-JUnitPreferencePage_addpackagedialog_error_message=Could not open package selection dialog for stack filters.
-
OpenEditorAction_action_label=&Go to File
-OpenEditorAction_error_cannotopen_title=Cannot Open Editor
-OpenEditorAction_error_cannotopen_message=Test class not found in selected project
-OpenEditorAction_error_dialog_title=Error
-OpenEditorAction_error_dialog_message=Cannot open editor
OpenEditorAction_message_cannotopen=Cannot open editor
OpenTestAction_error_title=Go To Test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-01 11:41:16
|
Revision: 2256
http://svn.sourceforge.net/rubyeclipse/?rev=2256&view=rev
Author: mbarchfe
Date: 2007-04-01 04:41:14 -0700 (Sun, 01 Apr 2007)
Log Message:
-----------
applied patch from Martin Krauskopf concerning deletion of breakpoints (track # 9548)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb
Modified: trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb 2007-03-31 18:14:11 UTC (rev 2255)
+++ trunk/org.rubypeople.rdt.launching/ruby/classic-debug.rb 2007-04-01 11:41:14 UTC (rev 2256)
@@ -527,8 +527,6 @@
previous_line = nil
display_expressions(binding)
-
-
case input
when /^\s*tr(?:ace)?(?:\s+(on|off))?(?:\s+(all))?$/
if defined?( $2 )
@@ -560,16 +558,17 @@
pname = pos = pos.intern.id2name
end
# TODO: pname is not used
- break_points.push Breakpoint.new(true, 0, file, pos)
- @printer.printXml("<breakpointAdded no=\"%d\" location=\"%s:%s\"/>", break_points.size, file, pos)
+ 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+(\d+)$/
- pos = $1.to_i
- if pos < 1 || pos > break_points.length
- @printer.printXml("<error>Breakpoint number out of bounds: %d. There are currently %d breakpoints defined.</error>", pos, break_points.length )
+ breakpoint_id = $1.to_i
+ if break_points.delete(breakpoint_id)
+ @printer.printXml("<breakpointDeleted no=\"%d\"/>", breakpoint_id)
else
- break_points.delete_at(pos-1)
- @printer.printXml("<breakpointDeleted no=\"%d\"/>", pos)
+ @printer.printXml("<error>No breakpoint with id: %d. Currently following breakpoints defined: %s</error>",
+ breakpoint_id, breakpoints.keys.join(', '))
end
# when /^\s*wat(?:ch)?\s+(.+)$/
@@ -605,24 +604,6 @@
# stdout.print "\n"
# end
- # when /^\s*del(?:ete)?(?:\s+(\d+))?$/
- # pos = $1
- # unless pos
- # input = readline("Clear all breakpoints? (y/n) ", false)
- # if input == "y"
- # for b in break_points
- # b[0] = false
- # end
- # end
- # else
- # pos = pos.to_i
- # if break_points[pos-1]
- # break_points[pos-1][0] = false
- # else
- # stdout.printf "Breakpoint %d is not defined\n", pos
- # end
- # end
-
# when /^\s*disp(?:lay)?\s+(.+)$/
# exp = $1
# display.push [true, exp]
@@ -724,12 +705,8 @@
@printer.debug("Unknown input : %s", input)
end
-
-
end
-
-
def display_expressions(binding)
n = 1
for d in display
@@ -794,7 +771,7 @@
return false if break_points.empty?
file = File.basename(file)
n = 1
- for b in break_points
+ 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
@@ -897,8 +874,9 @@
trap("INT") { DEBUGGER__.interrupt }
@last_thread = Thread::main
@max_thread = 1
+ @max_breakpoint_id = 0
@thread_list = {Thread::main => 1}
- @break_points = []
+ @break_points = {} # id => Breakpoint
@display = []
@waiting = []
@stdout = STDOUT
@@ -1079,7 +1057,11 @@
return context(th)
end
end
+
+ def next_breakpoint_id
+ @max_breakpoint_id += 1
end
+ end
@@socket = nil
@@printer = nil
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-03-31 18:14:13
|
Revision: 2255
http://svn.sourceforge.net/rubyeclipse/?rev=2255&view=rev
Author: mbarchfe
Date: 2007-03-31 11:14:11 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
FIX Exception with negative indentation (too many ends)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-03-31 18:13:15 UTC (rev 2254)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml 2007-03-31 18:14:11 UTC (rev 2255)
@@ -611,5 +611,29 @@
</part>
</test>
+
+<test ID="NegativeIndentation">
+
+<part>
+<assertionMessage>Invalid ruby with too many end</assertionMessage>
+<unformatted>
+class
+ def m
+ end
+ end
+ end
+</unformatted>
+<formatted>
+class
+ def m
+ end
+end
+end
+</formatted>
+</part>
+
+</test>
+
+
</tests>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-03-31 18:13:16
|
Revision: 2254
http://svn.sourceforge.net/rubyeclipse/?rev=2254&view=rev
Author: mbarchfe
Date: 2007-03-31 11:13:15 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
FIX Exception with negative indentation (too many ends)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java 2007-03-31 18:01:52 UTC (rev 2253)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java 2007-03-31 18:13:15 UTC (rev 2254)
@@ -79,6 +79,9 @@
* @return the indent string
*/
public static String createIndentString(int indentationUnits, Map options) {
+ if (indentationUnits < 0) {
+ return "" ;
+ }
if (options == null || indentationUnits < 0) {
throw new IllegalArgumentException();
}
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java 2007-03-31 18:01:52 UTC (rev 2253)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/TC_CodeFormatter.java 2007-03-31 18:13:15 UTC (rev 2254)
@@ -126,6 +126,10 @@
public void testLiteralsStartingWithPercentSign() {
this.doTest("LiteralsStartingWithPercentSign");
+ }
+
+ public void testNegativeIndentation() {
+ this.doTest("NegativeIndentation");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-03-31 18:01:53
|
Revision: 2253
http://svn.sourceforge.net/rubyeclipse/?rev=2253&view=rev
Author: mbarchfe
Date: 2007-03-31 11:01:52 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
switched to rdebug-ide; pull thread state
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby-debug-base-0.9.gem
trunk/org.rubypeople.rdt.launching/ruby-debug-ide-0.1.0.gem
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby-debug-0.8.gem
Deleted: trunk/org.rubypeople.rdt.launching/ruby-debug-0.8.gem
===================================================================
(Binary files differ)
Added: trunk/org.rubypeople.rdt.launching/ruby-debug-base-0.9.gem
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.launching/ruby-debug-base-0.9.gem
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.launching/ruby-debug-ide-0.1.0.gem
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.launching/ruby-debug-ide-0.1.0.gem
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-03-31 18:01:16 UTC (rev 2252)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-03-31 18:01:52 UTC (rev 2253)
@@ -42,31 +42,25 @@
protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
List<String> arguments = new ArrayList<String>();
- arguments.add("--server");
- arguments.add("-w"); // wait for client to connect on command port
- arguments.add("-n"); // do not halt when client connects
arguments.add("--port");
arguments.add(Integer.toString(debugTarget.getPort()));
- arguments.add("--cport");
- arguments.add(Integer.toString(debugTarget.getPort() + 1));
if (isDebuggerVerbose()) {
arguments.add("-d");
}
- arguments.add("-f");
- arguments.add("xml");
return arguments;
}
protected RubyDebuggerProxy getDebugProxy(RubyDebugTarget debugTarget) {
- return new RubyDebuggerProxy(debugTarget, RDebugVMDebugger.getDirectoryOfRubyDebuggerFile(), true);
+ return new RubyDebuggerProxy(debugTarget, true);
}
public static String findRDebugExecutable(File vmInstallLocation) {
// see StandardVMRunner.constructProgramString
- String cmd = "rdebug" ;
- String path = vmInstallLocation + File.separator + "bin" + File.separator + "rdebug.cmd" ;
+ String cmd = "rdebug-ide" ;
+ String cmdWin = "rdebug-ide.cmd";
+ String path = vmInstallLocation + File.separator + "bin" + File.separator + cmdWin;
if (new File(path).exists()) {
- cmd = "rdebug.cmd" ;
+ cmd = cmdWin ;
}
return cmd ;
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-03-31 18:01:16 UTC (rev 2252)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-03-31 18:01:52 UTC (rev 2253)
@@ -118,7 +118,9 @@
}
IProcess process = newProcess(launch, p, renderProcessLabel(cmdLine), getDefaultProcessMap());
- process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine));
+ String commandLine = renderCommandLine(cmdLine);
+ LaunchingPlugin.debug("Starting: " + commandLine) ;
+ process.setAttribute(IProcess.ATTR_CMDLINE, commandLine);
subMonitor.worked(1);
subMonitor.subTask(LaunchingMessages.StandardVMDebugger_Establishing_debug_connection____5);
@@ -140,7 +142,7 @@
}
protected RubyDebuggerProxy getDebugProxy(RubyDebugTarget debugTarget) {
- return new RubyDebuggerProxy(debugTarget, getDirectoryOfRubyDebuggerFile(), false);
+ return new RubyDebuggerProxy(debugTarget, false /* isRubyDebug*/);
}
protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-03-31 18:01:17
|
Revision: 2252
http://svn.sourceforge.net/rubyeclipse/?rev=2252&view=rev
Author: mbarchfe
Date: 2007-03-31 11:01:16 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
switched to rdebug-ide; pull thread state
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby/rdebugExtension.rb
Deleted: trunk/org.rubypeople.rdt.launching/ruby/rdebugExtension.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/rdebugExtension.rb 2007-03-31 18:00:53 UTC (rev 2251)
+++ trunk/org.rubypeople.rdt.launching/ruby/rdebugExtension.rb 2007-03-31 18:01:16 UTC (rev 2252)
@@ -1,57 +0,0 @@
-module Debugger
- class XmlPrinter
-
- def print_inspect(eval_result)
- print_element("variables") do
- print_variable("eval_result", eval_result, 'locale')
- end
- end
-
- def print_load_result(file, exception=nil)
- if exception then
- print("<loadResult file=\"%s\" exceptionType=\"%s\" exceptionMessage=\"%s\"/>", file, exception.class, CGI.escapeHTML(exception.to_s))
- else
- print("<loadResult file=\"%s\" status=\"OK\"/>", file)
- end
- end
-
- end
-
- class InspectCommand < Command
- # reference inspection results in order to save them from the GC
- @@references = []
- def self.reference_result(result)
- @@references << result
- end
- def self.clear_references
- @@references = []
- end
-
- def regexp
- /^\s*v(?:ar)?\s+inspect\s+/
- end
- #
- def execute
- obj = debug_eval(@match.post_match)
- InspectCommand.reference_result(obj)
- @printer.print_inspect(obj)
- end
- end
-
- class LoadCommand < Command
- def regexp
- /^\s*load\s+/
- end
-
- def execute
- fileName = @match.post_match
- @printer.print_debug("loading file: %s", fileName)
- begin
- load fileName
- @printer.print_load_result(fileName)
- rescue Exception => error
- @printer.print_load_result(fileName, error)
- end
- end
- end
-end
\ 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: <mba...@us...> - 2007-03-31 18:00:56
|
Revision: 2251
http://svn.sourceforge.net/rubyeclipse/?rev=2251&view=rev
Author: mbarchfe
Date: 2007-03-31 11:00:53 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
switched to rdebug-ide; pull thread state
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractDebuggerConnection.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/ClassicDebuggerConnection.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/RubyDebugConnection.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_Single.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestRubyDebugDebugger.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestVMDebugger.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TC_RubyDebugTarget.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/RubyDebuggerProxy.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -13,6 +13,7 @@
import org.rubypeople.rdt.internal.debug.core.commands.GenericCommand;
import org.rubypeople.rdt.internal.debug.core.commands.RubyDebugConnection;
import org.rubypeople.rdt.internal.debug.core.model.IRubyDebugTarget;
+import org.rubypeople.rdt.internal.debug.core.model.RubyDebugTarget;
import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
import org.rubypeople.rdt.internal.debug.core.model.RubyStackFrame;
import org.rubypeople.rdt.internal.debug.core.model.RubyThread;
@@ -33,12 +34,15 @@
private IRubyDebugTarget debugTarget;
private RubyLoop rubyLoop;
private ICommandFactory commandFactory;
+ private Thread threadUpdater;
+ private Thread errorReader;
+ private boolean isLoopFinished ;
- public RubyDebuggerProxy(IRubyDebugTarget debugTarget, String rubyFileDirectory, boolean isRubyDebug) {
+ public RubyDebuggerProxy(IRubyDebugTarget debugTarget, boolean isRubyDebug) {
this.debugTarget = debugTarget;
debugTarget.setRubyDebuggerProxy(this);
commandFactory = isRubyDebug ? new RubyDebugCommandFactory() : new ClassicDebuggerCommandFactory();
- debuggerConnection = isRubyDebug ? new RubyDebugConnection(rubyFileDirectory, debugTarget.getPort()) : new ClassicDebuggerConnection(debugTarget.getPort());
+ debuggerConnection = isRubyDebug ? new RubyDebugConnection(debugTarget.getPort()) : new ClassicDebuggerConnection(debugTarget.getPort());
}
public boolean checkConnection() {
@@ -46,7 +50,7 @@
}
public void start() throws RubyProcessingException, IOException {
-
+ isLoopFinished = false ;
debuggerConnection.connect();
this.setBreakPoints();
this.startRubyLoop();
@@ -132,15 +136,48 @@
Runnable runnable = new Runnable() {
public void run() {
try {
- while (true) {
+ RdtDebugCorePlugin.debug("Command Connection error handler started.") ;
+ while (debuggerConnection.getCommandReadStrategy().isConnected()) {
+ // The read strategy resumes read() after the connection to the debugger
+ // has been dropped
new ErrorReader(debuggerConnection.getCommandReadStrategy()).read();
}
} catch (Exception e) {
RdtDebugCorePlugin.log(e);
+ } finally {
+ RdtDebugCorePlugin.debug("Command Connection error handler finished.") ;
}
};
};
- new Thread(runnable).start();
+ errorReader = new Thread(runnable, "Error Reader");
+ errorReader.start();
+ // TODO: Check if it would not be better if the ruby part created the threadinfos
+ // only after a change to the thread status has occurred
+ Runnable threadListener = new Runnable() {
+ public void run() {
+ try {
+ RdtDebugCorePlugin.debug("Thread updater started.") ;
+ Thread.sleep(2000) ;
+ GenericCommand cmd = null ;
+ while (cmd == null || (cmd != null && cmd.getReadStrategy().isConnected())) {
+ if (!getDebugTarget().isSuspended()) {
+ String command = commandFactory.createReadThreads() ;
+ cmd = new GenericCommand(command, true /* isControl */) ;
+ cmd.execute(debuggerConnection);
+ ThreadInfo[] threadInfos = new ThreadInfoReader(cmd.getReadStrategy()).readThreads() ;
+ ((RubyDebugTarget)getDebugTarget()).updateThreads(threadInfos) ;
+ }
+ Thread.sleep(2000) ;
+ }
+ } catch (Exception e) {
+ RdtDebugCorePlugin.log(e);
+ } finally {
+ RdtDebugCorePlugin.debug("Thread updater finished.") ;
+ }
+ };
+ };
+ threadUpdater = new Thread(threadListener, "Ruby Thread Updater");
+ threadUpdater.start();
}
public void resume(RubyThread thread) {
@@ -247,7 +284,8 @@
public ThreadInfo[] readThreads() {
try {
- this.println(commandFactory.createReadThreads());
+ String command = commandFactory.createReadThreads() ;
+ new GenericCommand(command, true /* isControl */).execute(debuggerConnection);
return new ThreadInfoReader(getMultiReaderStrategy()).readThreads();
} catch (Exception e) {
RdtDebugCorePlugin.log(e);
@@ -284,8 +322,6 @@
try {
System.setProperty(DEBUGGER_ACTIVE_KEY, "true");
- // TODO Update threads?
- //getDebugTarget().updateThreads();
RdtDebugCorePlugin.debug("Waiting for breakpoints.");
while (true) {
final SuspensionPoint hit = new SuspensionReader(getMultiReaderStrategy()).readSuspension();
@@ -319,4 +355,5 @@
}
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractDebuggerConnection.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractDebuggerConnection.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractDebuggerConnection.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -36,7 +36,8 @@
*/
public abstract SuspensionReader start() throws DebuggerNotFoundException, IOException;
-
+ public abstract boolean isStarted() ;
+
/*
* always call via Command.execute
*/
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/ClassicDebuggerConnection.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/ClassicDebuggerConnection.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/ClassicDebuggerConnection.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -7,6 +7,8 @@
public class ClassicDebuggerConnection extends AbstractDebuggerConnection {
+ private boolean isStarted;
+
public ClassicDebuggerConnection(int port) {
super(port);
}
@@ -20,7 +22,13 @@
public SuspensionReader start() throws DebuggerNotFoundException, IOException {
StepCommand stepCommand = new StepCommand("cont");
stepCommand.execute(this) ;
+ isStarted = true ;
return stepCommand.getSuspensionReader() ;
}
+ @Override
+ public boolean isStarted() {
+ return isStarted;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/RubyDebugConnection.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/RubyDebugConnection.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/RubyDebugConnection.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -1,110 +1,45 @@
package org.rubypeople.rdt.internal.debug.core.commands;
-import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.Socket;
import org.rubypeople.rdt.internal.debug.core.DebuggerNotFoundException;
-import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
-import org.rubypeople.rdt.internal.debug.core.model.RubyProcessingException;
import org.rubypeople.rdt.internal.debug.core.parsing.AbstractReadStrategy;
-import org.rubypeople.rdt.internal.debug.core.parsing.MultiReaderStrategy;
import org.rubypeople.rdt.internal.debug.core.parsing.SuspensionReader;
-import org.xmlpull.v1.XmlPullParser;
public class RubyDebugConnection extends AbstractDebuggerConnection {
- private Socket controlSocket ;
- private MultiReaderStrategy controlReadStrategy;
- private PrintWriter controlWriter;
- private String rdebugExtensionPath ;
- public RubyDebugConnection(String rdebugExtensionPath, int port) {
+ private boolean isStarted;
+
+ public RubyDebugConnection(int port) {
super(port);
- this.rdebugExtensionPath = rdebugExtensionPath + File.separatorChar + "rdebugExtension.rb";
}
@Override
- public void connect() throws DebuggerNotFoundException, IOException{
- createControlConnection() ;
-
- String expression = "eval require '" + rdebugExtensionPath + "'";
- EvalCommand command = new EvalCommand(expression, true) ;
- command.execute(this) ;
- String evalResult = null;
- try {
- evalResult = command.getEvalReader().readEvalResult();
- } catch (RubyProcessingException e) {
- RdtDebugCorePlugin.log(e) ;
- }
- if (evalResult == null || !evalResult.equals("true")) {
- // TODO: go on ?
- throw new DebuggerNotFoundException("Could not add extension to ruby debug") ;
- }
- // set trace: show stack trace if evaluation fails
- new GenericCommand("set trace", true).execute(this) ;
+ public void connect() throws DebuggerNotFoundException, IOException {
+ createCommandConnection();
}
@Override
public SuspensionReader start() throws DebuggerNotFoundException, IOException {
- createCommandConnection() ;
- return new SuspensionReader(getCommandReadStrategy()) ;
+ AbstractReadStrategy strategy = sendControlCommand(new GenericCommand("start", true));
+ isStarted = true ;
+ return new SuspensionReader(strategy);
}
-
- @Override
- public AbstractReadStrategy sendCommand(AbstractCommand command) throws DebuggerNotFoundException, IOException {
- AbstractReadStrategy result = null ;
- if (command.isControl()) {
- result =sendControlCommand(command) ;
- } else {
- result = super.sendCommand(command);
- }
- return result ;
- }
-
+
private AbstractReadStrategy sendControlCommand(AbstractCommand command) throws IOException {
- if (!isControlPortConnected()) {
- throw new IllegalStateException(command + " could not be executed since control socket is not opened.") ;
- }
- RdtDebugCorePlugin.debug("Sending control command: " + command.getCommand()) ;
- getControlWriter().println(command.getCommand()) ;
- return getControlReadStrategy() ;
+ return sendCommand(command);
}
-
- private PrintWriter getControlWriter() throws IOException {
- if (controlWriter == null) {
- controlWriter = new PrintWriter(getControlSocket().getOutputStream(), true);
- }
- return controlWriter;
- }
-
- protected boolean isControlPortConnected() {
- return controlReadStrategy != null;
- }
-
- protected void createControlConnection() throws DebuggerNotFoundException, IOException {
- Socket socket = getControlSocket() ;
- XmlPullParser xpp = createXpp(socket) ;
- controlReadStrategy = new MultiReaderStrategy(xpp) ;
- }
-
- private Socket getControlSocket() throws IOException {
- if (controlSocket == null) {
- controlSocket = acquireSocket(getCommandPort() + 1) ;
- }
- return controlSocket ;
- }
- public MultiReaderStrategy getControlReadStrategy() {
- return controlReadStrategy;
- }
-
@Override
public void exit() throws IOException {
super.exit();
- GenericCommand command = new GenericCommand("exit", true) ;
- command.execute(this) ;
- controlSocket.close() ;
+ GenericCommand command = new GenericCommand("exit", true);
+ command.execute(this);
}
+ @Override
+ public boolean isStarted() {
+ return isStarted;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -4,7 +4,13 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import org.eclipse.core.internal.runtime.FindSupport;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
@@ -40,19 +46,21 @@
public RubyDebugTarget(ILaunch launch) {
this(launch, null);
}
-
+
public RubyDebugTarget(ILaunch launch, IProcess process) {
this(launch, process, DEFAULT_PORT);
}
-
+
public RubyDebugTarget(ILaunch launch, IProcess process, int port) {
this.launch = launch;
this.port = port;
this.process = process;
- this.threads = new RubyThread[0] ;
- this.isTerminated = false ;
- IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
- manager.addBreakpointListener(this);
+ this.threads = new RubyThread[0];
+ this.isTerminated = false;
+ if (DebugPlugin.getDefault() != null) { // null only expected in Unit test
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ manager.addBreakpointListener(this);
+ }
addDebugParameter("$RemoteDebugPort=" + port);
}
@@ -61,29 +69,62 @@
}
public void updateThreads() {
- // preconditions:
- // 1) both threadInfos and updatedThreads are sorted by their id attribute
- // 2) once a thread has died its id is never reused for new threads again. Instead each new
- // thread gets an id which is the currently highest id + 1.
-
RdtDebugCorePlugin.debug("udpating threads");
ThreadInfo[] threadInfos = this.getRubyDebuggerProxy().readThreads();
- RubyThread[] updatedThreads = new RubyThread[threadInfos.length];
+ updateThreads(threadInfos);
+ }
+
+ public synchronized void updateThreads(ThreadInfo[] threadInfos) {
+ if (isSuspended()) {
+ return ;
+ }
+ DebugEvent[] events = updateThreadsInternal(threadInfos) ;
+ DebugPlugin.getDefault().fireDebugEventSet(events);
+ }
+
+ // only public for testing
+ public DebugEvent[] updateThreadsInternal(ThreadInfo[] threadInfos) {
+
+ // preconditions:
+ // 1) once a thread has died its id is never reused for new threads
+ // again. Instead each new
+ // thread gets an id which is the currently highest id + 1.
+ List<DebugEvent> events = new ArrayList<DebugEvent>() ;
+ RubyThread[] newThreads = new RubyThread[threadInfos.length] ;
+ Set<Integer> newIds = new TreeSet<Integer>() ;
+ boolean changed = false ;
int threadIndex = 0;
for (int i = 0; i < threadInfos.length; i++) {
- while (threadIndex < threads.length && threadInfos[i].getId() != threads[threadIndex].getId()) {
- // step over dead threads, which do not occur in threadInfos anymore
- threadIndex += 1;
- }
- if (threadIndex == threads.length) {
- updatedThreads[i] = new RubyThread(this, threadInfos[i].getId());
- DebugEvent ev = new DebugEvent(updatedThreads[i], DebugEvent.CREATE);
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
+ ThreadInfo currentThreadInfo = threadInfos[i] ;
+ RubyThread existingThread = getThreadById(currentThreadInfo.getId()) ;
+
+ if (existingThread == null) {
+ newThreads[i] = new RubyThread(this, currentThreadInfo.getId(), currentThreadInfo.getStatus());
+ DebugEvent ev = new DebugEvent(newThreads[i], DebugEvent.CREATE);
+ events.add(ev) ;
} else {
- updatedThreads[i] = threads[threadIndex];
+ newThreads[i] =existingThread;
+ if (!existingThread.getStatus().equals(currentThreadInfo.getStatus())) {
+ existingThread.setStatus(currentThreadInfo.getStatus());
+ existingThread.updateName();
+ DebugEvent ev = new DebugEvent(newThreads[i], DebugEvent.CHANGE);
+ events.add(ev) ;
+ }
}
+ newIds.add(newThreads[i].getId()) ;
}
- threads = updatedThreads;
+ for (int i = 0; i < threads.length ; i++) {
+ if (!newIds.contains(threads[i].getId())) {
+ DebugEvent ev = new DebugEvent(threads[i], DebugEvent.TERMINATE);
+ events.add(ev) ;
+ }
+ }
+ threads = newThreads;
+ if (changed) {
+ DebugEvent ev1 = new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT);
+ events.add(ev1) ;
+ }
+ return events.toArray(new DebugEvent[] {}) ;
}
protected RubyThread getThreadById(int id) {
@@ -141,27 +182,27 @@
return isTerminated;
}
- public void terminate() {
+ public synchronized void terminate() {
if (isTerminated) {
- return ;
+ return;
}
try {
- this.getProcess().terminate() ;
- this.threads = new RubyThread[0] ;
+ this.getProcess().terminate();
+ this.threads = new RubyThread[0];
isTerminated = true;
- rubyDebuggerProxy.stop() ;
+ rubyDebuggerProxy.stop();
} catch (DebugException e) {
- RdtDebugCorePlugin.debug("Exception while terminating process.", e) ;
+ RdtDebugCorePlugin.debug("Exception while terminating process.", e);
}
-
+
// launch is one of the listeners
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(this, DebugEvent.TERMINATE)});
-
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { new DebugEvent(this, DebugEvent.TERMINATE) });
+
// delete the debugParameteFile if it could be created
if (debugParameterFile.exists()) {
- boolean deleted = debugParameterFile.delete() ;
+ boolean deleted = debugParameterFile.delete();
if (!deleted) {
- RdtDebugCorePlugin.debug("Could not delete debugParameteFile:" + debugParameterFile.toURI()) ;
+ RdtDebugCorePlugin.debug("Could not delete debugParameteFile:" + debugParameterFile.toURI());
}
}
}
@@ -175,46 +216,51 @@
}
public boolean isSuspended() {
- return false;
+ boolean isSuspended = false ;
+ for (int i = 0; i < getThreads().length; i++) {
+ if (getThreads()[i].isSuspended()) {
+ isSuspended = true ;
+ break ;
+ }
+ }
+ return isSuspended;
}
- public void resume() throws DebugException {
- }
+ public void resume() throws DebugException {}
- public void suspend() throws DebugException {
- }
+ public void suspend() throws DebugException {}
public void breakpointAdded(IBreakpoint breakpoint) {
if (isTerminated) {
- return ;
+ return;
}
- this.getRubyDebuggerProxy().addBreakpoint(breakpoint) ;
+ this.getRubyDebuggerProxy().addBreakpoint(breakpoint);
}
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta arg1) {
if (isTerminated) {
- return ;
- }
- this.getRubyDebuggerProxy().removeBreakpoint(breakpoint) ;
+ return;
+ }
+ this.getRubyDebuggerProxy().removeBreakpoint(breakpoint);
}
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta arg1) {
// is called e.g. after a line has been inserted before a breakpoint
// or the enablement status has changed
- // in the first case it is essential that the debugger has reloaded the file
+ // in the first case it is essential that the debugger has reloaded the
+ // file
// so that the breakpoint moving is in synch with the new file
if (isTerminated) {
- return ;
- }
- this.getRubyDebuggerProxy().updateBreakpoint(breakpoint, arg1) ;
+ return;
+ }
+ this.getRubyDebuggerProxy().updateBreakpoint(breakpoint, arg1);
}
public boolean canDisconnect() {
return false;
}
- public void disconnect() throws DebugException {
- }
+ public void disconnect() throws DebugException {}
public boolean isDisconnected() {
return false;
@@ -243,18 +289,18 @@
public void setRubyDebuggerProxy(RubyDebuggerProxy rubyDebuggerProxy) {
this.rubyDebuggerProxy = rubyDebuggerProxy;
}
-
+
public File getDebugParameterFile() {
if (debugParameterFile == null) {
try {
- debugParameterFile = File.createTempFile("classic-debug",".rb") ;
+ debugParameterFile = File.createTempFile("classic-debug", ".rb");
} catch (IOException e) {
- RdtDebugCorePlugin.log("Could not create debugParameterFile", e) ;
+ RdtDebugCorePlugin.log("Could not create debugParameterFile", e);
}
}
return debugParameterFile;
}
-
+
private boolean addDebugParameter(String line) {
PrintWriter writer = null;
try {
@@ -269,12 +315,12 @@
writer.close();
}
}
-
+
public int getPort() {
return port;
}
-
+
public boolean isUsingDefaultPort() {
- return getPort() == DEFAULT_PORT ;
+ return getPort() == DEFAULT_PORT;
}
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -21,11 +21,13 @@
private boolean isTerminated = false;
private boolean isStepping = false;
private String name;
+ private String status;
private int id;
- public RubyThread(IDebugTarget target, int id) {
+ public RubyThread(IDebugTarget target, int id, String status) {
this.target = target;
this.setId(id);
+ this.status = status ;
this.updateName();
}
@@ -99,7 +101,9 @@
}
public boolean canSuspend() {
- return !isSuspended;
+ // TODO: manually suspending a thread is not yet possible with ruby-debug
+ //return !isSuspended;
+ return false ;
}
public boolean isSuspended() {
@@ -229,6 +233,8 @@
this.name = "Ruby Thread - " + this.getId();
if (suspensionPoint != null) {
this.name += " (" + suspensionPoint + ")";
+ } else {
+ this.name += " (" + status + ")";
}
}
@@ -248,4 +254,12 @@
}
return super.getAdapter(adapterType);
}
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/AbstractReadStrategy.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -15,5 +15,7 @@
public abstract void readElement(XmlStreamReader streamReader) throws XmlPullParserException, IOException, XmlStreamReaderException ;
public abstract void readElement(XmlStreamReader streamReader, long maxWaitTime) throws XmlPullParserException, IOException, XmlStreamReaderException ;
+
+ public abstract boolean isConnected() ;
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/MultiReaderStrategy.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -14,9 +14,12 @@
private Map<XmlStreamReader, Thread> threads;
private XmlStreamReader currentReader;
+ private boolean isConnected ;
+
public MultiReaderStrategy(XmlPullParser xpp) {
super(xpp);
+ isConnected = true ;
threads = new HashMap<XmlStreamReader, Thread>();
new Thread("xml reader") {
@@ -35,6 +38,7 @@
Thread.sleep(1000) ; // Avoid Commodfication Exceptions
} catch (InterruptedException e) {
}
+ isConnected = false;
releaseAllReaders();
}
@@ -93,6 +97,7 @@
}
private synchronized void findReaderForTag() throws XmlStreamReaderException {
+ System.out.println("There are no threads:" + threads.size()) ;
for (XmlStreamReader streamReader : threads.keySet()) {
if (streamReader.processStartElement(xpp)) {
currentReader = streamReader;
@@ -118,11 +123,14 @@
threads.put(streamReader, Thread.currentThread());
}
- public void readElement(XmlStreamReader streamReader) {
+ public void readElement(XmlStreamReader streamReader) throws IOException {
readElement(streamReader, Long.MAX_VALUE) ;
}
- public void readElement(XmlStreamReader streamReader, long maxWaitTime) {
+ public void readElement(XmlStreamReader streamReader, long maxWaitTime) throws IOException {
+ if (!isConnected) {
+ throw new IOException("Read loop has finished") ;
+ }
this.addReader(streamReader);
try {
RdtDebugCorePlugin.debug("Thread is waiting for input: " + Thread.currentThread());
@@ -133,4 +141,8 @@
}
}
+ public boolean isConnected() {
+ return isConnected;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/parsing/SingleReaderStrategy.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -40,4 +40,9 @@
readElement(streamReader) ;
}
+ @Override
+ public boolean isConnected() {
+ return true;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_AbstractDebuggerCommunicationTest.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -294,7 +294,7 @@
private void runTo(String filename, int lineNumber) throws Exception {
setBreakpoint(filename, lineNumber) ;
SuspensionReader reader;
- if (!debuggerConnection.isCommandPortConnected()) {
+ if (!debuggerConnection.isStarted()) {
reader = debuggerConnection.start();
} else {
StepCommand stepCommand = new StepCommand("cont");
@@ -979,7 +979,7 @@
sendRuby("b test.rb:4");
getBreakpointAddedReader().readBreakpointNo();
sendRuby("w");
- RubyThread thread = new RubyThread(null, 0);
+ RubyThread thread = new RubyThread(null, 0, "run");
getFramesReader().readFrames(thread);
assertEquals(2, thread.getStackFrames().length);
RubyStackFrame frame1 = (RubyStackFrame) thread.getStackFrames()[0];
@@ -1001,7 +1001,7 @@
public void testFramesWhenThreadSpawned() throws Exception {
createSocket(new String[] { "def startThread", "Thread.new() { a = 5 }", "end", "def calc", "5 + 5", "end", "startThread()", "calc()" });
runTo("test.rb", 5);
- RubyThread thread = new RubyThread(null, 0);
+ RubyThread thread = new RubyThread(null, 0, "run");
sendRuby("w");
getFramesReader().readFrames(thread);
assertEquals(2, thread.getStackFramesSize());
@@ -1023,7 +1023,7 @@
assertEquals(2, threads.length);
sendRuby("th " + threads[0].getId() + " ; w ");
- RubyStackFrame[] stackFrames = getFramesReader().readFrames(new RubyThread(null, 1));
+ RubyStackFrame[] stackFrames = getFramesReader().readFrames(new RubyThread(null, 1, "run"));
assertEquals(1, stackFrames.length);
assertEquals(7, stackFrames[0].getLineNumber());
sendRuby("th " + threads[0].getId() + " ; v l");
@@ -1031,7 +1031,7 @@
assertEquals(1, variables.length);
assertEquals("b", variables[0].getName());
sendRuby("th " + threads[1].getId() + " ; w");
- stackFrames = getFramesReader().readFrames(new RubyThread(null, 1));
+ stackFrames = getFramesReader().readFrames(new RubyThread(null, 1, "run"));
assertEquals(1, stackFrames.length);
assertEquals(3, stackFrames[0].getLineNumber());
sendRuby("th " + threads[1].getId() + " ; v l");
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -51,9 +51,7 @@
public void setUp() throws Exception {
target = new TestRubyDebugTarget() ;
- //TODO: get proper directory
- String rubyFileDirectory ="launching/ruby " ;
- proxy = new RubyDebuggerProxy(target, rubyFileDirectory, false /*useRubyDebug*/) ;
+ proxy = new RubyDebuggerProxy(target, false /*useRubyDebug*/) ;
PipedInputStream pipedInputStream = new PipedInputStream() ;
PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream) ;
@@ -85,9 +83,7 @@
}
}.start() ;
- // blocks until threads are read
- ThreadInfo[] threadInfos = getProxy().readThreads() ;
- assertEquals(1, threadInfos.length) ;
+
Thread.sleep(1000) ;
assertEquals(55, getTarget().getLastSuspensionPoint().getLine()) ;
}
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -67,7 +67,7 @@
@Override
public void startRubyProcess() throws Exception {
// TODO Auto-generated method stub
- String cmd = "rdebug -s -w -n -p 1098 --cport 1099 -d -f xml -I " + getTmpDir().replace('\\', '/') + " " + getRubyTestFilename();
+ String cmd = "rdebug-ide -p 1098 -d -I " + getTmpDir().replace('\\', '/') + " " + getRubyTestFilename();
// "FTC_DebuggerCommunicationTest.RUBY_INTERPRETER + " -I" +
// createIncludeDir() + " -I" + getTmpDir().replace('\\', '/') + "
// -rclassic-debug-verbose.rb " + ;
@@ -89,40 +89,10 @@
}
return result;
}
-
-// @Override
-// protected void createControlSocket() throws Exception {
-// try {
-// controlSocket = new Socket("localhost", 1099);
-// } catch (ConnectException cex) {
-// throw new RuntimeException(
-// "Ruby process finished prematurely. Last line in stderr: "
-// + rubyStderrRedirectorThread.getLastLine(), cex);
-// }
-// controlReaderStrategy = new MultiReaderStrategy(getXpp(controlSocket));
-//
-// Runnable runnable = new Runnable() {
-// public void run() {
-// try {
-// while (true) {
-// new WasteReader(controlReaderStrategy).read();
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// };
-// };
-// new Thread(runnable).start();
-// Thread.sleep(500) ;
-// controlWriter = new PrintWriter(controlSocket.getOutputStream(), true);
-// registerRubyDebugExtensions() ;
-// }
@Override
protected AbstractDebuggerConnection createDebuggerConnection() {
- return new RubyDebugConnection(getDirectoryOfRubyDebuggerFile(), 1098);
+ return new RubyDebugConnection(1098);
}
-
-
}
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_Single.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_Single.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_Single.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -2,14 +2,16 @@
import junit.framework.TestSuite;
/*
- * purpose of this test suite is to provide temporary smaller test suites for development
+ * purpose of this test suite is to provide small temporary test suites for development
*/
public class FTC_Single extends TestSuite {
public static junit.framework.TestSuite suite() {
TestSuite suite = new TestSuite();
- suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testBreakpointAddAndRemove"));
- suite.addTest(new FTC_RubyDebugCommunicationTest("testBreakpointAddAndRemove"));
+ //suite.addTest(new FTC_ClassicDebuggerCommunicationTest("testBreakpointAddAndRemove"));
+ //suite.addTest(new FTC_RubyDebugCommunicationTest("testBreakpointAddAndRemove"));
+ suite.addTest(new FTC_RubyDebugCommunicationTest("testInspectError"));
+
//suite.addTest(classicSuite()) ;
//suite.addTest(rdebugSuite()) ;
return suite ;
Added: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TC_RubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TC_RubyDebugTarget.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TC_RubyDebugTarget.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -0,0 +1,37 @@
+package org.rubypeople.rdt.debug.core.tests;
+
+import org.eclipse.debug.core.DebugEvent;
+import org.rubypeople.rdt.internal.debug.core.model.RubyDebugTarget;
+import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
+
+import junit.framework.TestCase;
+
+public class TC_RubyDebugTarget extends TestCase {
+
+
+ public void testThread() {
+ RubyDebugTarget target = new RubyDebugTarget(null) ;
+ ThreadInfo[] initial = new ThreadInfo[] { new ThreadInfo(1, "run")} ;
+ DebugEvent[] events = target.updateThreadsInternal(initial) ;
+ assertEquals(1, events.length) ;
+ assertEquals(DebugEvent.CREATE, events[0].getKind()) ;
+ ThreadInfo[] threadAdded = new ThreadInfo[] { new ThreadInfo(1, "run"), new ThreadInfo(2, "sleep")} ;
+ events = target.updateThreadsInternal(threadAdded) ;
+ assertEquals(1, events.length) ;
+ assertEquals(DebugEvent.CREATE, events[0].getKind()) ;
+ events = target.updateThreadsInternal(initial) ;
+ assertEquals(1, events.length) ;
+ assertEquals(DebugEvent.TERMINATE, events[0].getKind()) ;
+ ThreadInfo[] changed = new ThreadInfo[] { new ThreadInfo(1, "sleep")} ;
+ events = target.updateThreadsInternal(changed) ;
+ assertEquals(1, events.length) ;
+ assertEquals(DebugEvent.CHANGE, events[0].getKind()) ;
+
+ ThreadInfo[] addAndRemove = new ThreadInfo[] { new ThreadInfo(2, "run")} ;
+ events = target.updateThreadsInternal(addAndRemove) ;
+ assertEquals(2, events.length) ;
+ assertEquals(DebugEvent.CREATE, events[0].getKind()) ;
+ assertEquals(DebugEvent.TERMINATE, events[1].getKind()) ;
+
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestRubyDebugDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestRubyDebugDebugger.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestRubyDebugDebugger.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -23,13 +23,13 @@
@Override
protected RubyDebuggerProxy getDebugProxy(RubyDebugTarget debugTarget) {
- return new TestDebuggerProxy(debugTarget, getDirectoryOfRubyDebuggerFile(), true);
+ return new TestDebuggerProxy(debugTarget, true);
}
private static class TestDebuggerProxy extends RubyDebuggerProxy {
- public TestDebuggerProxy(IRubyDebugTarget debugTarget, String rubyFileDirectory, boolean isRubyDebug) {
- super(debugTarget, rubyFileDirectory, isRubyDebug);
+ public TestDebuggerProxy(IRubyDebugTarget debugTarget, boolean isRubyDebug) {
+ super(debugTarget, isRubyDebug);
}
@Override
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestVMDebugger.java 2007-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TestVMDebugger.java 2007-03-31 18:00:53 UTC (rev 2251)
@@ -24,13 +24,13 @@
@Override
protected RubyDebuggerProxy getDebugProxy(RubyDebugTarget debugTarget) {
- return new TestDebuggerProxy(debugTarget, getDirectoryOfRubyDebuggerFile(), false);
+ return new TestDebuggerProxy(debugTarget, false);
}
private static class TestDebuggerProxy extends RubyDebuggerProxy {
- public TestDebuggerProxy(IRubyDebugTarget debugTarget, String rubyFileDirectory, boolean isRubyDebug) {
- super(debugTarget, rubyFileDirectory, isRubyDebug);
+ public TestDebuggerProxy(IRubyDebugTarget debugTarget, boolean isRubyDebug) {
+ super(debugTarget, isRubyDebug);
}
@Override
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-03-30 16:09:17 UTC (rev 2250)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties 2007-03-31 18:00:53 UTC (rev 2251)
@@ -172,7 +172,7 @@
DebuggerPreferencePage_description_label=Debugger preferences
DebuggerPreferencePage_useRubyDebug_label=Use ruby-debug library
DebuggerPreferencePage_verboseDebugger_label=Debugger verbose mode
-DebuggerPreferencePage_useRubyDebug_comment=ruby-debug requires a ruby version >= 1.8.4.\nAt the time being a patched ruby-debug version must be used.\nIt is packaged with RDT and can be found at:\n {0}.\nIt can be installed with the command 'gem install'.\nPlease be aware that the package contains native code and therefore a c-compiler for your platform must be available.
+DebuggerPreferencePage_useRubyDebug_comment=ruby-debug requires a ruby version >= 1.8.4.\nThere must be two gems installed: ruby-debug-base (version 0.9) and ruby-debug-ide (version 0.1.0). They are packaged with RDT and can be found at:\n {0}.\nInstall with the command 'gem install' but please be aware that ruby-debug-base contains native code and therefore requires a C compiler.
PropertyAndPreferencePage_useprojectsettings_label=Enable pr&oject specific settings
PropertyAndPreferencePage_useworkspacesettings_change=Configure Workspace Settings...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-03-30 16:09:19
|
Revision: 2250
http://svn.sourceforge.net/rubyeclipse/?rev=2250&view=rev
Author: cawilliams
Date: 2007-03-30 09:09:17 -0700 (Fri, 30 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/build.xml
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Modified: trunk/org.rubypeople.rdt.doc.user/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/build.xml 2007-03-30 15:17:40 UTC (rev 2249)
+++ trunk/org.rubypeople.rdt.doc.user/build.xml 2007-03-30 16:09:17 UTC (rev 2250)
@@ -52,6 +52,7 @@
be absolute, too -->
<java classpath="${basedir}/lib/ant.jar:${basedir}/lib/ant-launcher.jar:${basedir}/lib/ant-trax.jar" classname="org.apache.tools.ant.Main" dir="${basedir}" fork="true" >
<arg value="-Dversion=${version}"/>
+ <arg value="-Dversion.full=${version.full}"/>
<arg value="-f"/>
<arg value="buildDocbook.xml"/>
<arg value="html"/>
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2007-03-30 15:17:40 UTC (rev 2249)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2007-03-30 16:09:17 UTC (rev 2250)
@@ -66,6 +66,7 @@
<param name="eclipse.plugin.id" expression="org.rubypeople.rdt.doc.user"/>
<param name="eclipse.plugin.name" expression="%Plugin.name"/>
<param name="eclipse.plugin.provider" expression="%providerName"/>
+ <param name="eclipse.plugin.version" expression="${version.full}"/>
<xmlcatalog id="docbook.catalog">
<dtd publicId="-//OASIS//DTD DocBook V3.1//EN" location="${docbook.dtd.dir}/docbookx.dtd"/>
</xmlcatalog>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-03-30 15:17:41
|
Revision: 2249
http://svn.sourceforge.net/rubyeclipse/?rev=2249&view=rev
Author: cawilliams
Date: 2007-03-30 08:17:40 -0700 (Fri, 30 Mar 2007)
Log Message:
-----------
peg 0.9.0 RC! to latest SVN trunk - it builds docs now and also contains a number of bug fixes since we first tried getting an RC out...
Modified Paths:
--------------
trunk/org.rubypeople.rdt.pluginbuilder/releases/0.9.0RC1.properties
Modified: trunk/org.rubypeople.rdt.pluginbuilder/releases/0.9.0RC1.properties
===================================================================
--- trunk/org.rubypeople.rdt.pluginbuilder/releases/0.9.0RC1.properties 2007-03-30 15:04:30 UTC (rev 2248)
+++ trunk/org.rubypeople.rdt.pluginbuilder/releases/0.9.0RC1.properties 2007-03-30 15:17:40 UTC (rev 2249)
@@ -1,7 +1,7 @@
#Written from Plug-in Builder Editor
-#Mon Mar 05 11:38:44 EST 2007
+#Fri Mar 30 11:05:22 EDT 2007
buildType=S
version=0.9.0
-version.qualifier=200703160933
-fetchTag=2190
+fetchTag=2248
+version.qualifier=200703301105
buildTypePresentation=RC1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-03-30 15:04:32
|
Revision: 2248
http://svn.sourceforge.net/rubyeclipse/?rev=2248&view=rev
Author: cawilliams
Date: 2007-03-30 08:04:30 -0700 (Fri, 30 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
Added Paths:
-----------
trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/eclipse.xsl
Removed Paths:
-------------
trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/modified_eclipse.xsl
Modified: trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2007-03-30 15:04:05 UTC (rev 2247)
+++ trunk/org.rubypeople.rdt.doc.user/buildDocbook.xml 2007-03-30 15:04:30 UTC (rev 2248)
@@ -16,7 +16,7 @@
<move file="docbook/docbook-xsl-${docbook.xsl.version}" tofile="${docbook.xsl.dir}" />
<mkdir dir="${docbook.dtd.dir}"/>
<unzip src="docbook/docbook-xml-4.2.zip" dest="${docbook.dtd.dir}"/>
- <copy file="modifications/eclipse/modified_eclipse.xsl" tofile="${docbook.xsl.dir}/eclipse/eclipse.xsl"/>
+ <copy file="modifications/eclipse/eclipse.xsl" tofile="${docbook.xsl.dir}/eclipse/eclipse.xsl"/>
<copy file="modifications/html/param.ent" tofile="${docbook.xsl.dir}/html/param.ent"/>
<copy file="modifications/html/param.xml" tofile="${docbook.xsl.dir}/html/param.xml"/>
<copy file="modifications/html/param.xsl" tofile="${docbook.xsl.dir}/html/param.xsl"/>
Copied: trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/eclipse.xsl (from rev 2247, trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/modified_eclipse.xsl)
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/eclipse.xsl (rev 0)
+++ trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/eclipse.xsl 2007-03-30 15:04:30 UTC (rev 2248)
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:import href="../html/chunk.xsl"/>
+
+<!-- ********************************************************************
+ $Id: eclipse.xsl,v 1.3 2005/04/10 18:09:50 bobstayton Exp $
+ ********************************************************************
+
+ This file is part of the XSL DocBook Stylesheet distribution.
+ See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+ and other information.
+
+ ******************************************************************** -->
+
+<xsl:template match="/">
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:choose>
+ <xsl:when test="count(key('id',$rootid)) = 0">
+ <xsl:message terminate="yes">
+ <xsl:text>ID '</xsl:text>
+ <xsl:value-of select="$rootid"/>
+ <xsl:text>' not found in document.</xsl:text>
+ </xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="key('id', $rootid)"
+ mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:message>Formatting from <xsl:value-of
+ select="$rootid"/></xsl:message>
+ <xsl:apply-templates select="key('id',$rootid)"
+ mode="process.root"/>
+ <xsl:call-template name="etoc"/>
+ <xsl:call-template name="plugin.xml"/>
+ <xsl:call-template name="manifest.mf"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="/" mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:apply-templates select="/" mode="process.root"/>
+ <xsl:call-template name="etoc"/>
+ <xsl:call-template name="plugin.xml"/>
+ <xsl:call-template name="manifest.mf"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+</xsl:template>
+
+<xsl:template name="etoc">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:if test="$manifest.in.base.dir != 0">
+ <xsl:value-of select="$base.dir"/>
+ </xsl:if>
+ <xsl:value-of select="'toc.xml'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="content">
+ <xsl:choose>
+
+ <xsl:when test="$rootid != ''">
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="key('id',$rootid)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <toc label="{$title}" topic="{$href}">
+ <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/>
+ </toc>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="/*" mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="/*" mode="title.markup"/>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="/"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <toc label="{$title}" topic="{$href}">
+ <xsl:apply-templates select="/*/*" mode="etoc"/>
+ </toc>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
+ <xsl:variable name="title">
+ <xsl:if test="$eclipse.autolabel=1">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir"/>
+ </xsl:variable>
+
+ <topic label="{$title}" href="{$href}">
+ <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
+ </topic>
+
+</xsl:template>
+
+<xsl:template match="text()" mode="etoc"/>
+
+<xsl:template name="plugin.xml">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:if test="$manifest.in.base.dir != 0">
+ <xsl:value-of select="$base.dir"/>
+ </xsl:if>
+ <xsl:value-of select="'plugin.xml'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="content"><plugin>
+ <extension point="org.eclipse.help.toc">
+ <toc file="toc.xml" primary="true"/>
+ </extension>
+</plugin>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="manifest.mf">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="'META-INF/MANIFEST.MF'"/>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'text'"/>
+ <xsl:with-param name="content">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: <xsl:value-of select="$eclipse.plugin.name"/>
+Bundle-SymbolicName: <xsl:value-of select="$eclipse.plugin.id"/>;singleton:=true
+Bundle-Version: <xsl:value-of select="$eclipse.plugin.version"/>
+Bundle-Vendor: <xsl:value-of select="$eclipse.plugin.provider"/>
+Bundle-Localization: plugin
+Eclipse-LazyStart: true
+</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+</xsl:stylesheet>
Deleted: trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/modified_eclipse.xsl
===================================================================
--- trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/modified_eclipse.xsl 2007-03-30 15:04:05 UTC (rev 2247)
+++ trunk/org.rubypeople.rdt.doc.user/modifications/eclipse/modified_eclipse.xsl 2007-03-30 15:04:30 UTC (rev 2248)
@@ -1,190 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
-<xsl:import href="../html/chunk.xsl"/>
-
-<!-- ********************************************************************
- $Id: eclipse.xsl,v 1.3 2005/04/10 18:09:50 bobstayton Exp $
- ********************************************************************
-
- This file is part of the XSL DocBook Stylesheet distribution.
- See ../README or http://nwalsh.com/docbook/xsl/ for copyright
- and other information.
-
- ******************************************************************** -->
-
-<xsl:template match="/">
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:choose>
- <xsl:when test="count(key('id',$rootid)) = 0">
- <xsl:message terminate="yes">
- <xsl:text>ID '</xsl:text>
- <xsl:value-of select="$rootid"/>
- <xsl:text>' not found in document.</xsl:text>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$collect.xref.targets = 'yes' or
- $collect.xref.targets = 'only'">
- <xsl:apply-templates select="key('id', $rootid)"
- mode="collect.targets"/>
- </xsl:if>
- <xsl:if test="$collect.xref.targets != 'only'">
- <xsl:message>Formatting from <xsl:value-of
- select="$rootid"/></xsl:message>
- <xsl:apply-templates select="key('id',$rootid)"
- mode="process.root"/>
- <xsl:call-template name="etoc"/>
- <xsl:call-template name="plugin.xml"/>
- <xsl:call-template name="manifest.mf"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$collect.xref.targets = 'yes' or
- $collect.xref.targets = 'only'">
- <xsl:apply-templates select="/" mode="collect.targets"/>
- </xsl:if>
- <xsl:if test="$collect.xref.targets != 'only'">
- <xsl:apply-templates select="/" mode="process.root"/>
- <xsl:call-template name="etoc"/>
- <xsl:call-template name="plugin.xml"/>
- <xsl:call-template name="manifest.mf"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
-
-
-</xsl:template>
-
-<xsl:template name="etoc">
- <xsl:call-template name="write.chunk">
- <xsl:with-param name="filename">
- <xsl:if test="$manifest.in.base.dir != 0">
- <xsl:value-of select="$base.dir"/>
- </xsl:if>
- <xsl:value-of select="'toc.xml'"/>
- </xsl:with-param>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="encoding" select="'utf-8'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="content">
- <xsl:choose>
-
- <xsl:when test="$rootid != ''">
- <xsl:variable name="title">
- <xsl:if test="$eclipse.autolabel=1">
- <xsl:variable name="label.markup">
- <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
- </xsl:variable>
- <xsl:if test="normalize-space($label.markup)">
- <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
- </xsl:if>
- </xsl:if>
- <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
- </xsl:variable>
- <xsl:variable name="href">
- <xsl:call-template name="href.target.with.base.dir">
- <xsl:with-param name="object" select="key('id',$rootid)"/>
- </xsl:call-template>
- </xsl:variable>
-
- <toc label="{$title}" topic="{$href}">
- <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/>
- </toc>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:variable name="title">
- <xsl:if test="$eclipse.autolabel=1">
- <xsl:variable name="label.markup">
- <xsl:apply-templates select="/*" mode="label.markup"/>
- </xsl:variable>
- <xsl:if test="normalize-space($label.markup)">
- <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
- </xsl:if>
- </xsl:if>
- <xsl:apply-templates select="/*" mode="title.markup"/>
- </xsl:variable>
- <xsl:variable name="href">
- <xsl:call-template name="href.target.with.base.dir">
- <xsl:with-param name="object" select="/"/>
- </xsl:call-template>
- </xsl:variable>
-
- <toc label="{$title}" topic="{$href}">
- <xsl:apply-templates select="/*/*" mode="etoc"/>
- </toc>
- </xsl:otherwise>
-
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
- <xsl:variable name="title">
- <xsl:if test="$eclipse.autolabel=1">
- <xsl:variable name="label.markup">
- <xsl:apply-templates select="." mode="label.markup"/>
- </xsl:variable>
- <xsl:if test="normalize-space($label.markup)">
- <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
- </xsl:if>
- </xsl:if>
- <xsl:apply-templates select="." mode="title.markup"/>
- </xsl:variable>
-
- <xsl:variable name="href">
- <xsl:call-template name="href.target.with.base.dir"/>
- </xsl:variable>
-
- <topic label="{$title}" href="{$href}">
- <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
- </topic>
-
-</xsl:template>
-
-<xsl:template match="text()" mode="etoc"/>
-
-<xsl:template name="plugin.xml">
- <xsl:call-template name="write.chunk">
- <xsl:with-param name="filename">
- <xsl:if test="$manifest.in.base.dir != 0">
- <xsl:value-of select="$base.dir"/>
- </xsl:if>
- <xsl:value-of select="'plugin.xml'"/>
- </xsl:with-param>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="encoding" select="'utf-8'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="content"><plugin>
- <extension point="org.eclipse.help.toc">
- <toc file="toc.xml" primary="true"/>
- </extension>
-</plugin>
- </xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-<xsl:template name="manifest.mf">
- <xsl:call-template name="write.chunk">
- <xsl:with-param name="filename">
- <xsl:value-of select="'META-INF/MANIFEST.MF'"/>
- </xsl:with-param>
- <xsl:with-param name="method" select="'text'"/>
- <xsl:with-param name="content">Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: <xsl:value-of select="$eclipse.plugin.name"/>
-Bundle-SymbolicName: <xsl:value-of select="$eclipse.plugin.id"/>;singleton:=true
-Bundle-Version: <xsl:value-of select="$eclipse.plugin.version"/>
-Bundle-Vendor: <xsl:value-of select="$eclipse.plugin.provider"/>
-Bundle-Localization: plugin
-Eclipse-LazyStart: true
-</xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-</xsl:stylesheet>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|