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...> - 2006-11-01 16:05:19
|
Revision: 1647
http://svn.sourceforge.net/rubyeclipse/?rev=1647&view=rev
Author: cawilliams
Date: 2006-11-01 08:05:12 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
handle instance method calls for go to declaration
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2006-11-01 16:05:04 UTC (rev 1646)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2006-11-01 16:05:12 UTC (rev 1647)
@@ -10,11 +10,13 @@
import org.jruby.ast.ClassVarDeclNode;
import org.jruby.ast.ClassVarNode;
import org.jruby.ast.ConstNode;
+import org.jruby.ast.FCallNode;
import org.jruby.ast.InstAsgnNode;
import org.jruby.ast.InstVarNode;
import org.jruby.ast.LocalAsgnNode;
import org.jruby.ast.LocalVarNode;
import org.jruby.ast.Node;
+import org.jruby.ast.VCallNode;
import org.jruby.ast.types.INameNode;
import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
@@ -64,9 +66,18 @@
.getChildren(), IRubyElement.CLASS_VAR, getName(selected));
return convertToArray(possible);
}
+ if (isMethodCall(selected)) {
+ List<IRubyElement> possible = getChildrenWithName(script
+ .getChildren(), IRubyElement.METHOD, getName(selected));
+ return convertToArray(possible);
+ }
return new IRubyElement[0];
}
+ private boolean isMethodCall(Node selected) {
+ return (selected instanceof VCallNode) || (selected instanceof FCallNode);
+ }
+
private IRubyElement[] convertToArray(List<IRubyElement> possible) {
IRubyElement[] elements = new IRubyElement[possible.size()];
int x = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 16:05:08
|
Revision: 1646
http://svn.sourceforge.net/rubyeclipse/?rev=1646&view=rev
Author: cawilliams
Date: 2006-11-01 08:05:04 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
remove unused class
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionVisitor.java
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionVisitor.java 2006-11-01 15:57:54 UTC (rev 1645)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionVisitor.java 2006-11-01 16:05:04 UTC (rev 1646)
@@ -1,619 +0,0 @@
-package org.rubypeople.rdt.internal.codeassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jruby.ast.AliasNode;
-import org.jruby.ast.AndNode;
-import org.jruby.ast.ArgsCatNode;
-import org.jruby.ast.ArgsNode;
-import org.jruby.ast.ArrayNode;
-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.SClassNode;
-import org.jruby.ast.SValueNode;
-import org.jruby.ast.ScopeNode;
-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.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.IRubyScript;
-import org.rubypeople.rdt.core.IType;
-
-public class SelectionVisitor implements NodeVisitor {
-
- private int end;
- private int start;
- private IRubyScript script;
- private String currentTypeName;
- private List elements;
-
- public SelectionVisitor(IRubyScript script, int start, int end) {
- this.script = script;
- this.start = start;
- this.end = end;
- this.currentTypeName = "Object";
- this.elements = new ArrayList();
- }
-
- public Instruction visitAliasNode(AliasNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitAndNode(AndNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitArgsNode(ArgsNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitArgsCatNode(ArgsCatNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitArrayNode(ArrayNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBackRefNode(BackRefNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBeginNode(BeginNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBignumNode(BignumNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBlockArgNode(BlockArgNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBlockNode(BlockNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBlockPassNode(BlockPassNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitBreakNode(BreakNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitClassVarAsgnNode(ClassVarAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitClassVarDeclNode(ClassVarDeclNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitClassVarNode(ClassVarNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitCallNode(CallNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitCaseNode(CaseNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitClassNode(ClassNode iVisited) {
- // TODO Push type names on a stack
- String oldTypeName = currentTypeName;
- currentTypeName = getFullyQualifiedName(iVisited.getCPath());
- iVisited.getBodyNode().accept(this);
- currentTypeName = oldTypeName;
- return null;
- }
-
- 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 + "::";
- return prefix + colonNode.getName();
- }
- return "";
- }
-
- public Instruction visitColon2Node(Colon2Node iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitColon3Node(Colon3Node iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitConstNode(ConstNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDAsgnNode(DAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDRegxNode(DRegexpNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDStrNode(DStrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDSymbolNode(DSymbolNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDVarNode(DVarNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDXStrNode(DXStrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDefinedNode(DefinedNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDefnNode(DefnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDefsNode(DefsNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitDotNode(DotNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitEnsureNode(EnsureNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitEvStrNode(EvStrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitFCallNode(FCallNode iVisited) {
- // TODO Auto-generated method stub
- ISourcePosition pos = iVisited.getPosition();
- if ((start >= pos.getStartOffset()) && (end <= pos.getEndOffset())) {
- String methodName = iVisited.getName();
- IType type = script.getType(currentTypeName);
- int argCount = 0;
- elements.add(type.getMethod(methodName, new String[] {}));
- }
- return null;
- }
-
- public Instruction visitFalseNode(FalseNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitFixnumNode(FixnumNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitFlipNode(FlipNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitFloatNode(FloatNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitForNode(ForNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitGlobalAsgnNode(GlobalAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitGlobalVarNode(GlobalVarNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitHashNode(HashNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitInstAsgnNode(InstAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitInstVarNode(InstVarNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitIfNode(IfNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitIterNode(IterNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitLocalAsgnNode(LocalAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitLocalVarNode(LocalVarNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitMultipleAsgnNode(MultipleAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitMatch2Node(Match2Node iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitMatch3Node(Match3Node iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitMatchNode(MatchNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitModuleNode(ModuleNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitNewlineNode(NewlineNode iVisited) {
- iVisited.getNextNode().accept(this);
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitNextNode(NextNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitNilNode(NilNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitNotNode(NotNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitNthRefNode(NthRefNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOpElementAsgnNode(OpElementAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOpAsgnNode(OpAsgnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOpAsgnAndNode(OpAsgnAndNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOpAsgnOrNode(OpAsgnOrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOptNNode(OptNNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitOrNode(OrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitPostExeNode(PostExeNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitRedoNode(RedoNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitRegexpNode(RegexpNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitRescueBodyNode(RescueBodyNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitRescueNode(RescueNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitRetryNode(RetryNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitReturnNode(ReturnNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSClassNode(SClassNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitScopeNode(ScopeNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSelfNode(SelfNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSplatNode(SplatNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitStrNode(StrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSuperNode(SuperNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSValueNode(SValueNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitSymbolNode(SymbolNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitToAryNode(ToAryNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitTrueNode(TrueNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitUndefNode(UndefNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitUntilNode(UntilNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitVAliasNode(VAliasNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitVCallNode(VCallNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitWhenNode(WhenNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitWhileNode(WhileNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitXStrNode(XStrNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitYieldNode(YieldNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitZArrayNode(ZArrayNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Instruction visitZSuperNode(ZSuperNode iVisited) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IRubyElement[] getElements() {
- IRubyElement[] elem = new IRubyElement[elements.size()];
- for (int i = 0; i < elements.size(); i++) {
- elem[i] = (IRubyElement) elements.get(i);
- }
- return elem;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 15:58:08
|
Revision: 1645
http://svn.sourceforge.net/rubyeclipse/?rev=1645&view=rev
Author: cawilliams
Date: 2006-11-01 07:57:54 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
start to implement a hacky go to declaration F3 command
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2006-11-01 15:57:28 UTC (rev 1644)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2006-11-01 15:57:54 UTC (rev 1645)
@@ -1,25 +1,118 @@
package org.rubypeople.rdt.internal.codeassist;
-import java.io.CharArrayReader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.jruby.ast.ArgumentNode;
+import org.jruby.ast.ClassVarAsgnNode;
+import org.jruby.ast.ClassVarDeclNode;
+import org.jruby.ast.ClassVarNode;
+import org.jruby.ast.ConstNode;
+import org.jruby.ast.InstAsgnNode;
+import org.jruby.ast.InstVarNode;
+import org.jruby.ast.LocalAsgnNode;
+import org.jruby.ast.LocalVarNode;
import org.jruby.ast.Node;
+import org.jruby.ast.types.INameNode;
+import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
+import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator;
public class SelectionEngine {
-
- public IRubyElement[] select(IRubyScript script, int start, int end) throws RubyModelException {
- char[] contents = script.getBuffer().getCharacters();
+
+ public IRubyElement[] select(IRubyScript script, int start, int end)
+ throws RubyModelException {
+ String source = script.getSource();
RubyParser parser = new RubyParser();
- Node node = parser.parse((IFile) script.getResource(), new CharArrayReader(contents));
-
- SelectionVisitor visitor = new SelectionVisitor(script, start, end);
- if (node != null) node.accept(visitor);
-
- return visitor.getElements();
+ Node root = parser.parse((IFile) script.getResource(),
+ new StringReader(source));
+ Node selected = OffsetNodeLocator.Instance().getNodeAtOffset(root,
+ start);
+
+ if (selected instanceof ConstNode) {
+ ConstNode constNode = (ConstNode) selected;
+ String name = constNode.getName();
+ // TODO Find constants too (not just types)
+ // TODO Search scopes outward!
+ IRubyProject[] projects = new IRubyProject[1];
+ projects[0] = script.getRubyProject();
+ RubyElementRequestor completer = new RubyElementRequestor(projects);
+ IType type = completer.findType(name);
+ return new IRubyElement[] { type };
+ }
+ if (isLocalVarRef(selected)) {
+ List<IRubyElement> possible = getChildrenWithName(script
+ .getChildren(), IRubyElement.LOCAL_VARIABLE,
+ getName(selected));
+ return convertToArray(possible);
+ }
+ if (isInstanceVarRef(selected)) {
+ List<IRubyElement> possible = getChildrenWithName(script
+ .getChildren(), IRubyElement.INSTANCE_VAR,
+ getName(selected));
+ return convertToArray(possible);
+ }
+ if (isClassVarRef(selected)) {
+ List<IRubyElement> possible = getChildrenWithName(script
+ .getChildren(), IRubyElement.CLASS_VAR, getName(selected));
+ return convertToArray(possible);
+ }
+ return new IRubyElement[0];
}
+ private IRubyElement[] convertToArray(List<IRubyElement> possible) {
+ IRubyElement[] elements = new IRubyElement[possible.size()];
+ int x = 0;
+ for (IRubyElement element : possible) {
+ elements[x++] = element;
+ }
+ return elements;
+ }
+
+ private List<IRubyElement> getChildrenWithName(IRubyElement[] children,
+ int type, String name) throws RubyModelException {
+ List<IRubyElement> possible = new ArrayList<IRubyElement>();
+ for (int i = 0; i < children.length; i++) {
+ IRubyElement child = children[i];
+ if (child.getElementType() == type) {
+ if (child.getElementName().equals(name))
+ possible.add(child);
+ }
+ if (child instanceof IParent) {
+ possible.addAll(getChildrenWithName(((IParent) child)
+ .getChildren(), type, name));
+ }
+ }
+ return possible;
+ }
+
+ private String getName(Node node) {
+ if (node instanceof INameNode) {
+ return ((INameNode) node).getName();
+ }
+ if (node instanceof ClassVarNode) {
+ return ((ClassVarNode) node).getName();
+ }
+ return "";
+ }
+
+ private boolean isInstanceVarRef(Node node) {
+ return ((node instanceof InstAsgnNode) || (node instanceof InstVarNode));
+ }
+
+ private boolean isClassVarRef(Node node) {
+ return ((node instanceof ClassVarAsgnNode) || (node instanceof ClassVarNode)|| (node instanceof ClassVarDeclNode));
+ }
+
+ private boolean isLocalVarRef(Node node) {
+ return ((node instanceof LocalAsgnNode)
+ || (node instanceof ArgumentNode) || (node instanceof LocalVarNode));
+ }
}
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 2006-11-01 15:57:28 UTC (rev 1644)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java 2006-11-01 15:57:54 UTC (rev 1645)
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -58,6 +59,7 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.VerifyEvent;
@@ -95,6 +97,7 @@
import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.RubyUIMessages;
+import org.rubypeople.rdt.internal.ui.actions.CompositeActionGroup;
import org.rubypeople.rdt.internal.ui.actions.FoldingActionGroup;
import org.rubypeople.rdt.internal.ui.text.IRubyPartitions;
import org.rubypeople.rdt.internal.ui.text.RubyHeuristicScanner;
@@ -103,6 +106,7 @@
import org.rubypeople.rdt.ui.PreferenceConstants;
import org.rubypeople.rdt.ui.actions.FormatAction;
import org.rubypeople.rdt.ui.actions.IRubyEditorActionDefinitionIds;
+import org.rubypeople.rdt.ui.actions.OpenEditorActionGroup;
import org.rubypeople.rdt.ui.actions.RubyActionGroup;
import org.rubypeople.rdt.ui.actions.SurroundWithBeginRescueAction;
import org.rubypeople.rdt.ui.text.folding.IRubyFoldingStructureProvider;
@@ -110,7 +114,6 @@
public class RubyEditor extends RubyAbstractEditor {
- protected RubyActionGroup actionGroup;
private ProjectionSupport fProjectionSupport;
/** The editor's tab converter */
@@ -171,6 +174,8 @@
private FoldingActionGroup fFoldingGroup;
private BracketInserter fBracketInserter = new BracketInserter();
+ private CompositeActionGroup fActionGroups;
+ private CompositeActionGroup fContextMenuGroup;
public RubyEditor() {
@@ -189,12 +194,12 @@
* @return returns this editor's standard action group
*/
protected ActionGroup getActionGroup() {
- return actionGroup;
+ return fActionGroups;
}
protected void createActions() {
super.createActions();
-
+
Action action = new ContentAssistAction(RubyUIMessages.getResourceBundle(),
"ContentAssistProposal.", this);
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
@@ -226,6 +231,11 @@
action.setActionDefinitionId(IRubyEditorActionDefinitionIds.FORMAT);
setAction("Format", action);
+ ActionGroup oeg;
+ fActionGroups= new CompositeActionGroup(new ActionGroup[] {
+ oeg= new OpenEditorActionGroup(this)
+ });
+ fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {oeg});
fFoldingGroup= new FoldingActionGroup(this, getViewer());
@@ -237,8 +247,8 @@
beginRescueAction.update(selection);
provider.addSelectionChangedListener(beginRescueAction);
setAction(SurroundWithBeginRescueAction.SURROUND_WTH_BEGIN_RESCUE, beginRescueAction);
-
- actionGroup = new RubyActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
+
+ fActionGroups.addGroup(new RubyActionGroup(this, ITextEditorActionConstants.GROUP_EDIT));
}
/**
@@ -619,6 +629,11 @@
fProjectionSupport.dispose();
fProjectionSupport = null;
}
+
+ if (fActionGroups != null) {
+ fActionGroups.dispose();
+ fActionGroups= null;
+ }
super.dispose();
}
@@ -714,7 +729,18 @@
}
}
- actionGroup.fillContextMenu(menu);
+
+ menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
+
+ ActionContext context= new ActionContext(getSelectionProvider().getSelection());
+ fContextMenuGroup.setContext(context);
+ fContextMenuGroup.fillContextMenu(menu);
+ fContextMenuGroup.setContext(null);
+
+ // Quick views
+ // TODO Add show outline action!
+// IAction action= getAction(IRubyEditorActionDefinitionIds.SHOW_OUTLINE);
+// menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
}
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 15:57:32
|
Revision: 1644
http://svn.sourceforge.net/rubyeclipse/?rev=1644&view=rev
Author: cawilliams
Date: 2006-11-01 07:57:28 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
add two messages
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2006-11-01 15:57:20 UTC (rev 1643)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2006-11-01 15:57:28 UTC (rev 1644)
@@ -18,8 +18,10 @@
OpenAction_declaration_label=&Open Declaration
OpenAction_select_element=&Select or enter the element to open:
+OpenAction_error_title=Open
OpenAction_error_message=Cannot open default editor.
OpenAction_error_messageArgs=Cannot open default editor on {0}. {1}
+OpenAction_error_messageBadSelection=Current text selection does not resolve to a Ruby element
OpenAction_error_messageProblems=Problems Opening Editor
MemberFilterActionGroup_hide_fields_label=Hide Fiel&ds
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 15:57:25
|
Revision: 1643
http://svn.sourceforge.net/rubyeclipse/?rev=1643&view=rev
Author: cawilliams
Date: 2006-11-01 07:57:20 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
comment out debug output to System.out
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java 2006-11-01 14:31:13 UTC (rev 1642)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/util/FirstPrecursorNodeLocator.java 2006-11-01 15:57:20 UTC (rev 1643)
@@ -58,7 +58,7 @@
{
if ( acceptor.doesAccept( iVisited ) )
{
- System.out.println("Recording accepted node: " + iVisited.getClass().getSimpleName() + "@" + iVisited.getPosition().getStartOffset() + ".." + iVisited.getPosition().getEndOffset() );
+// System.out.println("Recording accepted node: " + iVisited.getClass().getSimpleName() + "@" + iVisited.getPosition().getStartOffset() + ".." + iVisited.getPosition().getEndOffset() );
locatedNode = iVisited;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 14:31:19
|
Revision: 1642
http://svn.sourceforge.net/rubyeclipse/?rev=1642&view=rev
Author: cawilliams
Date: 2006-11-01 06:31:13 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
make the progress estimate a little more plausible for building - multiuply number of files times (number of compilers + 2 [for flushing symbol index and for removing markers])
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-11-01 14:25:30 UTC (rev 1641)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2006-11-01 14:31:13 UTC (rev 1642)
@@ -38,13 +38,14 @@
public void compile(IProgressMonitor monitor) throws CoreException {
analyzeFiles();
List list = getFilesToCompile();
- monitor.beginTask("Building "+project.getName() + "...", list.size() * compilers.size() + 2);
+ int fileCount = list.size();
+ monitor.beginTask("Building "+project.getName() + "...", fileCount * (compilers.size() + 2));
monitor.subTask("Removing Markers...");
removeMarkers(markerManager);
- monitor.worked(1);
+ monitor.worked(fileCount);
flushIndexEntries(symbolIndex);
- monitor.worked(1);
+ monitor.worked(fileCount);
compileFiles(list, monitor);
monitor.done();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 14:25:36
|
Revision: 1641
http://svn.sourceforge.net/rubyeclipse/?rev=1641&view=rev
Author: cawilliams
Date: 2006-11-01 06:25:30 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
readContents was dropping end of line characters (it assumed end of line to be \n always) on many files - making offsets of positions off by the line number of the position (only for building)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyCodeAnalyzer.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyCodeAnalyzer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyCodeAnalyzer.java 2006-11-01 14:23:43 UTC (rev 1640)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyCodeAnalyzer.java 2006-11-01 14:25:30 UTC (rev 1641)
@@ -12,7 +12,6 @@
package org.rubypeople.rdt.internal.core.builder;
-import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -44,7 +43,6 @@
public void compileFile(IFile file) throws CoreException {
Reader reader = new InputStreamReader(file.getContents());
- // XXX Make sure readContents isn't dropping end of line characters
String contents = readContents(reader);
markerManager.removeProblemsAndTasksFor(file);
try {
@@ -62,12 +60,10 @@
private String readContents(Reader reader) {
try {
- BufferedReader buff = new BufferedReader(reader);
+ int c = 0;
StringBuffer str = new StringBuffer();
- String line;
- while((line = buff.readLine()) != null) {
- str.append(line);
- str.append("\n");
+ while ((c = reader.read()) != -1) {
+ str.append((char) c);
}
return str.toString();
} catch (IOException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-11-01 14:24:01
|
Revision: 1640
http://svn.sourceforge.net/rubyeclipse/?rev=1640&view=rev
Author: cawilliams
Date: 2006-11-01 06:23:43 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
fix ticket # 210 - ruby debug preference page showing up for Errors/Warnings page
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2006-11-01 10:35:31 UTC (rev 1639)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2006-11-01 14:23:43 UTC (rev 1640)
@@ -90,7 +90,7 @@
<page
name="%problemSeveritiesPrefName"
category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyBase"
- class="org.rubypeople.rdt.internal.ui.preferences.DebuggerPreferencePage"
+ class="org.rubypeople.rdt.internal.ui.preferences.ProblemSeveritiesPreferencePage"
id="org.rubypeople.rdt.ui.preferences.ProblemSeveritiesPreferencePage">
<keywordReference id="org.rubypeople.rdt.ui.severities"/>
</page>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2006-11-01 10:35:46
|
Revision: 1639
http://svn.sourceforge.net/rubyeclipse/?rev=1639&view=rev
Author: mirkostocker
Date: 2006-11-01 02:35:31 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
new feature: dump AST as jruby test code, used in testPositions.rb
Modified Paths:
--------------
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.astviewer/icons/dump_jruby.gif
Added: trunk/org.rubypeople.rdt.astviewer/icons/dump_jruby.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.astviewer/icons/dump_jruby.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java 2006-10-31 22:01:11 UTC (rev 1638)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java 2006-11-01 10:35:31 UTC (rev 1639)
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import org.jruby.ast.NewlineNode;
import org.jruby.ast.Node;
public class AstUtility {
@@ -74,5 +75,39 @@
posString.append("]");
return posString.toString();
}
-
+
+ public static String nodeListJRubyFormat(ArrayList<Node> nodes) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("list = [\n");
+ Iterator nodeIter = nodes.iterator();
+
+ while(nodeIter.hasNext()) {
+
+ Node node = (Node) nodeIter.next();
+
+ if(node instanceof NewlineNode) {
+ builder.append("nil, #");
+ }
+
+ builder.append("['");
+ builder.append(node.getClass().getSimpleName());
+ builder.append("', ");
+ builder.append(node.getPosition().getStartLine());
+ builder.append(", ");
+ builder.append(node.getPosition().getEndLine());
+ builder.append(", ");
+ builder.append(node.getPosition().getStartOffset());
+ builder.append(", ");
+ builder.append(node.getPosition().getEndOffset());
+ builder.append("]");
+
+ if(nodeIter.hasNext()) {
+ builder.append(",\n");
+ }
+ }
+
+ builder.append("\n]");
+ return builder.toString();
+ }
+
}
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-10-31 22:01:11 UTC (rev 1638)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-11-01 10:35:31 UTC (rev 1639)
@@ -28,6 +28,12 @@
package org.rubypeople.rdt.astviewer.views;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -49,6 +55,8 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.DrillDownAdapter;
@@ -62,6 +70,7 @@
private DrillDownAdapter drillDownAdapter;
private Action refreshAction;
private Action dumpToConsoleAction;
+ private Action dumpJRubyTestFormatAction;
private Action doubleClickAction;
private Action clickAction;
private ViewContentProvider viewContentProvider;
@@ -154,11 +163,13 @@
private void fillLocalPullDown(IMenuManager manager) {
manager.add(refreshAction);
manager.add(dumpToConsoleAction);
+ manager.add(dumpJRubyTestFormatAction);
}
private void fillContextMenu(IMenuManager manager) {
manager.add(refreshAction);
manager.add(dumpToConsoleAction);
+ //manager.add(dumpJRubyTestFormatAction);
drillDownAdapter.addNavigationActions(manager);
// Other plug-ins can contribute there actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -167,6 +178,7 @@
private void fillLocalToolBar(IToolBarManager manager) {
manager.add(refreshAction);
manager.add(dumpToConsoleAction);
+ manager.add(dumpJRubyTestFormatAction);
drillDownAdapter.addNavigationActions(manager);
}
@@ -175,8 +187,51 @@
private void makeActions() {
makeRefreshAction();
makeDumpAction();
+ makeDumpJRubyFormatAction();
}
+ private void makeDumpJRubyFormatAction() {
+ dumpJRubyTestFormatAction = new Action() {
+ public void run() {
+
+ AstViewConsole.print(AstUtility.nodeListJRubyFormat(AstUtility.findAllNodes(getRootNode())));
+ AstViewConsole.print("test_tree(list, <<END)");
+ AstViewConsole.print(textEditorContentToString().toString().trim());
+ AstViewConsole.print("END");
+ }
+
+ private StringBuilder textEditorContentToString() {
+ IEditorInput editorInput = getEditor().getEditorInput();
+ IFile aFile = null;
+ if(editorInput instanceof IFileEditorInput){
+ aFile = ((IFileEditorInput)editorInput).getFile();
+ }
+
+ BufferedReader br = null;
+ StringBuilder sb = new StringBuilder();
+ try {
+ br = new BufferedReader(new InputStreamReader(aFile.getContents()));
+ String line = null;
+
+ while ((line = br.readLine()) != null) {
+ sb.append(line + "\n");
+ }
+ br.close();
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return sb;
+ }
+ };
+
+ dumpJRubyTestFormatAction.setText("Dump in JRuby-Test");
+ dumpJRubyTestFormatAction.setToolTipText("Dumps node and all child-nodes to the console, formatted like as in JRuby's testPositions.rb");
+ dumpJRubyTestFormatAction.setImageDescriptor(Activator.getImageDescriptor("icons/dump_jruby.gif"));
+ }
+
private void makeDumpAction() {
dumpToConsoleAction = new Action() {
public void run() {
@@ -229,6 +284,11 @@
if(selection.length <= 0)
return null;
return ((TreeObject) selection[0].getData()).getNode();
+ }
+
+ private Node getRootNode() {
+ TreeItem root = viewer.getTree().getItem(0);
+ return ((TreeObject) root.getData()).getNode();
}
private RubyEditor getEditor() {
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-10-31 22:01:11 UTC (rev 1638)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-11-01 10:35:31 UTC (rev 1639)
@@ -153,8 +153,9 @@
}
private boolean editorChanged() {
- if(getActiveWorkbenchPage() == null)
+ if(getActiveWorkbenchPage() == null || !(getActiveWorkbenchPage().getActiveEditor() instanceof RubyEditor))
return false;
+
return getEditor() != (RubyEditor) getActiveWorkbenchPage().getActiveEditor();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-31 22:01:25
|
Revision: 1638
http://svn.sourceforge.net/rubyeclipse/?rev=1638&view=rev
Author: cawilliams
Date: 2006-10-31 14:01:11 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
add 'next' to list of keywords
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor/RubyEditorPreferences.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor/RubyEditorPreferences.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor/RubyEditorPreferences.properties 2006-10-31 19:41:22 UTC (rev 1637)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor/RubyEditorPreferences.properties 2006-10-31 22:01:11 UTC (rev 1638)
@@ -1 +1 @@
-keywords=BEGIN,END,alias,begin,do,end,yield,if,unless,elsif,else,while,unless,for,in,super,retry,redo,break,case,when,throw,and,or,not,raise,rescue,ensure,new,each,def,class,module,return,false,true,nil,then
\ No newline at end of file
+keywords=BEGIN,END,alias,begin,do,end,yield,if,unless,elsif,else,while,unless,for,in,super,retry,redo,break,case,when,throw,and,or,not,raise,rescue,ensure,new,each,def,class,module,return,false,true,nil,then,next
\ 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...> - 2006-10-31 19:41:38
|
Revision: 1637
http://svn.sourceforge.net/rubyeclipse/?rev=1637&view=rev
Author: mbarchfe
Date: 2006-10-31 11:41:22 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
Patch from Shugo Maeda: open debug perspective on suspend
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java
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 2006-10-31 19:02:05 UTC (rev 1636)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyThread.java 2006-10-31 19:41:22 UTC (rev 1637)
@@ -223,5 +223,13 @@
public void setId(int id) {
this.id = id;
}
+
+ public Object getAdapter(Class adapterType) {
+ // Patch from Shugo Maeda: open debug perspective on suspend
+ if (adapterType.equals(ILaunch.class)) {
+ return getLaunch();
+ }
+ return super.getAdapter(adapterType);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-10-31 19:02:12
|
Revision: 1636
http://svn.sourceforge.net/rubyeclipse/?rev=1636&view=rev
Author: mbarchfe
Date: 2006-10-31 11:02:05 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
removed usepserver property, not needed anymore for subversion
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml 2006-10-31 18:42:13 UTC (rev 1635)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml 2006-10-31 19:02:05 UTC (rev 1636)
@@ -34,7 +34,6 @@
<arg value="-data" />
<arg value="${buildDirectory}/workspace" />
<arg value="${verboseAnt}" />
- <jvmarg value="${usePserver}" />
<jvmarg value="${dontRunTests}" />
<jvmarg value="-Dbasews=${ws}" />
<jvmarg value="-Dbaseos=${os}" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-10-31 18:42:29
|
Revision: 1635
http://svn.sourceforge.net/rubyeclipse/?rev=1635&view=rev
Author: mbarchfe
Date: 2006-10-31 10:42:13 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
trigger build after change in property file (set dontruntests)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2006-10-31 12:27:07 UTC (rev 1634)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2006-10-31 18:42:13 UTC (rev 1635)
@@ -61,3 +61,4 @@
</publishers>
</project>
</cruisecontrol>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2006-10-31 12:27:28
|
Revision: 1634
http://svn.sourceforge.net/rubyeclipse/?rev=1634&view=rev
Author: mirkostocker
Date: 2006-10-31 04:27:07 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
added an additional action to the astviewer that dumps the selected node and its children to a console.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.astviewer/icons/dump.gif
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java
trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstViewConsole.java
Modified: trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/META-INF/MANIFEST.MF 2006-10-31 12:27:07 UTC (rev 1634)
@@ -13,7 +13,8 @@
org.eclipse.jface.text,
org.rubypeople.rdt.core,
org.eclipse.ui.editors,
- org.eclipse.ui.workbench.texteditor
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.console
Eclipse-LazyStart: true
Export-Package: org.rubypeople.rdt.astviewer,
org.rubypeople.rdt.astviewer.views
Added: trunk/org.rubypeople.rdt.astviewer/icons/dump.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.astviewer/icons/dump.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/AstViewerPreferencePage.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -1,3 +1,31 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
package org.rubypeople.rdt.astviewer.preferences;
import org.eclipse.jface.preference.*;
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceConstants.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -1,3 +1,31 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
package org.rubypeople.rdt.astviewer.preferences;
/**
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/preferences/PreferenceInitializer.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -1,3 +1,31 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
package org.rubypeople.rdt.astviewer.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java (rev 0)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstUtility.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -0,0 +1,78 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.astviewer.views;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.jruby.ast.Node;
+
+public class AstUtility {
+
+ public static ArrayList<Node> findAllNodes(Node rootNode) {
+ ArrayList<Node> nodes = new ArrayList<Node>();
+ if(rootNode == null)
+ return nodes;
+ nodes.add(rootNode);
+ for(Object o : rootNode.childNodes()) {
+ nodes.addAll(findAllNodes((Node) o));
+ }
+ return nodes;
+ }
+
+ public static String nodeList(ArrayList<Node> nodes) {
+ StringBuilder str = new StringBuilder();
+ Iterator it = nodes.iterator();
+ while(it.hasNext()) {
+ String name = ((Node) it.next()).getClass().getName();
+ str.append(name.substring(name.lastIndexOf(".") + 1, name.length()));
+ if(it.hasNext())
+ str.append(", ");
+ }
+ return str.toString();
+ }
+
+ public static String formatedPosition(Node n) {
+ if(n == null)
+ return "";
+
+ StringBuilder posString = new StringBuilder();
+ posString.append("Lines [");
+ posString.append(n.getPosition().getStartLine());
+ posString.append(":");
+ posString.append(n.getPosition().getEndLine());
+ posString.append("], Offset [");
+ posString.append(n.getPosition().getStartOffset());
+ posString.append(":");
+ posString.append(n.getPosition().getEndOffset());
+ posString.append("]");
+ return posString.toString();
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstView.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -61,6 +61,7 @@
private TreeViewer viewer;
private DrillDownAdapter drillDownAdapter;
private Action refreshAction;
+ private Action dumpToConsoleAction;
private Action doubleClickAction;
private Action clickAction;
private ViewContentProvider viewContentProvider;
@@ -152,10 +153,12 @@
private void fillLocalPullDown(IMenuManager manager) {
manager.add(refreshAction);
+ manager.add(dumpToConsoleAction);
}
private void fillContextMenu(IMenuManager manager) {
manager.add(refreshAction);
+ manager.add(dumpToConsoleAction);
drillDownAdapter.addNavigationActions(manager);
// Other plug-ins can contribute there actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -163,10 +166,30 @@
private void fillLocalToolBar(IToolBarManager manager) {
manager.add(refreshAction);
+ manager.add(dumpToConsoleAction);
drillDownAdapter.addNavigationActions(manager);
}
+
+
private void makeActions() {
+ makeRefreshAction();
+ makeDumpAction();
+ }
+
+ private void makeDumpAction() {
+ dumpToConsoleAction = new Action() {
+ public void run() {
+ AstViewConsole.print(AstUtility.nodeList(AstUtility.findAllNodes(getSelectedNode())));
+ }
+ };
+
+ dumpToConsoleAction.setText("Dump Node");
+ dumpToConsoleAction.setToolTipText("Dumps node and all child-nodes to the console.");
+ dumpToConsoleAction.setImageDescriptor(Activator.getImageDescriptor("icons/dump.gif"));
+ }
+
+ private void makeRefreshAction() {
refreshAction = new Action() {
public void run() {
viewContentProvider.forceUpdateContent();
@@ -186,28 +209,11 @@
editor.selectAndReveal(n.getPosition().getStartOffset(), n.getPosition().getEndOffset() - n.getPosition().getStartOffset() + 1);
}
- private String formatedPosition(Node n) {
- if(n == null)
- return "";
-
- StringBuilder posString = new StringBuilder();
- posString.append("Lines [");
- posString.append(n.getPosition().getStartLine());
- posString.append(":");
- posString.append(n.getPosition().getEndLine());
- posString.append("], Offset [");
- posString.append(n.getPosition().getStartOffset());
- posString.append(":");
- posString.append(n.getPosition().getEndOffset());
- posString.append("]");
- return posString.toString();
- }
-
private void hookClickAction() {
clickAction = new Action(){
public void run() {
- detailsViewer.getDocument().set(formatedPosition(getSelectedNode()));
+ detailsViewer.getDocument().set(AstUtility.formatedPosition(getSelectedNode()));
}
};
Added: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstViewConsole.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstViewConsole.java (rev 0)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/AstViewConsole.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -0,0 +1,79 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.astviewer.views;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+public class AstViewConsole {
+
+ private static final String name = "AST Viewer";
+
+ private static MessageConsole findConsole(String name) {
+ ConsolePlugin plugin = ConsolePlugin.getDefault();
+ IConsoleManager conMan = plugin.getConsoleManager();
+ IConsole[] existing = conMan.getConsoles();
+ for (int i = 0; i < existing.length; i++)
+ if (name.equals(existing[i].getName()))
+ return (MessageConsole) existing[i];
+ //no console found, so create a new one
+ MessageConsole myConsole = new MessageConsole(name, null);
+ conMan.addConsoles(new IConsole[] { myConsole });
+ return myConsole;
+ }
+
+ public static void print(String text) {
+ revealConsole();
+ MessageConsole myConsole = findConsole(name);
+ MessageConsoleStream out = myConsole.newMessageStream();
+ out.println(text);
+ }
+
+ private static void revealConsole() {
+ IConsole myConsole = findConsole(name);
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ String id = IConsoleConstants.ID_CONSOLE_VIEW;
+ IConsoleView view;
+ try {
+ view = (IConsoleView) page.showView(id);
+ view.display(myConsole);
+ } catch (PartInitException e) {
+ return;
+ }
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-10-30 00:39:27 UTC (rev 1633)
+++ trunk/org.rubypeople.rdt.astviewer/src/org/rubypeople/rdt/astviewer/views/ViewContentProvider.java 2006-10-31 12:27:07 UTC (rev 1634)
@@ -118,9 +118,8 @@
lexerSource = new LexerSource(getFile().getName(), new InputStreamReader(getFile().getContents()));
return parser.parse(lexerSource).getAST();
} catch (CoreException e) {
- e.printStackTrace();
+ return null;
}
- return null;
}
private void initialize() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-30 00:39:32
|
Revision: 1633
http://svn.sourceforge.net/rubyeclipse/?rev=1633&view=rev
Author: cawilliams
Date: 2006-10-29 16:39:27 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
add test for syntax which used to result in infinite loop bug
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2006-10-30 00:39:00 UTC (rev 1632)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2006-10-30 00:39:27 UTC (rev 1633)
@@ -23,6 +23,11 @@
return partitioner.getContentType(offset);
}
+ public void testUnclosedInterpolationDoesntInfinitelyLoop() {
+ String source = "%[\"#{\"]";
+ this.getContentType(source, 0);
+ assert(true);
+ }
public void testPartitioningOfSingleLineComment() {
String source = "# This is a comment\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-30 00:39:08
|
Revision: 1632
http://svn.sourceforge.net/rubyeclipse/?rev=1632&view=rev
Author: cawilliams
Date: 2006-10-29 16:39:00 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
fix broken build
Modified Paths:
--------------
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/parser/ShamNode.java
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 2006-10-29 23:34:23 UTC (rev 1631)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyCodeAnalyzer.java 2006-10-30 00:39:00 UTC (rev 1632)
@@ -36,7 +36,7 @@
file = new ShamFile(FILENAME);
file.setContents(FILE_CONTENTS);
- rootNode = new Node(null) {
+ rootNode = new Node(null, 0) {
public Instruction accept(NodeVisitor visitor) {
return null;
}
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/parser/ShamNode.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/parser/ShamNode.java 2006-10-29 23:34:23 UTC (rev 1631)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/parser/ShamNode.java 2006-10-30 00:39:00 UTC (rev 1632)
@@ -19,7 +19,7 @@
public class ShamNode extends Node {
public ShamNode() {
- super(null);
+ super(null, 0);
}
public Instruction accept(NodeVisitor visitor) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-10-29 23:34:28
|
Revision: 1631
http://svn.sourceforge.net/rubyeclipse/?rev=1631&view=rev
Author: mbarchfe
Date: 2006-10-29 15:34:23 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
use symblink to cc dir
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh 2006-10-29 23:32:49 UTC (rev 1630)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/startCCForRDT.sh 2006-10-29 23:34:23 UTC (rev 1631)
@@ -1,4 +1,4 @@
-#!/bin/bash
-Xvfb :1 &
-export DISPLAY=localhost:1
-~/cruisecontrol-bin-2.5/cruisecontrol.sh -webport 8080 -jmxport 8000 $@
+#!/bin/bash
+Xvfb :1 &
+export DISPLAY=localhost:1
+~/cruisecontrol/cruisecontrol.sh -webport 8080 -jmxport 8000 $@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2006-10-29 23:33:00
|
Revision: 1630
http://svn.sourceforge.net/rubyeclipse/?rev=1630&view=rev
Author: mbarchfe
Date: 2006-10-29 15:32:49 -0800 (Sun, 29 Oct 2006)
Log Message:
-----------
update to align status file with webapp
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/config.xml
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2006-10-27 21:44:17 UTC (rev 1629)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/config.xml 2006-10-29 23:32:49 UTC (rev 1630)
@@ -23,7 +23,7 @@
<!-- more recent versions of CC should use the listener below, instead of the currentbuildstatusbootstrapper, currentbuildstatuspublisher combination. NOTE: Must match filename in CC reporting/jsp - override.properties: user.build.status.file -->
<listeners>
- <currentbuildstatuslistener file="logs/RDT/buildstatus.txt"/>
+ <currentbuildstatuslistener file="logs/RDT/status.txt"/>
</listeners>
<!-- Publishers are run *after* a build completes -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-27 21:44:23
|
Revision: 1629
http://svn.sourceforge.net/rubyeclipse/?rev=1629&view=rev
Author: cawilliams
Date: 2006-10-27 14:44:17 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
apply Shugo Maeda's patch to externalize the surround with begin/rescue action's text
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2006-10-27 21:44:17 UTC (rev 1629)
@@ -0,0 +1,22 @@
+package org.rubypeople.rdt.ui.actions;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ActionMessages {
+ private static final String BUNDLE_NAME = "org.rubypeople.rdt.ui.actions.ActionMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private ActionMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties 2006-10-27 21:44:17 UTC (rev 1629)
@@ -0,0 +1,3 @@
+SurroundWithBeginRescueAction.label=Surround with begin...rescue
+SurroundWithBeginRescueAction.error=Error occurred while surrounding code with begin..rescue block
+SurroundWithBeginRescueAction.dialog.title=Surround with begin...rescue
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2006-10-25 02:08:20 UTC (rev 1628)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2006-10-27 21:44:17 UTC (rev 1629)
@@ -41,7 +41,7 @@
public SurroundWithBeginRescueAction(RubyEditor editor) {
super(editor.getEditorSite());
- setText("Surround with begin...rescue");
+ setText(ActionMessages.getString("SurroundWithBeginRescueAction.label")); //$NON-NLS-1$
fEditor = editor;
setEnabled((fEditor != null && SelectionConverter.getInputAsRubyScript(fEditor) != null));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
@@ -52,15 +52,13 @@
try {
createChange(selection, new NullProgressMonitor());
} catch (CoreException e) {
- // FIXME Localize! Extract into ResourceBundle
ExceptionHandler.handle(e, getDialogTitle(),
- "Error occurred while surrounding code with begin..rescue block");
+ ActionMessages.getString("SurroundWithBeginRescueAction.error")); //$NON-NLS-1$
}
}
private static String getDialogTitle() {
- // FIXME Localize! Extract into ResourceBundle
- return "Surround with begin...rescue";
+ return ActionMessages.getString("SurroundWithBeginRescueAction.dialog.title"); //$NON-NLS-1$
}
private IFile getFile() {
@@ -113,19 +111,19 @@
Indents.getIndentWidth(options));
StringBuffer text = new StringBuffer();
- text.append("begin");
+ text.append("begin");//$NON-NLS-1$
text.append(lineDelimiter);
text.append(Indents.createIndentString(indentationUnits + 1, options));
text.append(originalText);
text.append(lineDelimiter);
text.append(Indents.createIndentString(indentationUnits, options));
- text.append("rescue StandardError => e");
+ text.append("rescue StandardError => e");//$NON-NLS-1$
text.append(lineDelimiter);
text.append(Indents.createIndentString(indentationUnits + 1, options));
- text.append("puts e");
+ text.append("puts e");//$NON-NLS-1$
text.append(lineDelimiter);
text.append(Indents.createIndentString(indentationUnits, options));
- text.append("end");
+ text.append("end");//$NON-NLS-1$
text.append(lineDelimiter);
text.append(Indents.createIndentString(indentationUnits, options));
return text.toString();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-25 02:08:24
|
Revision: 1628
http://svn.sourceforge.net/rubyeclipse/?rev=1628&view=rev
Author: cawilliams
Date: 2006-10-24 19:08:20 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
Property Changed:
----------------
trunk/org.jruby/lib/jruby.jar
Property changes on: trunk/org.jruby/lib/jruby.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-25 02:08:01
|
Revision: 1627
http://svn.sourceforge.net/rubyeclipse/?rev=1627&view=rev
Author: cawilliams
Date: 2006-10-24 19:07:26 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
update to trunk of JRuby (which is supposed to have the latest parser changes and position fixes), fix some things that break because of it, remove unused imports
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtPosition.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/TypeInferenceHelper.java
Added Paths:
-----------
trunk/org.jruby/lib/jruby.jar
Removed Paths:
-------------
trunk/org.jruby/lib/jruby.jar
Deleted: trunk/org.jruby/lib/jruby.jar
===================================================================
(Binary files differ)
Added: trunk/org.jruby/lib/jruby.jar
===================================================================
--- trunk/org.jruby/lib/jruby.jar (rev 0)
+++ trunk/org.jruby/lib/jruby.jar 2006-10-25 02:07:26 UTC (rev 1627)
@@ -0,0 +1,5112 @@
+PK
+ |
|
From: <caw...@us...> - 2006-10-25 02:06:26
|
Revision: 1626
http://svn.sourceforge.net/rubyeclipse/?rev=1626&view=rev
Author: cawilliams
Date: 2006-10-24 19:06:21 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
fix references to annotation layers (they were using jdt names, not rdt)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java 2006-10-25 01:42:14 UTC (rev 1625)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java 2006-10-25 02:06:21 UTC (rev 1626)
@@ -473,9 +473,9 @@
static {
AnnotationPreferenceLookup lookup= EditorsUI.getAnnotationPreferenceLookup();
TASK_LAYER= computeLayer("org.eclipse.ui.workbench.texteditor.task", lookup); //$NON-NLS-1$
- INFO_LAYER= computeLayer("org.eclipse.jdt.ui.info", lookup); //$NON-NLS-1$
- WARNING_LAYER= computeLayer("org.eclipse.jdt.ui.warning", lookup); //$NON-NLS-1$
- ERROR_LAYER= computeLayer("org.eclipse.jdt.ui.error", lookup); //$NON-NLS-1$
+ INFO_LAYER= computeLayer("org.rubypeople.rdt.ui.info", lookup); //$NON-NLS-1$
+ WARNING_LAYER= computeLayer("org.rubypeople.rdt.ui.warning", lookup); //$NON-NLS-1$
+ ERROR_LAYER= computeLayer("org.rubypeople.rdt.ui.error", lookup); //$NON-NLS-1$
}
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
@@ -719,8 +719,8 @@
/**
- * Annotation model dealing with java marker annotations and temporary problems.
- * Also acts as problem requester for its compilation unit. Initially inactive. Must explicitly be
+ * Annotation model dealing with ruby marker annotations and temporary problems.
+ * Also acts as problem requester for its ruby script. Initially inactive. Must explicitly be
* activated.
*/
protected static class RubyScriptAnnotationModel extends ResourceMarkerAnnotationModel implements IProblemRequestor, IProblemRequestorExtension {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-25 01:42:22
|
Revision: 1625
http://svn.sourceforge.net/rubyeclipse/?rev=1625&view=rev
Author: cawilliams
Date: 2006-10-24 18:42:14 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
when adding a warning marker, use proper line and offset info (don't just always add to beginning of file)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProblemRequestorMarkerManager.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProblemRequestorMarkerManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProblemRequestorMarkerManager.java 2006-10-25 01:35:52 UTC (rev 1624)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProblemRequestorMarkerManager.java 2006-10-25 01:42:14 UTC (rev 1625)
@@ -5,10 +5,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.IProblemRequestor;
import org.rubypeople.rdt.core.parser.IProblem;
-import org.rubypeople.rdt.internal.core.parser.RdtPosition;
import org.rubypeople.rdt.internal.core.parser.TaskTag;
public class ProblemRequestorMarkerManager implements IProblemRequestor {
@@ -29,7 +27,7 @@
// TODO Use active flag by calling begin and end reporting
// if (!isActive()) return;
if (problem.isWarning()) {
- markerManager.addWarning(file, problem.getMessage());
+ markerManager.addWarning(file, problem.getMessage(), problem.getSourceLineNumber(), problem.getSourceStart(), problem.getSourceEnd());
return;
}
if (problem.isError()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-25 01:35:59
|
Revision: 1624
http://svn.sourceforge.net/rubyeclipse/?rev=1624&view=rev
Author: cawilliams
Date: 2006-10-24 18:35:52 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
use prefix of completion offset to filter down possibilities, use proper replacement start offset
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2006-10-18 01:33:14 UTC (rev 1623)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2006-10-25 01:35:52 UTC (rev 1624)
@@ -3,12 +3,9 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
import org.jruby.ast.ClassNode;
import org.jruby.ast.ClassVarAsgnNode;
@@ -35,7 +32,6 @@
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.RubyElement;
-import org.rubypeople.rdt.internal.core.RubyScript;
import org.rubypeople.rdt.internal.core.RubyType;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.ti.DefaultTypeInferrer;
@@ -67,7 +63,7 @@
// if we hit a period, use character before period as offset for
// inferrer
// if we hit a space, use character after space?
- // TODO We need to handle other bad syntax like invoking compeltion right after an @
+ // TODO We need to handle other bad syntax like invoking completion right after an @
StringBuffer prefix = new StringBuffer();
boolean isMethod = false;
for (int i = offset; i >= 0; i--) {
@@ -79,9 +75,7 @@
source.deleteCharAt(i);
offset--;
break;
- }
- // TODO Grab the prefix we just ate up and use it to filter
- // responses?
+ }
offset = i - 1;
break;
}
@@ -92,16 +86,23 @@
prefix.insert(0, curChar);
}
this.prefix = prefix.toString();
+ if (this.prefix != null) replaceStart -= this.prefix.length();
- List<ITypeGuess> guesses = inferrer.infer(source.toString(), offset);
- // TODO Grab the project and all referred projects!
- IRubyProject[] projects = new IRubyProject[1];
- projects[0] = script.getRubyProject();
- RubyElementRequestor completer = new RubyElementRequestor(projects);
- for (Iterator iter = guesses.iterator(); iter.hasNext();) {
- ITypeGuess guess = (ITypeGuess) iter.next();
- IType type = completer.findType(guess.getType());
- suggestMethods(replaceStart, completer, guess, type);
+ // If the prefix looks like a constant don't bother searching for
+ // methods
+ if (!(this.prefix != null && Character.isUpperCase(this.prefix
+ .charAt(0)))) {
+ List<ITypeGuess> guesses = inferrer
+ .infer(source.toString(), offset);
+ // TODO Grab the project and all referred projects!
+ IRubyProject[] projects = new IRubyProject[1];
+ projects[0] = script.getRubyProject();
+ RubyElementRequestor completer = new RubyElementRequestor(projects);
+ for (Iterator iter = guesses.iterator(); iter.hasNext();) {
+ ITypeGuess guess = (ITypeGuess) iter.next();
+ IType type = completer.findType(guess.getType());
+ suggestMethods(replaceStart, completer, guess, type);
+ }
}
// FIXME Do we need to call this at all if we know it's a method call we're trying to complete?
if (!isMethod) getDocumentsRubyElementsInScope(script, source.toString(), offset, replaceStart);
@@ -137,17 +138,11 @@
IMethod[] methods = type.getMethods();
for (int k = 0; k < methods.length; k++) {
IMethod method = methods[k];
- String name = method.getElementName();
-
- if (prefix != null && prefix.length() != 0) {
- // If we have a prefix, then don't suggest non-matches
- if (!name.startsWith(prefix)) continue;
- }
+ String name = method.getElementName();
+ if (prefix != null && !name.startsWith(prefix)) continue;
CompletionProposal proposal = new CompletionProposal(
CompletionProposal.METHOD_REF, name, confidence);
- // TODO Handle replacement start index correctly
- proposal
- .setReplaceRange(replaceStart, replaceStart + name.length());
+ proposal.setReplaceRange(replaceStart, replaceStart + name.length());
int flags = Flags.AccDefault;
if (method.isSingleton()) {
flags |= Flags.AccStatic;
@@ -205,11 +200,11 @@
List locals = Arrays.asList (scopeNode.getLocalNames());
for (Iterator iter = locals.iterator(); iter.hasNext();) {
String local = (String) iter.next();
+ if (prefix != null && !local.startsWith(prefix)) continue;
CompletionProposal proposal = new CompletionProposal(
CompletionProposal.LOCAL_VARIABLE_REF, local, 100);
- // TODO Handle replacement start index correctly
proposal.setReplaceRange(replaceStart, replaceStart + local.length());
- requestor.accept(proposal);
+ requestor.accept(proposal);
}
}
}
@@ -252,15 +247,13 @@
for (int x = 0; x < elements.length; x++) {
IRubyElement child = elements[x];
for (int i = 0; i < types.length; i++) {
- if (child.getElementType() == types[i]) {
- String name = child.getElementName();
- CompletionProposal proposal = new CompletionProposal(
- getCompletionProposalType(child), name, 100);
- // TODO Handle replacement start index correctly
- proposal.setReplaceRange(replaceStart, replaceStart + name.length());
- requestor.accept(proposal);
- break;
- }
+ if (child.getElementType() != types[i]) continue;
+ String name = child.getElementName();
+ if (prefix != null && !name.startsWith(prefix)) continue;
+ CompletionProposal proposal = new CompletionProposal(
+ getCompletionProposalType(child), name, 100);
+ proposal.setReplaceRange(replaceStart, replaceStart + name.length());
+ requestor.accept(proposal);
}
if (child instanceof IParent)
getElementsOfType((IParent) child, types, replaceStart);
@@ -355,12 +348,12 @@
// Get the unique names of instance and class variables
for ( Node varNode : instanceAndClassVars ) {
String name = getNameReflectively(varNode);
- if ( name != null ) {
- CompletionProposal proposal = new CompletionProposal(CompletionProposal.FIELD_REF, name, 100);
- // TODO Handle replacement start index correctly
- proposal.setReplaceRange(replaceStart, replaceStart + name.length());
- requestor.accept(proposal);
- }
+ if ( name == null ) continue;
+ if (prefix != null && !name.startsWith(prefix)) continue;
+
+ CompletionProposal proposal = new CompletionProposal(CompletionProposal.FIELD_REF, name, 100);
+ proposal.setReplaceRange(replaceStart, replaceStart + name.length());
+ requestor.accept(proposal);
}
}
@@ -375,8 +368,8 @@
if ( methodDefinition instanceof DefnNode ) { name = ((DefnNode)methodDefinition).getName(); }
if ( methodDefinition instanceof DefsNode ) { name = ((DefsNode)methodDefinition).getName(); }
if (name == null) continue;
+ if (prefix != null && !name.startsWith(prefix)) continue;
CompletionProposal proposal = new CompletionProposal(CompletionProposal.METHOD_REF, name, 100);
- // TODO Handle replacement start index correctly
proposal.setReplaceRange(replaceStart, replaceStart + name.length());
requestor.accept(proposal);
}
@@ -385,8 +378,8 @@
List<String> attrs = AttributeLocator.Instance().findInstanceAttributesInScope(typeNode);
for (Iterator iter = attrs.iterator(); iter.hasNext(); ) {
String attr = (String) iter.next();
+ if (prefix != null && !attr.startsWith(prefix)) continue;
CompletionProposal proposal = new CompletionProposal(CompletionProposal.FIELD_REF, attr, 100);
- // TODO Handle replacement start index correctly
proposal.setReplaceRange(replaceStart, replaceStart + attr.length());
requestor.accept(proposal);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2006-10-18 01:33:18
|
Revision: 1623
http://svn.sourceforge.net/rubyeclipse/?rev=1623&view=rev
Author: cawilliams
Date: 2006-10-17 18:33:14 -0700 (Tue, 17 Oct 2006)
Log Message:
-----------
patch up a nasty infinite loop bug (#198) - its still very ugly hacky code, but that particular example works now
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/PercentSyntaxRule.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/PercentSyntaxRule.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/PercentSyntaxRule.java 2006-10-18 00:54:14 UTC (rev 1622)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/PercentSyntaxRule.java 2006-10-18 01:33:14 UTC (rev 1623)
@@ -23,7 +23,7 @@
case 'W': // Array of strings
scanner.unread();
scanner.unread();
- // FIXME Mark teh individual elements as strings
+ // FIXME Mark the individual elements as strings
return Token.UNDEFINED;
default: // special case of string (no letter following percent)
scanner.unread();
@@ -43,18 +43,21 @@
c = scanner.read();
// FIXME This is a big hack. Expression substitution actually needs to be returned as normal ruby code (and repartitioned)
if ((char) c == '#') { // Try to handle expression substitution
- char d = (char) scanner.read();
- if (d == '{') {
+ int d = scanner.read();
+ if ((char) d == '{') {
// read until '}'
do {
- d = (char)scanner.read();
- } while (d != '}');
+ d = scanner.read();
+ if (d == ICharacterScanner.EOF) {
+ return new Token(tokenType);
+ }
+ } while ((char) d != '}');
continue;
- } else if (d == '@' || d == '$') {
+ } else if ((char) d == '@' || (char) d == '$') {
// read until whitespace
do {
- d = (char) scanner.read();
- } while (d != ' ');
+ d = scanner.read();
+ } while ((char) d != ' ');
continue;
} else {// not expression subst.
scanner.unread();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|