You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: <caw...@us...> - 2007-08-17 15:38:10
|
Revision: 2997
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2997&view=rev
Author: cawilliams
Date: 2007-08-17 08:38:07 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
by default don't warn about constant naming and method naming conventions
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java 2007-08-17 15:25:46 UTC (rev 2996)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LintOptions.java 2007-08-17 15:38:07 UTC (rev 2997)
@@ -50,10 +50,8 @@
| AssignmentPrecedence
| SubclassDoesntCallSuper
| MethodMissingWithoutRespondTo
- | ConstantNamingConvention
| DynamicVariableAliasesLocal
| LocalVariablePossibleAttributeAccess
- | LocalMethodNamingConvention
/*| NullReference -- keep RubyCore#getDefaultOptions comment in sync */;
public int maxLocals = 5;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-17 15:25:47
|
Revision: 2996
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2996&view=rev
Author: cawilliams
Date: 2007-08-17 08:25:46 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
mark some code as deprecated
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/MultipleFileCompiler.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/SingleFileCompiler.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/MultipleFileCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/MultipleFileCompiler.java 2007-08-17 15:21:56 UTC (rev 2995)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/MultipleFileCompiler.java 2007-08-17 15:25:46 UTC (rev 2996)
@@ -6,6 +6,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+/**
+ * @deprecated Please use CompilationParticipant infrastructure
+ * @author Chris Williams
+ *
+ */
public interface MultipleFileCompiler {
public void compileFile(List<IFile> file, IProgressMonitor monitor) throws CoreException;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/SingleFileCompiler.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/SingleFileCompiler.java 2007-08-17 15:21:56 UTC (rev 2995)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/SingleFileCompiler.java 2007-08-17 15:25:46 UTC (rev 2996)
@@ -15,6 +15,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+/**
+ * @deprecated Please use CompilationParticipant infrastructure
+ * @author Chris Williams
+ *
+ */
public interface SingleFileCompiler {
public void compileFile(IFile file) throws CoreException;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-17 15:21:58
|
Revision: 2995
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2995&view=rev
Author: cawilliams
Date: 2007-08-17 08:21:56 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
fix #5580 - Warnings from CompilationParticipant subclasses aren't get set as markers on files
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/compiler/CompilationParticipantResult.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/compiler/CompilationParticipantResult.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/compiler/CompilationParticipantResult.java 2007-08-17 15:03:31 UTC (rev 2994)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/compiler/CompilationParticipantResult.java 2007-08-17 15:21:56 UTC (rev 2995)
@@ -44,4 +44,8 @@
return this.resource.toString();
}
+public CategorizedProblem[] getProblems() {
+ return problems;
}
+
+}
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 2007-08-17 15:03:31 UTC (rev 2994)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/AbstractRdtCompiler.java 2007-08-17 15:21:56 UTC (rev 2995)
@@ -8,6 +8,12 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.compiler.BuildContext;
+import org.rubypeople.rdt.core.compiler.CategorizedProblem;
+import org.rubypeople.rdt.core.compiler.CompilationParticipant;
+import org.rubypeople.rdt.internal.core.RubyModelManager;
import org.rubypeople.rdt.internal.core.util.ListUtil;
public abstract class AbstractRdtCompiler {
@@ -52,6 +58,7 @@
monitor.worked(filesToClear);
compileFiles(files, monitor);
+
monitor.done();
}
@@ -62,7 +69,7 @@
if (monitor.isCanceled())
return;
compiler.compileFile(list, monitor);
- }
+ }
for (IFile file : list) {
if (monitor.isCanceled())
return;
@@ -70,9 +77,37 @@
monitor.subTask(file.getFullPath().toString());
compileFile(file, monitor);
}
+ BuildContext[] contexts = getBuildContexts(list);
+ CompilationParticipant[] participants = RubyModelManager.getRubyModelManager().compilationParticipants.getCompilationParticipants(getRubyProject());
+ if (participants != null) {
+ for (int i = 0; i < participants.length; i++) {
+ if (monitor.isCanceled())
+ return;
+ participants[i].buildStarting(contexts, true);
+ }
+ }
+ for (int i = 0; i < contexts.length; i++) {
+ CategorizedProblem[] problems = contexts[i].getProblems();
+ if (problems == null || problems.length == 0) continue;
+ for (int j = 0; j < problems.length; j++) {
+ markerManager.addProblem(contexts[i].getFile(), problems[j]);
+ }
+ }
}
- private void compileFile(IFile file, IProgressMonitor monitor) throws CoreException {
+ private BuildContext[] getBuildContexts(List<IFile> list) {
+ List<BuildContext> contexts = new ArrayList<BuildContext>();
+ for (IFile file : list) {
+ contexts.add(new BuildContext(file));
+ }
+ return contexts.toArray(new BuildContext[contexts.size()]);
+ }
+
+ private IRubyProject getRubyProject() {
+ return RubyCore.create(project);
+ }
+
+ private void compileFile(IFile file, IProgressMonitor monitor) throws CoreException {
for (Iterator<SingleFileCompiler> cIter = singleFileCompilers.iterator(); cIter.hasNext();) {
SingleFileCompiler fileCompiler = cIter.next();
fileCompiler.compileFile(file);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-17 15:03:33
|
Revision: 2994
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2994&view=rev
Author: cawilliams
Date: 2007-08-17 08:03:31 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
fix #5513 - Task tag markers are displayed twice per task
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-08-17 14:24:41 UTC (rev 2993)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-08-17 15:03:31 UTC (rev 2994)
@@ -616,7 +616,11 @@
// Don't accept the problem if a marker already exists for this same problem...
try {
IResource resource = workingCopy.getUnderlyingResource();
- IMarker marker = MarkerUtility.markerExists(resource, problem.getMessage(), problem.getSourceLineNumber(), IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
+ String markerType = IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER;
+ if (problem.isTask()) {
+ markerType = IRubyModelMarker.TASK_MARKER;
+ }
+ IMarker marker = MarkerUtility.markerExists(resource, problem.getMessage(), problem.getSourceLineNumber(), markerType);
if (marker != null) return;
} catch (RubyModelException e) {
// ignore
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-17 14:24:55
|
Revision: 2993
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2993&view=rev
Author: cawilliams
Date: 2007-08-17 07:24:41 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
add a bunch of missing strings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-08-16 15:57:50 UTC (rev 2992)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-08-17 14:24:41 UTC (rev 2993)
@@ -147,6 +147,30 @@
ActionDefinition.openTypeHierarchy.name= Open Type Hierarchy
ActionDefinition.openTypeHierarchy.description= Open a type hierarchy on the selected element
+ActionDefinition.showInPackageView.name= Show in Ruby Resources
+ActionDefinition.showInPackageView.description= Show the selected element in the Ruby Resources view
+
+#--- Search menu
+ActionDefinition.referencesInWorkspace.name= References in Workspace
+ActionDefinition.referencesInWorkspace.description= Search for references to the selected element in the workspace
+
+ActionDefinition.referencesInProject.name= References in Project
+ActionDefinition.referencesInProject.description= Search for references to the selected element in the enclosing project
+
+ActionDefinition.referencesInWorkingSet.name= References in Working Set
+ActionDefinition.referencesInWorkingSet.description= Search for references to the selected element in a working set
+
+ActionDefinition.readAccessInworkspace.name= Read Access in Workspace
+ActionDefinition.readAccessInWorkspace.description= Search for read references to the selected element in the workspace
+
+ActionDefinition.readAccessInProject.name= Read Access in Project
+ActionDefinition.readAccessInProject.description= Search for read references to the selected element in the enclosing project
+
+ActionDefinition.readAccessInWorkingSet.name= Read Access in Working Set
+ActionDefinition.readAccessInWorkingSet.description= Search for read references to the selected element in a working set
+
+
+
scope.rubyEditor.name=Ruby Editor
scope.rubyEditor.description=Ruby Editor
@@ -186,6 +210,12 @@
codeFormatterPrefName=Formatter
##########################################################################
+# Open Action set
+##########################################################################
+OpenActionSet.label= Ruby Open Actions
+OpenActionSet.description= Action set containing open actions for Ruby
+
+##########################################################################
# Navigate Menu
##########################################################################
OpenAction.label=&Open
@@ -196,4 +226,22 @@
OpenTypeHierarchyAction.label=Ope&n Type Hierarchy
OpenTypeInHierarchyAction.label=Open Type in Hierarch&y...
-OpenTypeInHierarchyAction.tooltip=Opens a Type in a Type Hierarchy
\ No newline at end of file
+OpenTypeInHierarchyAction.tooltip=Opens a Type in a Type Hierarchy
+
+##########################################################################
+# Coding Action set
+##########################################################################
+CodingActionSet.label= Ruby Coding
+CodingActionSet.description= Action set containing coding related Ruby actions
+
+
+#--- Commands for surfacing ruby elements
+command.openElementInEditor.name= Open Ruby Element
+command.openElementInEditor.desc= Open a Ruby element in its editor
+commandParameter.openElementInEditor.elementRef.name= Ruby element reference
+command.showElementInPackageView.name= Show Ruby Element in Ruby Resources
+command.showElementInPackageView.desc= Select Ruby element in the Ruby Resources view
+commandParameter.showElementInPackageView.elementRef.name= Ruby element reference
+command.showElementInTypeHierarchyView.name= Show Ruby Element Type Hierarchy
+command.showElementInTypeHierarchyView.desc= Show a Ruby element in the Type Hierarchy view
+commandParameter.showElementInTypeHierarchyView.elementRef.name= Ruby element reference
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-16 15:57:52
|
Revision: 2992
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2992&view=rev
Author: cawilliams
Date: 2007-08-16 08:57:50 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
add quick fix for method_missing without respond_to? warning
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MethodMissingWithoutRespondTo.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MethodMissingWithoutRespondTo.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MethodMissingWithoutRespondTo.java 2007-08-16 15:57:45 UTC (rev 2991)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MethodMissingWithoutRespondTo.java 2007-08-16 15:57:50 UTC (rev 2992)
@@ -12,7 +12,8 @@
public class MethodMissingWithoutRespondTo extends RubyLintVisitor {
- private static final String RESPOND_TO = "respond_to";
+ public static final int PROBLEM_ID = 1234569;
+ private static final String RESPOND_TO = "respond_to?";
private static final String METHOD_MISSING = "method_missing";
private Map<String, DefnNode> methods = new HashMap<String, DefnNode>();
@@ -40,5 +41,10 @@
methods.clear();
super.exitClassNode(iVisited);
}
+
+ @Override
+ protected int getProblemID() {
+ return PROBLEM_ID;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-16 15:57:47
|
Revision: 2991
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2991&view=rev
Author: cawilliams
Date: 2007-08-16 08:57:45 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
add quick fix for method_missing without respond_to? warning
Modified Paths:
--------------
trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/CorrectionProposal.java
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
Modified: trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF 2007-08-16 15:57:38 UTC (rev 2990)
+++ trunk/com.aptana.rdt.ui/META-INF/MANIFEST.MF 2007-08-16 15:57:45 UTC (rev 2991)
@@ -12,6 +12,8 @@
org.rubypeople.rdt.core,
com.aptana.rdt,
org.rubypeople.rdt.ui,
- org.rubypeople.rdt.launching
+ org.rubypeople.rdt.launching,
+ org.jruby,
+ org.rubypeople.rdt.refactoring
Eclipse-LazyStart: true
Export-Package: com.aptana.rdt.internal.ui.preferences
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/CorrectionProposal.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/CorrectionProposal.java 2007-08-16 15:57:38 UTC (rev 2990)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/CorrectionProposal.java 2007-08-16 15:57:45 UTC (rev 2991)
@@ -19,7 +19,7 @@
@Override
public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
IDocument document= viewer.getDocument();
- apply(document, trigger, offset);
+ apply(document, trigger, getReplacementOffset());
}
}
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java 2007-08-16 15:57:38 UTC (rev 2990)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java 2007-08-16 15:57:45 UTC (rev 2991)
@@ -18,8 +18,12 @@
}
public static void addReplacementProposal(String replacement, String display, IProblemLocation problem, Collection<IRubyCompletionProposal> proposals) {
+ addReplacementProposal(problem.getOffset(), problem.getLength(), replacement, display, proposals);
+ }
+
+ public static void addReplacementProposal(int offset, int length, String replacement, String display, Collection<IRubyCompletionProposal> proposals) {
Image image= RubyPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- CorrectionProposal proposal = new CorrectionProposal(replacement, problem.getOffset(), problem.getLength(), image, display, 100);
+ CorrectionProposal proposal = new CorrectionProposal(replacement, offset, length, image, display, 100);
proposals.add(proposal);
}
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-16 15:57:38 UTC (rev 2990)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-16 15:57:45 UTC (rev 2991)
@@ -3,16 +3,31 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.jruby.ast.ClassNode;
+import org.jruby.ast.DefnNode;
+import org.jruby.ast.ModuleNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.visitor.rewriter.DefaultFormatHelper;
+import org.jruby.ast.visitor.rewriter.FormatHelper;
+import org.jruby.ast.visitor.rewriter.ReWriteVisitor;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.compiler.IProblem;
+import org.rubypeople.rdt.core.formatter.Indents;
+import org.rubypeople.rdt.internal.formatter.IndentationState;
+import org.rubypeople.rdt.internal.ti.util.ClosestSpanningNodeLocator;
+import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
+import org.rubypeople.rdt.internal.ui.rubyeditor.ASTProvider;
+import org.rubypeople.rdt.refactoring.core.NodeFactory;
import org.rubypeople.rdt.ui.text.ruby.IInvocationContext;
import org.rubypeople.rdt.ui.text.ruby.IProblemLocation;
import org.rubypeople.rdt.ui.text.ruby.IQuickFixProcessor;
import org.rubypeople.rdt.ui.text.ruby.IRubyCompletionProposal;
import com.aptana.rdt.internal.parser.warnings.ConstantNamingConvention;
+import com.aptana.rdt.internal.parser.warnings.MethodMissingWithoutRespondTo;
import com.aptana.rdt.internal.parser.warnings.MisspelledConstructorVisitor;
public class QuickFixProcessor implements IQuickFixProcessor {
@@ -55,9 +70,46 @@
String constName = src.substring(problem.getOffset(), problem.getOffset() + problem.getLength());
LocalCorrectionsSubProcessor.addReplacementProposal(constName.toUpperCase(), "Convert to all uppercase", problem, proposals);
break;
+ case MethodMissingWithoutRespondTo.PROBLEM_ID:
+ // FIXME Only do this stuff when we apply the proposal! Don't do all this work just to create the proposal...
+ script = context.getRubyScript();
+ src = script.getSource();
+ int offset = 0;
+ Node rootNode = ASTProvider.getASTProvider().getAST(script, ASTProvider.WAIT_YES, null);
+ Node typeNode = ClosestSpanningNodeLocator.Instance().findClosestSpanner(rootNode, problem.getOffset(), new INodeAcceptor() {
+
+ public boolean doesAccept(Node node) {
+ return node instanceof ClassNode || node instanceof ModuleNode;
+ }
+
+ });
+ if (typeNode instanceof ClassNode) {
+ ClassNode classNode = (ClassNode) typeNode;
+ offset = classNode.getBodyNode().getPosition().getStartOffset();
+ } else if (typeNode instanceof ModuleNode) {
+ ModuleNode classNode = (ModuleNode) typeNode;
+ offset = classNode.getBodyNode().getPosition().getStartOffset();
+ }
+ DefnNode methodNode = NodeFactory.createMethodNode("respond_to?", new String[] {"symbol", "include_private = false"}, null);
+ Node insert = NodeFactory.createBlockNode(true, NodeFactory.createNewLineNode(methodNode));
+ String text = ReWriteVisitor.createCodeFromNode(insert, src, getFormatHelper());
+ // Figure out indent at offset and apply that to each line of text and at end of text
+ String line = src.substring(0, src.indexOf("\n", offset));
+ line = line.substring(line.lastIndexOf("\n") + 1);
+ Map options = script.getRubyProject().getOptions(true);
+ String indent = Indents.extractIndentString(line, options);
+ text = indent + text;
+ text = text.replaceAll("\\n", "\n" + indent);
+ text = text + "\n";
+ LocalCorrectionsSubProcessor.addReplacementProposal(offset, 0, text, "Add respond_to? method stub", proposals);
+ break;
default:
}
}
+
+ protected FormatHelper getFormatHelper() {
+ return new DefaultFormatHelper();
+ }
public boolean hasCorrections(IRubyScript unit, int problemId) {
switch (problemId) {
@@ -67,6 +119,7 @@
case IProblem.ArgumentIsNeverUsed:
case MisspelledConstructorVisitor.PROBLEM_ID:
case ConstantNamingConvention.PROBLEM_ID:
+ case MethodMissingWithoutRespondTo.PROBLEM_ID:
return true;
default:
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-16 15:57:41
|
Revision: 2990
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2990&view=rev
Author: cawilliams
Date: 2007-08-16 08:57:38 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
add quick fix for method_missing without respond_to? warning
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java 2007-08-15 20:57:22 UTC (rev 2989)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java 2007-08-16 15:57:38 UTC (rev 2990)
@@ -269,4 +269,8 @@
return ch == '\n' || ch == '\r';
}
+ public static String extractIndentString(String line, Map options) {
+ return extractIndentString(line, getTabWidth(options), getIndentWidth(options));
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 20:57:24
|
Revision: 2989
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2989&view=rev
Author: cawilliams
Date: 2007-08-15 13:57:22 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCompletionProposal.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCompletionProposal.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCompletionProposal.java 2007-08-15 19:33:05 UTC (rev 2988)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCompletionProposal.java 2007-08-15 20:57:22 UTC (rev 2989)
@@ -69,17 +69,6 @@
*/
protected boolean isValidPrefix(String prefix) {
String word= getDisplayString();
- if (isInRubydoc()) {
- int idx = word.indexOf("{@link "); //$NON-NLS-1$
- if (idx==0) {
- word = word.substring(7);
- } else {
- idx = word.indexOf("{@value "); //$NON-NLS-1$
- if (idx==0) {
- word = word.substring(8);
- }
- }
- }
return isPrefix(prefix, word);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 19:33:09
|
Revision: 2988
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2988&view=rev
Author: cawilliams
Date: 2007-08-15 12:33:05 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
add some hacky quick fixes for mis-spelled constructor method and constant that isn't all upper case
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ConstantNamingConvention.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ConstantNamingConvention.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ConstantNamingConvention.java 2007-08-15 19:32:59 UTC (rev 2987)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ConstantNamingConvention.java 2007-08-15 19:33:05 UTC (rev 2988)
@@ -2,12 +2,16 @@
import org.jruby.ast.ConstDeclNode;
import org.jruby.evaluator.Instruction;
+import org.jruby.lexer.yacc.IDESourcePosition;
+import org.jruby.lexer.yacc.ISourcePosition;
import org.rubypeople.rdt.core.parser.warnings.RubyLintVisitor;
import com.aptana.rdt.AptanaRDTPlugin;
public class ConstantNamingConvention extends RubyLintVisitor {
+ public static final int PROBLEM_ID = 1234568;
+
public ConstantNamingConvention(String contents) {
super(contents);
}
@@ -21,9 +25,16 @@
public Instruction visitConstDeclNode(ConstDeclNode iVisited) {
String name = iVisited.getName();
if (!name.toUpperCase().equals(name)) {
- createProblem(iVisited.getPosition(), "Constant name doesn't match ALL_CAPS_WITH_UNDERSCORES convention: " + name);
+ ISourcePosition pos = iVisited.getPosition();
+ IDESourcePosition duh = new IDESourcePosition("", pos.getStartLine(), pos.getEndLine(), pos.getStartOffset(), pos.getStartOffset() + name.length() - 1);
+ createProblem(duh, "Constant name doesn't match ALL_CAPS_WITH_UNDERSCORES convention: " + name);
}
return super.visitConstDeclNode(iVisited);
}
+
+ @Override
+ protected int getProblemID() {
+ return PROBLEM_ID;
+ }
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-08-15 19:32:59 UTC (rev 2987)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-08-15 19:33:05 UTC (rev 2988)
@@ -8,6 +8,8 @@
public class MisspelledConstructorVisitor extends RubyLintVisitor {
+ public static final int PROBLEM_ID = 1234567;
+
public MisspelledConstructorVisitor(String contents) {
super(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
@@ -27,6 +29,6 @@
@Override
protected int getProblemID() {
- return 1234567;
+ return PROBLEM_ID;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 19:33:00
|
Revision: 2987
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2987&view=rev
Author: cawilliams
Date: 2007-08-15 12:32:59 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
add some hacky quick fixes for mis-spelled constructor method and constant that isn't all upper case
Modified Paths:
--------------
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java 2007-08-15 19:12:37 UTC (rev 2986)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java 2007-08-15 19:32:59 UTC (rev 2987)
@@ -17,4 +17,10 @@
proposals.add(proposal);
}
+ public static void addReplacementProposal(String replacement, String display, IProblemLocation problem, Collection<IRubyCompletionProposal> proposals) {
+ Image image= RubyPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ CorrectionProposal proposal = new CorrectionProposal(replacement, problem.getOffset(), problem.getLength(), image, display, 100);
+ proposals.add(proposal);
+ }
+
}
Modified: trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java
===================================================================
--- trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-15 19:12:37 UTC (rev 2986)
+++ trunk/com.aptana.rdt.ui/src/com/aptana/rdt/internal/ui/text/correction/QuickFixProcessor.java 2007-08-15 19:32:59 UTC (rev 2987)
@@ -12,6 +12,9 @@
import org.rubypeople.rdt.ui.text.ruby.IQuickFixProcessor;
import org.rubypeople.rdt.ui.text.ruby.IRubyCompletionProposal;
+import com.aptana.rdt.internal.parser.warnings.ConstantNamingConvention;
+import com.aptana.rdt.internal.parser.warnings.MisspelledConstructorVisitor;
+
public class QuickFixProcessor implements IQuickFixProcessor {
public IRubyCompletionProposal[] getCorrections(IInvocationContext context, IProblemLocation[] locations) throws CoreException {
@@ -19,7 +22,7 @@
return null;
}
- HashSet handledProblems = new HashSet(locations.length);
+ HashSet<Integer> handledProblems = new HashSet<Integer>(locations.length);
ArrayList<IRubyCompletionProposal> resultingCollections = new ArrayList<IRubyCompletionProposal>();
for (int i = 0; i < locations.length; i++) {
IProblemLocation curr = locations[i];
@@ -43,6 +46,15 @@
case IProblem.ArgumentIsNeverUsed:
LocalCorrectionsSubProcessor.addUnusedMemberProposal(context, problem, proposals);
break;
+ case MisspelledConstructorVisitor.PROBLEM_ID:
+ LocalCorrectionsSubProcessor.addReplacementProposal("initialize\n", "Rename to 'initialize'", problem, proposals);
+ break;
+ case ConstantNamingConvention.PROBLEM_ID:
+ IRubyScript script = context.getRubyScript();
+ String src = script.getSource();
+ String constName = src.substring(problem.getOffset(), problem.getOffset() + problem.getLength());
+ LocalCorrectionsSubProcessor.addReplacementProposal(constName.toUpperCase(), "Convert to all uppercase", problem, proposals);
+ break;
default:
}
}
@@ -53,6 +65,8 @@
case IProblem.UnusedPrivateField:
case IProblem.LocalVariableIsNeverUsed:
case IProblem.ArgumentIsNeverUsed:
+ case MisspelledConstructorVisitor.PROBLEM_ID:
+ case ConstantNamingConvention.PROBLEM_ID:
return true;
default:
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 19:12:39
|
Revision: 2986
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2986&view=rev
Author: cawilliams
Date: 2007-08-15 12:12:37 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
when putting problems into ReconcileContext, presever already existing problems
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-15 19:12:15 UTC (rev 2985)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/RubyRedLint.java 2007-08-15 19:12:37 UTC (rev 2986)
@@ -29,8 +29,24 @@
RootNode node = context.getAST();
if (node == null) return;
node.accept(visitor);
- List<CategorizedProblem> problems = visitor.getProblems();
- context.putProblems(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER, problems.toArray(new CategorizedProblem[problems.size()]));
+ List<CategorizedProblem> problems = visitor.getProblems();
+ CategorizedProblem[] oldProblems = context.getProblems(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
+ if (oldProblems == null || oldProblems.length == 0) {
+ context.putProblems(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER, problems.toArray(new CategorizedProblem[problems.size()]));
+ } else {
+ CategorizedProblem[] combined = new CategorizedProblem[problems
+ .size()
+ + oldProblems.length];
+ for (int i = 0; i < oldProblems.length; i++) {
+ combined[i] = oldProblems[i];
+ }
+ int j = oldProblems.length;
+ for (CategorizedProblem problem : problems) {
+ combined[j++] = problem;
+ }
+ context.putProblems(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER,
+ combined);
+ }
} catch (RubyModelException e) {
AptanaRDTPlugin.log(e);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 19:12:17
|
Revision: 2985
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2985&view=rev
Author: cawilliams
Date: 2007-08-15 12:12:15 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
only highlight method name, not full method body when complaining of possibly mis-spelled constructor
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-08-15 17:39:48 UTC (rev 2984)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-08-15 19:12:15 UTC (rev 2985)
@@ -15,7 +15,7 @@
public Instruction visitDefnNode(DefnNode iVisited) {
String methodName = iVisited.getName();
if (methodName.equals("intialize") || methodName.equals("initialise") || methodName.equals("initalize")) {
- createProblem(iVisited.getPosition(), "Possible mis-spelling of constructor");
+ createProblem(iVisited.getNameNode().getPosition(), "Possible mis-spelling of constructor");
}
return null;
}
@@ -25,4 +25,8 @@
return AptanaRDTPlugin.COMPILER_PB_MISSPELLED_CONSTRUCTOR;
}
+ @Override
+ protected int getProblemID() {
+ return 1234567;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 17:39:49
|
Revision: 2984
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2984&view=rev
Author: cawilliams
Date: 2007-08-15 10:39:48 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java 2007-08-15 17:36:01 UTC (rev 2983)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java 2007-08-15 17:39:48 UTC (rev 2984)
@@ -115,4 +115,8 @@
return this.getValueString() ;
}
+ public RubyVariable getOwner() {
+ return owner;
+ }
+
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:36:01 UTC (rev 2983)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:39:48 UTC (rev 2984)
@@ -113,7 +113,13 @@
* @see org.eclipse.debug.core.model.IValueModification#setValue(IValue)
*/
public void setValue(IValue value) throws DebugException {
- setValue(value.getValueString());
+ if (value instanceof RubyValue) {
+ RubyValue val = (RubyValue) value;
+ RubyVariable var = val.getOwner();
+ setValue(var.getName()); // just do a basic assignment
+ } else {
+ setValue(value.getValueString());
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 17:36:03
|
Revision: 2983
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2983&view=rev
Author: cawilliams
Date: 2007-08-15 10:36:01 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
massage the value strings for RubyValues
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java 2007-08-15 17:18:56 UTC (rev 2982)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyValue.java 2007-08-15 17:36:01 UTC (rev 2983)
@@ -31,10 +31,18 @@
}
public RubyValue(RubyVariable owner, String valueString, String type, boolean hasChildren) {
- this.valueString = valueString ;
- this.owner = owner ;
- this.hasChildren = hasChildren ;
- this.referenceTypeName = type ;
+ this.valueString = valueString;
+ if (type != null && type.equals("String")) {
+ this.valueString = '"' + this.valueString + '"';
+ } else if (this.valueString.startsWith("Empty ")) {
+ this.valueString = this.valueString.substring(6) + "[0]";
+ } else if (this.valueString.endsWith("element(s))")) {
+ int index = this.valueString.substring(0, this.valueString.length() - 11).lastIndexOf("(");
+ this.valueString = this.valueString.substring(0, index).trim() + "[" + this.valueString.substring(index + 1, this.valueString.length() - 11).trim() + "]";
+ }
+ this.owner = owner;
+ this.hasChildren = hasChildren;
+ this.referenceTypeName = type;
}
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:18:56 UTC (rev 2982)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:36:01 UTC (rev 2983)
@@ -113,7 +113,7 @@
* @see org.eclipse.debug.core.model.IValueModification#setValue(IValue)
*/
public void setValue(IValue value) throws DebugException {
- value.getValueString();
+ setValue(value.getValueString());
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 17:18:57
|
Revision: 2982
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2982&view=rev
Author: cawilliams
Date: 2007-08-15 10:18:56 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
first try at #5210 - Allow "change value" in debugger
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
Modified: trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF 2007-08-15 15:49:37 UTC (rev 2981)
+++ trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF 2007-08-15 17:18:56 UTC (rev 2982)
@@ -14,6 +14,7 @@
org.rubypeople.rdt.internal.debug.core.parsing
Require-Bundle: org.eclipse.core.resources,
org.eclipse.debug.core,
+ org.jruby,
org.rubypeople.rdt.core,
org.kxml2,
org.eclipse.core.runtime
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 15:49:37 UTC (rev 2981)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:18:56 UTC (rev 2982)
@@ -1,11 +1,16 @@
package org.rubypeople.rdt.internal.debug.core.model;
import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.jruby.lexer.yacc.SyntaxException;
+import org.rubypeople.rdt.internal.core.parser.RubyParser;
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
//see RubyDebugTarget for the reason why PlatformObject is being extended
public class RubyVariable extends PlatformObject implements IVariable {
@@ -17,7 +22,7 @@
private RubyStackFrame stackFrame;
private String name;
private String objectId;
- private RubyValue value;
+ private IValue value;
private RubyVariable parent;
public RubyVariable(RubyStackFrame stackFrame, String name, String scope) {
@@ -92,26 +97,43 @@
* @see org.eclipse.debug.core.model.IValueModification#setValue(String)
*/
public void setValue(String expression) throws DebugException {
+ try {
+ RubyVariable var = getRubyDebuggerProxy().readInspectExpression(stackFrame, getName() + " = " + expression);
+ this.value = var.getValue();
+ } catch (RubyProcessingException e) {
+ throw new DebugException(new Status(Status.ERROR, RdtDebugCorePlugin.PLUGIN_ID, -1, e.getMessage(), e));
+ }
}
+
+ public RubyDebuggerProxy getRubyDebuggerProxy() {
+ return ((RubyDebugTarget) this.getDebugTarget()).getRubyDebuggerProxy();
+ }
/**
* @see org.eclipse.debug.core.model.IValueModification#setValue(IValue)
*/
public void setValue(IValue value) throws DebugException {
+ value.getValueString();
}
/**
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
public boolean supportsValueModification() {
- return false;
+ return true;
}
/**
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(String)
*/
public boolean verifyValue(String expression) throws DebugException {
- return false;
+ try {
+ RubyParser parser = new RubyParser();
+ parser.parse(expression);
+ } catch (SyntaxException e) {
+ return false;
+ }
+ return true;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 15:49:39
|
Revision: 2981
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2981&view=rev
Author: cawilliams
Date: 2007-08-15 08:49:37 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
be extra paranoid, and capture all exceptions in suggestMethod
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 2007-08-15 15:48:24 UTC (rev 2980)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-08-15 15:49:37 UTC (rev 2981)
@@ -451,56 +451,61 @@
}
private CompletionProposal suggestMethod(IMethod method, String typeName, int confidence) {
- int start = fContext.getReplaceStart();
- String name = method.getElementName();
- int flags = Flags.AccDefault;
- if (method.isSingleton()) {
- flags |= Flags.AccStatic;
- if (method.isConstructor())
- name = CONSTRUCTOR_INVOKE_NAME;
- else {
- if (name.startsWith(typeName)) {
- name = name.substring(typeName.length() + 1);
+ try {
+ int start = fContext.getReplaceStart();
+ String name = method.getElementName();
+ int flags = Flags.AccDefault;
+ if (method.isSingleton()) {
+ flags |= Flags.AccStatic;
+ if (method.isConstructor())
+ name = CONSTRUCTOR_INVOKE_NAME;
+ else {
+ if (name.startsWith(typeName)) {
+ name = name.substring(typeName.length() + 1);
+ }
}
+ } else {
+ // Don't show instance methods if the thing we're working on is a class' name!
+ // FIXME We do want to show if it is a constant, but not a class name
+ if (fContext.fullPrefixIsConstant()) return null;
}
- } else {
- // Don't show instance methods if the thing we're working on is a class' name!
- // FIXME We do want to show if it is a constant, but not a class name
- if (fContext.fullPrefixIsConstant()) return null;
- }
- if (!fContext.prefixStartsWith(name))
- return null;
-
- try {
- switch (method.getVisibility()) {
- case IMethod.PRIVATE:
- flags |= Flags.AccPrivate;
- if (fOriginalType != null && !fOriginalType.getElementName().equals(typeName)) return null; // FIXME We should do a comparison of types, not names
- if (fContext.hasReceiver()) return null; // can't invoke a private method on a receiver
- break;
- case IMethod.PUBLIC:
- flags |= Flags.AccPublic; // FIXME Check if receiver is of same class as method's declaring type, if not, skip this method. (so we can invoke with no receiver inside same class, with explicit self as receiver, or with receiver who has same class).
- break;
- case IMethod.PROTECTED:
- flags |= Flags.AccProtected;
- break;
- default:
- break;
+ if (!fContext.prefixStartsWith(name))
+ return null;
+
+ try {
+ switch (method.getVisibility()) {
+ case IMethod.PRIVATE:
+ flags |= Flags.AccPrivate;
+ if (fOriginalType != null && !fOriginalType.getElementName().equals(typeName)) return null; // FIXME We should do a comparison of types, not names
+ if (fContext.hasReceiver()) return null; // can't invoke a private method on a receiver
+ break;
+ case IMethod.PUBLIC:
+ flags |= Flags.AccPublic; // FIXME Check if receiver is of same class as method's declaring type, if not, skip this method. (so we can invoke with no receiver inside same class, with explicit self as receiver, or with receiver who has same class).
+ break;
+ case IMethod.PROTECTED:
+ flags |= Flags.AccProtected;
+ break;
+ default:
+ break;
+ }
+ } catch (RubyModelException e) {
+ RubyCore.log(e);
+ flags |= Flags.AccPublic;
}
- } catch (RubyModelException e) {
+ CompletionProposal proposal = createProposal(start, CompletionProposal.METHOD_REF, name, confidence, method);
+ proposal.setReplaceRange(start, start + name.length());
+ proposal.setFlags(flags);
+ proposal.setName(name);
+ IType declaringType = method.getDeclaringType();
+ String declaringName = typeName;
+ if (declaringType != null)
+ declaringName = declaringType.getFullyQualifiedName();
+ proposal.setDeclaringType(declaringName);
+ return proposal;
+ } catch (RuntimeException e) {
RubyCore.log(e);
- flags |= Flags.AccPublic;
+ return null;
}
- CompletionProposal proposal = createProposal(start, CompletionProposal.METHOD_REF, name, confidence, method);
- proposal.setReplaceRange(start, start + name.length());
- proposal.setFlags(flags);
- proposal.setName(name);
- IType declaringType = method.getDeclaringType();
- String declaringName = typeName;
- if (declaringType != null)
- declaringName = declaringType.getFullyQualifiedName();
- proposal.setDeclaringType(declaringName);
- return proposal;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 15:48:28
|
Revision: 2980
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2980&view=rev
Author: cawilliams
Date: 2007-08-15 08:48:24 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
avoid NPE
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 2007-08-15 14:40:47 UTC (rev 2979)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-08-15 15:48:24 UTC (rev 2980)
@@ -475,7 +475,7 @@
switch (method.getVisibility()) {
case IMethod.PRIVATE:
flags |= Flags.AccPrivate;
- if (!fOriginalType.getElementName().equals(typeName)) return null; // FIXME We should do a comparison of types, not names
+ if (fOriginalType != null && !fOriginalType.getElementName().equals(typeName)) return null; // FIXME We should do a comparison of types, not names
if (fContext.hasReceiver()) return null; // can't invoke a private method on a receiver
break;
case IMethod.PUBLIC:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 14:40:50
|
Revision: 2979
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2979&view=rev
Author: cawilliams
Date: 2007-08-15 07:40:47 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
move setting PATH in environment array into a protected getEnvironment() method, and use that in both normal runner and debugger run() methods
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-08-15 14:16:41 UTC (rev 2978)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-08-15 14:40:47 UTC (rev 2979)
@@ -89,7 +89,7 @@
String[] cmdLine = new String[arguments.size()];
arguments.toArray(cmdLine);
- String[] envp = config.getEnvironment();
+ String[] envp = getEnvironment(config);
// check for cancellation
if (monitor.isCanceled()) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-15 14:16:41 UTC (rev 2978)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-15 14:40:47 UTC (rev 2979)
@@ -243,24 +243,7 @@
String[] cmdLine= new String[arguments.size()];
arguments.toArray(cmdLine);
- String[] env2;
- String[] envp= config.getEnvironment();
- if (!Platform.getOS().equals(Platform.OS_WIN32)) { // if not on windows, hack to add a basic PATH
- File exe = StandardVMType.findRubyExecutable (fVMInstance
- .getInstallLocation());
- String env = "PATH=" + exe.getParent() + File.pathSeparator
- + "/usr/local/bin" + File.pathSeparator + "/usr/bin" + File.pathSeparator + "PATH";
-
- if (envp != null) {
- env2 = new String[envp.length];
- System.arraycopy(envp, 0, env2, 0, envp.length);
- env2[ envp.length] = env;
- } else {
- env2 = new String[] { env };
- }
- } else {
- env2 = envp;
- }
+ String[] envp = getEnvironment(config);
subMonitor.worked(1);
@@ -272,7 +255,7 @@
subMonitor.subTask(LaunchingMessages.StandardVMRunner_Starting_virtual_machine____3);
Process p= null;
File workingDir = getWorkingDir(config);
- p= exec(cmdLine, workingDir, env2);
+ p= exec(cmdLine, workingDir, envp);
if (p == null) {
return;
}
@@ -289,6 +272,28 @@
subMonitor.done();
}
+ protected String[] getEnvironment(VMRunnerConfiguration config) {
+ String[] envp = config.getEnvironment();
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ return envp;
+ // if not on windows, hack to add a basic PATH
+ File exe = StandardVMType.findRubyExecutable(fVMInstance
+ .getInstallLocation());
+ String env = "PATH=" + exe.getParent() + File.pathSeparator
+ + "/usr/local/bin" + File.pathSeparator + "/usr/bin"
+ + File.pathSeparator + "PATH";
+
+ String[] env2;
+ if (envp != null) {
+ env2 = new String[envp.length];
+ System.arraycopy(envp, 0, env2, 0, envp.length);
+ env2[envp.length] = env;
+ } else {
+ env2 = new String[] { env };
+ }
+ return env2;
+ }
+
protected void addStreamSync(List<String> arguments) {
File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby").append("flush").append(STREAM_FLUSH_SCRIPT));
arguments.add(LOADPATH_SWITCH);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 14:16:43
|
Revision: 2978
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2978&view=rev
Author: cawilliams
Date: 2007-08-15 07:16:41 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
add strings for openTypeHierarchy action
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-08-15 14:03:04 UTC (rev 2977)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-08-15 14:16:41 UTC (rev 2978)
@@ -144,6 +144,9 @@
ActionDefinition.openTypeInHierarchy.name= Open Type in Hierarchy
ActionDefinition.openTypeInHierarchy.description= Open a type in the type hierarchy view
+ActionDefinition.openTypeHierarchy.name= Open Type Hierarchy
+ActionDefinition.openTypeHierarchy.description= Open a type hierarchy on the selected element
+
scope.rubyEditor.name=Ruby Editor
scope.rubyEditor.description=Ruby Editor
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 14:03:09
|
Revision: 2977
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2977&view=rev
Author: cawilliams
Date: 2007-08-15 07:03:04 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
try to avoid null pointer
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java 2007-08-15 14:02:58 UTC (rev 2976)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java 2007-08-15 14:03:04 UTC (rev 2977)
@@ -56,7 +56,8 @@
}
}
try {
- IDocument doc = textViewer.getDocument();
+ IDocument doc = textViewer.getDocument();
+ if (doc == null) return null;
String contentType = null;
if (doc instanceof IDocumentExtension3) {
IDocumentExtension3 extension = (IDocumentExtension3) doc;
@@ -68,8 +69,8 @@
}
if (contentType != null && !contentType.equals(IRubyPartitions.RUBY_DEFAULT)) {
return null;
- }
- String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+ }
+ String symbol = doc.get(hoverRegion.getOffset(), hoverRegion.getLength());
if (symbol != null && (symbol.startsWith("@") || symbol.startsWith("$") || symbol.startsWith(":"))) return null; // don't try class/instance/global variables or symbols
return getRIResult(symbol);
} catch (BadLocationException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 14:03:04
|
Revision: 2976
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2976&view=rev
Author: cawilliams
Date: 2007-08-15 07:02:58 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
move Util class out to externally visible package so we can use it's static methods to read files.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/Util.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -1066,15 +1066,15 @@
"CPContainer SET - setting container\n" + //$NON-NLS-1$
" container path: " + containerPath + '\n' + //$NON-NLS-1$
" projects: {" +//$NON-NLS-1$
- org.rubypeople.rdt.internal.compiler.util.Util.toString(
+ org.rubypeople.rdt.core.util.Util.toString(
affectedProjects,
- new org.rubypeople.rdt.internal.compiler.util.Util.Displayable(){
+ new org.rubypeople.rdt.core.util.Util.Displayable(){
public String displayString(Object o) { return ((IRubyProject) o).getElementName(); }
}) +
"}\n values: {\n" +//$NON-NLS-1$
- org.rubypeople.rdt.internal.compiler.util.Util.toString(
+ org.rubypeople.rdt.core.util.Util.toString(
respectiveContainers,
- new org.rubypeople.rdt.internal.compiler.util.Util.Displayable(){
+ new org.rubypeople.rdt.core.util.Util.Displayable(){
public String displayString(Object o) {
StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$
if (o == null) {
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/Util.java (from rev 2724, trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/Util.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/Util.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -0,0 +1,209 @@
+package org.rubypeople.rdt.core.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+
+import org.rubypeople.rdt.internal.core.util.CharOperation;
+
+public class Util {
+
+ public interface Displayable {
+ public String displayString(Object o);
+ }
+
+ private static final int DEFAULT_READING_SIZE = 8192;
+ public final static String UTF_8 = "UTF-8"; //$NON-NLS-1$
+ public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+
+ public static byte[] getFileByteContent(File file) throws IOException {
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream(file);
+ return getInputStreamAsByteArray(stream, (int) file.length());
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Converts an array of Objects into String.
+ */
+ public static String toString(Object[] objects, Displayable renderer) {
+ if (objects == null) return ""; //$NON-NLS-1$
+ StringBuffer buffer = new StringBuffer(10);
+ for (int i = 0; i < objects.length; i++){
+ if (i > 0) buffer.append(", "); //$NON-NLS-1$
+ buffer.append(renderer.displayString(objects[i]));
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Returns the given input stream's contents as a byte array. If a length is
+ * specified (ie. if length != -1), only length bytes are returned.
+ * Otherwise all bytes in the stream are returned. Note this doesn't close
+ * the stream.
+ *
+ * @throws IOException
+ * if a problem occured reading the stream.
+ */
+ public static byte[] getInputStreamAsByteArray(InputStream stream,
+ int length) throws IOException {
+ byte[] contents;
+ if (length == -1) {
+ contents = new byte[0];
+ int contentsLength = 0;
+ int amountRead = -1;
+ do {
+ int amountRequested = Math.max(stream.available(),
+ DEFAULT_READING_SIZE); // read at least 8K
+
+ // resize contents if needed
+ if (contentsLength + amountRequested > contents.length) {
+ System.arraycopy(contents, 0,
+ contents = new byte[contentsLength
+ + amountRequested], 0, contentsLength);
+ }
+
+ // read as many bytes as possible
+ amountRead = stream.read(contents, contentsLength,
+ amountRequested);
+
+ if (amountRead > 0) {
+ // remember length of contents
+ contentsLength += amountRead;
+ }
+ } while (amountRead != -1);
+
+ // resize contents if necessary
+ if (contentsLength < contents.length) {
+ System.arraycopy(contents, 0,
+ contents = new byte[contentsLength], 0, contentsLength);
+ }
+ } else {
+ contents = new byte[length];
+ int len = 0;
+ int readSize = 0;
+ while ((readSize != -1) && (len != length)) {
+ // See PR 1FMS89U
+ // We record first the read size. In this case len is the actual
+ // read size.
+ len += readSize;
+ readSize = stream.read(contents, len, length - len);
+ }
+ }
+
+ return contents;
+ }
+
+ /**
+ * Converts an array of Objects into String.
+ */
+ public static String toString(Object[] objects) {
+ return toString(objects,
+ new Displayable(){
+ public String displayString(Object o) {
+ if (o == null) return "null"; //$NON-NLS-1$
+ return o.toString();
+ }
+ });
+ }
+
+ /**
+ * Returns the contents of the given file as a char array.
+ * When encoding is null, then the platform default one is used
+ * @throws IOException if a problem occured reading the file.
+ */
+ public static char[] getFileCharContent(File file, String encoding) throws IOException {
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream(file);
+ return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the given input stream's contents as a character array.
+ * If a length is specified (ie. if length != -1), this represents the number of bytes in the stream.
+ * Note this doesn't close the stream.
+ * @throws IOException if a problem occured reading the stream.
+ */
+ public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding)
+ throws IOException {
+ InputStreamReader reader = null;
+ try {
+ reader = encoding == null
+ ? new InputStreamReader(stream)
+ : new InputStreamReader(stream, encoding);
+ } catch (UnsupportedEncodingException e) {
+ // encoding is not supported
+ reader = new InputStreamReader(stream);
+ }
+ char[] contents;
+ int totalRead = 0;
+ if (length == -1) {
+ contents = CharOperation.NO_CHAR;
+ } else {
+ // length is a good guess when the encoding produces less or the same amount of characters than the file length
+ contents = new char[length]; // best guess
+ }
+
+ while (true) {
+ int amountRequested;
+ if (totalRead < length) {
+ // until known length is met, reuse same array sized eagerly
+ amountRequested = length - totalRead;
+ } else {
+ // reading beyond known length
+ int current = reader.read();
+ if (current < 0) break;
+
+ amountRequested = Math.max(stream.available(), DEFAULT_READING_SIZE); // read at least 8K
+
+ // resize contents if needed
+ if (totalRead + 1 + amountRequested > contents.length)
+ System.arraycopy(contents, 0, contents = new char[totalRead + 1 + amountRequested], 0, totalRead);
+
+ // add current character
+ contents[totalRead++] = (char) current; // coming from totalRead==length
+ }
+ // read as many chars as possible
+ int amountRead = reader.read(contents, totalRead, amountRequested);
+ if (amountRead < 0) break;
+ totalRead += amountRead;
+ }
+
+ // Do not keep first character for UTF-8 BOM encoding
+ int start = 0;
+ if (totalRead > 0 && UTF_8.equals(encoding)) {
+ if (contents[0] == 0xFEFF) { // if BOM char then skip
+ totalRead--;
+ start = 1;
+ }
+ }
+
+ // resize contents if necessary
+ if (totalRead < contents.length)
+ System.arraycopy(contents, start, contents = new char[totalRead], 0, totalRead);
+
+ return contents;
+ }
+}
Deleted: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -1,209 +0,0 @@
-package org.rubypeople.rdt.internal.compiler.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-public class Util {
-
- public interface Displayable {
- public String displayString(Object o);
- }
-
- private static final int DEFAULT_READING_SIZE = 8192;
- public final static String UTF_8 = "UTF-8"; //$NON-NLS-1$
- public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
-
- public static byte[] getFileByteContent(File file) throws IOException {
- InputStream stream = null;
- try {
- stream = new FileInputStream(file);
- return getInputStreamAsByteArray(stream, (int) file.length());
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Converts an array of Objects into String.
- */
- public static String toString(Object[] objects, Displayable renderer) {
- if (objects == null) return ""; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer(10);
- for (int i = 0; i < objects.length; i++){
- if (i > 0) buffer.append(", "); //$NON-NLS-1$
- buffer.append(renderer.displayString(objects[i]));
- }
- return buffer.toString();
- }
-
- /**
- * Returns the given input stream's contents as a byte array. If a length is
- * specified (ie. if length != -1), only length bytes are returned.
- * Otherwise all bytes in the stream are returned. Note this doesn't close
- * the stream.
- *
- * @throws IOException
- * if a problem occured reading the stream.
- */
- public static byte[] getInputStreamAsByteArray(InputStream stream,
- int length) throws IOException {
- byte[] contents;
- if (length == -1) {
- contents = new byte[0];
- int contentsLength = 0;
- int amountRead = -1;
- do {
- int amountRequested = Math.max(stream.available(),
- DEFAULT_READING_SIZE); // read at least 8K
-
- // resize contents if needed
- if (contentsLength + amountRequested > contents.length) {
- System.arraycopy(contents, 0,
- contents = new byte[contentsLength
- + amountRequested], 0, contentsLength);
- }
-
- // read as many bytes as possible
- amountRead = stream.read(contents, contentsLength,
- amountRequested);
-
- if (amountRead > 0) {
- // remember length of contents
- contentsLength += amountRead;
- }
- } while (amountRead != -1);
-
- // resize contents if necessary
- if (contentsLength < contents.length) {
- System.arraycopy(contents, 0,
- contents = new byte[contentsLength], 0, contentsLength);
- }
- } else {
- contents = new byte[length];
- int len = 0;
- int readSize = 0;
- while ((readSize != -1) && (len != length)) {
- // See PR 1FMS89U
- // We record first the read size. In this case len is the actual
- // read size.
- len += readSize;
- readSize = stream.read(contents, len, length - len);
- }
- }
-
- return contents;
- }
-
- /**
- * Converts an array of Objects into String.
- */
- public static String toString(Object[] objects) {
- return toString(objects,
- new Displayable(){
- public String displayString(Object o) {
- if (o == null) return "null"; //$NON-NLS-1$
- return o.toString();
- }
- });
- }
-
- /**
- * Returns the contents of the given file as a char array.
- * When encoding is null, then the platform default one is used
- * @throws IOException if a problem occured reading the file.
- */
- public static char[] getFileCharContent(File file, String encoding) throws IOException {
- InputStream stream = null;
- try {
- stream = new FileInputStream(file);
- return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Returns the given input stream's contents as a character array.
- * If a length is specified (ie. if length != -1), this represents the number of bytes in the stream.
- * Note this doesn't close the stream.
- * @throws IOException if a problem occured reading the stream.
- */
- public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding)
- throws IOException {
- InputStreamReader reader = null;
- try {
- reader = encoding == null
- ? new InputStreamReader(stream)
- : new InputStreamReader(stream, encoding);
- } catch (UnsupportedEncodingException e) {
- // encoding is not supported
- reader = new InputStreamReader(stream);
- }
- char[] contents;
- int totalRead = 0;
- if (length == -1) {
- contents = CharOperation.NO_CHAR;
- } else {
- // length is a good guess when the encoding produces less or the same amount of characters than the file length
- contents = new char[length]; // best guess
- }
-
- while (true) {
- int amountRequested;
- if (totalRead < length) {
- // until known length is met, reuse same array sized eagerly
- amountRequested = length - totalRead;
- } else {
- // reading beyond known length
- int current = reader.read();
- if (current < 0) break;
-
- amountRequested = Math.max(stream.available(), DEFAULT_READING_SIZE); // read at least 8K
-
- // resize contents if needed
- if (totalRead + 1 + amountRequested > contents.length)
- System.arraycopy(contents, 0, contents = new char[totalRead + 1 + amountRequested], 0, totalRead);
-
- // add current character
- contents[totalRead++] = (char) current; // coming from totalRead==length
- }
- // read as many chars as possible
- int amountRead = reader.read(contents, totalRead, amountRequested);
- if (amountRead < 0) break;
- totalRead += amountRead;
- }
-
- // Do not keep first character for UTF-8 BOM encoding
- int start = 0;
- if (totalRead > 0 && UTF_8.equals(encoding)) {
- if (contents[0] == 0xFEFF) { // if BOM char then skip
- totalRead--;
- start = 1;
- }
- }
-
- // resize contents if necessary
- if (totalRead < contents.length)
- System.arraycopy(contents, start, contents = new char[totalRead], 0, totalRead);
-
- return contents;
- }
-}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -14,7 +14,7 @@
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.core.WorkingCopyOwner;
-import org.rubypeople.rdt.internal.compiler.util.Util;
+import org.rubypeople.rdt.core.util.Util;
import org.rubypeople.rdt.internal.core.buffer.BufferManager;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -2139,15 +2139,15 @@
"CPContainer SET - missbehaving container\n" + //$NON-NLS-1$
" container path: " + containerPath + '\n' + //$NON-NLS-1$
" projects: {" +//$NON-NLS-1$
- org.rubypeople.rdt.internal.compiler.util.Util.toString(
+ org.rubypeople.rdt.core.util.Util.toString(
projects,
- new org.rubypeople.rdt.internal.compiler.util.Util.Displayable(){
+ new org.rubypeople.rdt.core.util.Util.Displayable(){
public String displayString(Object o) { return ((IRubyProject) o).getElementName(); }
}) +
"}\n values on previous session: {\n" +//$NON-NLS-1$
- org.rubypeople.rdt.internal.compiler.util.Util.toString(
+ org.rubypeople.rdt.core.util.Util.toString(
respectiveContainers,
- new org.rubypeople.rdt.internal.compiler.util.Util.Displayable(){
+ new org.rubypeople.rdt.core.util.Util.Displayable(){
public String displayString(Object o) {
StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$
if (o == null) {
@@ -2166,9 +2166,9 @@
}
}) +
"}\n new values: {\n" +//$NON-NLS-1$
- org.rubypeople.rdt.internal.compiler.util.Util.toString(
+ org.rubypeople.rdt.core.util.Util.toString(
respectiveContainers,
- new org.rubypeople.rdt.internal.compiler.util.Util.Displayable(){
+ new org.rubypeople.rdt.core.util.Util.Displayable(){
public String displayString(Object o) {
StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$
if (o == null) {
@@ -2209,8 +2209,8 @@
if (CP_RESOLVE_VERBOSE){
Util.verbose(
"CPVariable SET - setting variables\n" + //$NON-NLS-1$
- " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(variableNames) + '\n' +//$NON-NLS-1$
- " values: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(variablePaths)); //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.core.util.Util.toString(variableNames) + '\n' +//$NON-NLS-1$
+ " values: " + org.rubypeople.rdt.core.util.Util.toString(variablePaths)); //$NON-NLS-1$
}
if (variablePutIfInitializingWithSameValue(variableNames, variablePaths))
@@ -2315,7 +2315,7 @@
Util.verbose(
"CPVariable SET - updating affected project due to setting variables\n" + //$NON-NLS-1$
" project: " + affectedProject.getElementName() + '\n' + //$NON-NLS-1$
- " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(dbgVariableNames)); //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.core.util.Util.toString(dbgVariableNames)); //$NON-NLS-1$
}
affectedProject
@@ -2336,7 +2336,7 @@
if (CP_RESOLVE_VERBOSE){
Util.verbose(
"CPVariable SET - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$
- " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(dbgVariableNames), //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.core.util.Util.toString(dbgVariableNames), //$NON-NLS-1$
System.err);
e.printStackTrace();
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -1099,7 +1099,7 @@
if (rscFile.exists()) {
byte[] bytes = Util.getResourceContentsAsByteArray(rscFile);
try {
- property = new String(bytes, org.rubypeople.rdt.internal.compiler.util.Util.UTF_8); // .classpath
+ property = new String(bytes, org.rubypeople.rdt.core.util.Util.UTF_8); // .classpath
// always
// encoded
// with
@@ -1123,12 +1123,12 @@
if (file != null && file.exists()) {
byte[] bytes;
try {
- bytes = org.rubypeople.rdt.internal.compiler.util.Util.getFileByteContent(file);
+ bytes = org.rubypeople.rdt.core.util.Util.getFileByteContent(file);
} catch (IOException e) {
return null;
}
try {
- property = new String(bytes, org.rubypeople.rdt.internal.compiler.util.Util.UTF_8); // .classpath
+ property = new String(bytes, org.rubypeople.rdt.core.util.Util.UTF_8); // .classpath
// always
// encoded
// with
@@ -2092,7 +2092,7 @@
IFile rscFile = this.project.getFile(key);
byte[] bytes = null;
try {
- bytes = value.getBytes(org.rubypeople.rdt.internal.compiler.util.Util.UTF_8); // .loadpath
+ bytes = value.getBytes(org.rubypeople.rdt.core.util.Util.UTF_8); // .loadpath
// always
// encoded
// with
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexManager.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -199,7 +199,7 @@
private char[][] readIndexState(String dirOSString) {
try {
- char[] savedIndexNames = org.rubypeople.rdt.internal.compiler.util.Util.getFileCharContent(savedIndexNamesFile, null);
+ char[] savedIndexNames = org.rubypeople.rdt.core.util.Util.getFileCharContent(savedIndexNamesFile, null);
if (savedIndexNames.length > 0) {
char[][] names = CharOperation.splitOn('\n', savedIndexNames);
if (names.length > 1) {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-08-15 13:22:17 UTC (rev 2975)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-08-15 14:02:58 UTC (rev 2976)
@@ -612,7 +612,7 @@
throw new RubyModelException(e);
}
try {
- return org.rubypeople.rdt.internal.compiler.util.Util.getInputStreamAsByteArray(stream, -1);
+ return org.rubypeople.rdt.core.util.Util.getInputStreamAsByteArray(stream, -1);
} catch (IOException e) {
throw new RubyModelException(e, IRubyModelStatusConstants.IO_EXCEPTION);
} finally {
@@ -694,7 +694,7 @@
return lineSeparator;
// system line delimiter
- return org.rubypeople.rdt.internal.compiler.util.Util.LINE_SEPARATOR;
+ return org.rubypeople.rdt.core.util.Util.LINE_SEPARATOR;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-15 13:22:19
|
Revision: 2975
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2975&view=rev
Author: cawilliams
Date: 2007-08-15 06:22:17 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
remove unused messages
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-08-14 17:27:26 UTC (rev 2974)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-08-15 13:22:17 UTC (rev 2975)
@@ -12,9 +12,7 @@
### RubyModel messages.
### hierarchy
-hierarchy_nullProject = Project argument cannot be null
hierarchy_nullRegion = Region cannot be null
-hierarchy_nullFocusType = Type focus cannot be null
hierarchy_creating = Creating type hierarchy...
hierarchy_creatingOnType = Creating type hierarchy on {0}...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-14 17:27:27
|
Revision: 2974
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2974&view=rev
Author: cawilliams
Date: 2007-08-14 10:27:26 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
hack to set up a base PATH environment when launchign ruby process on non-Win32 platforms. We need this to install gems that need to be compiled, as otehrwise it'll complain of missing ruby headers and missing make. This won't cover every case, certainly, but shoudl cover the most common ones (everything needed is in /usr/bin, /usr/local/bin, and parent of ruby executable).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-14 17:25:57 UTC (rev 2973)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-14 17:27:26 UTC (rev 2974)
@@ -243,7 +243,24 @@
String[] cmdLine= new String[arguments.size()];
arguments.toArray(cmdLine);
- String[] envp= config.getEnvironment();
+ String[] env2;
+ String[] envp= config.getEnvironment();
+ if (!Platform.getOS().equals(Platform.OS_WIN32)) { // if not on windows, hack to add a basic PATH
+ File exe = StandardVMType.findRubyExecutable (fVMInstance
+ .getInstallLocation());
+ String env = "PATH=" + exe.getParent() + File.pathSeparator
+ + "/usr/local/bin" + File.pathSeparator + "/usr/bin" + File.pathSeparator + "PATH";
+
+ if (envp != null) {
+ env2 = new String[envp.length];
+ System.arraycopy(envp, 0, env2, 0, envp.length);
+ env2[ envp.length] = env;
+ } else {
+ env2 = new String[] { env };
+ }
+ } else {
+ env2 = envp;
+ }
subMonitor.worked(1);
@@ -255,7 +272,7 @@
subMonitor.subTask(LaunchingMessages.StandardVMRunner_Starting_virtual_machine____3);
Process p= null;
File workingDir = getWorkingDir(config);
- p= exec(cmdLine, workingDir, envp);
+ p= exec(cmdLine, workingDir, env2);
if (p == null) {
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-08-14 17:25:59
|
Revision: 2973
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2973&view=rev
Author: cawilliams
Date: 2007-08-14 10:25:57 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
use sudo when removing a gem
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-14 16:32:40 UTC (rev 2972)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-08-14 17:25:57 UTC (rev 2973)
@@ -500,7 +500,7 @@
&& gem.getVersion().trim().length() > 0) {
command += " " + VERSION_SWITCH + " " + gem.getVersion();
}
- ILaunchConfiguration config = createGemLaunchConfiguration(command, false);
+ ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
Job job = new Job("Notifying gem listeners of uninstalled gem") {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|