* many improvements
+ fixed bug with incorrect tcltest goto test definition,
+ new utility class to put source modules into ast cache, and to receive them from it.
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyTypeDocumentationProvider.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyTypeDocumentationProvider.java
index 5fad018..3b19bd0 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyTypeDocumentationProvider.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyTypeDocumentationProvider.java
@@ -3,16 +3,14 @@
import java.io.Reader;
import java.io.StringReader;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
-import org.eclipse.dltk.core.DLTKLanguageManager;
import org.eclipse.dltk.core.IMember;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ISourceRange;
import org.eclipse.dltk.core.ModelException;
-import org.eclipse.dltk.ruby.core.RubyNature;
+import org.eclipse.dltk.core.SourceParserUtil;
import org.eclipse.dltk.ruby.internal.parsers.jruby.ASTUtils;
import org.eclipse.dltk.ruby.typeinference.RubyClassType;
import org.eclipse.dltk.ti.BasicContext;
@@ -30,9 +28,7 @@
.getAncestor(IModelElement.SOURCE_MODULE);
if (module != null) {
try {
- ModuleDeclaration unit = DLTKLanguageManager.getSourceParser(
- RubyNature.NATURE_ID).parse(
- module.getPath().toString().toCharArray(), module.getSourceAsCharArray(), null);
+ ModuleDeclaration unit = SourceParserUtil.getModuleDeclaration(module, null);
ISourceRange sourceRange = element.getSourceRange();
ASTNode minimalNode = ASTUtils.findMinimalNode(unit,
sourceRange.getOffset(), sourceRange.getOffset()
@@ -49,8 +45,6 @@
}
} catch (ModelException e) {
e.printStackTrace();
- } catch (CoreException e) {
- e.printStackTrace();
}
}
return null;
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
index 3030908..8bbcf2f 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.ILog;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.ISourceParser;
+import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.DLTKLanguageManager;
import org.eclipse.dltk.ruby.core.RubyNature;
import org.eclipse.dltk.ruby.internal.ui.RubyUI;
@@ -22,93 +23,96 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
+public class RubyFoldingStructureProvider extends
+ AbstractASTFoldingStructureProvider {
-public class RubyFoldingStructureProvider extends AbstractASTFoldingStructureProvider {
+ /* preferences */
+ private boolean fInitCollapseComments = true;
+ private boolean fInitCollapseBlocks = true;
+ private boolean fInitCollapseClasses = true;
- /* preferences */
- private boolean fInitCollapseComments = true;
- private boolean fInitCollapseBlocks = true;
- private boolean fInitCollapseClasses = true;
+ protected void initializePreferences(IPreferenceStore store) {
+ super.initializePreferences(store);
+ fFoldNewLines = true;
+ fInitCollapseBlocks = false;
+ fInitCollapseComments = true;
+ fInitCollapseClasses = false;
+ }
- protected void initializePreferences(IPreferenceStore store) {
- super.initializePreferences(store);
- fFoldNewLines = true;
- fInitCollapseBlocks = false;
- fInitCollapseComments = true;
- fInitCollapseClasses = false;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initiallyCollapse(org.eclipse.dltk.ast.statements.Statement,
+ * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
+ */
+ protected boolean initiallyCollapse(ASTNode s,
+ FoldingStructureComputationContext ctx) {
+ return false;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initiallyCollapse(org.eclipse.dltk.ast.statements.Statement, org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
- */
- protected boolean initiallyCollapse(ASTNode s,
- FoldingStructureComputationContext ctx) {
- return false;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initiallyCollapseComments(org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
+ */
+ protected boolean initiallyCollapseComments(
+ FoldingStructureComputationContext ctx) {
+ return ctx.allowCollapsing() && fInitCollapseComments;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#initiallyCollapseComments(org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
- */
- protected boolean initiallyCollapseComments(
- FoldingStructureComputationContext ctx) {
- return ctx.allowCollapsing() && fInitCollapseComments;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#mayCollapse(org.eclipse.dltk.ast.statements.Statement,
+ * org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
+ */
+ protected boolean mayCollapse(ASTNode s,
+ FoldingStructureComputationContext ctx) {
+ return true;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#mayCollapse(org.eclipse.dltk.ast.statements.Statement, org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider.FoldingStructureComputationContext)
- */
- protected boolean mayCollapse(ASTNode s,
- FoldingStructureComputationContext ctx) {
- return true;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getCommentPartitionType()
+ */
+ protected String getCommentPartition() {
+ return RubyPartitions.RUBY_COMMENT;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getCommentPartitionType()
- */
- protected String getCommentPartition() {
- return RubyPartitions.RUBY_COMMENT;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartition()
+ */
+ protected String getPartition() {
+ return RubyPartitions.RUBY_PARTITIONING;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartition()
- */
- protected String getPartition() {
- return RubyPartitions.RUBY_PARTITIONING;
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionScanner()
+ */
+ protected IPartitionTokenScanner getPartitionScanner() {
+ return new RubyPartitionScanner();
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionScanner()
- */
- protected IPartitionTokenScanner getPartitionScanner() {
- return new RubyPartitionScanner();
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionTypes()
+ */
+ protected String[] getPartitionTypes() {
+ return RubyPartitions.RUBY_PARTITION_TYPES;
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getPartitionTypes()
- */
- protected String[] getPartitionTypes() {
- return RubyPartitions.RUBY_PARTITION_TYPES;
- }
-
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getSourceParser()
- */
- protected ISourceParser getSourceParser() {
-// return new JRubySourceParser(null);
- try {
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getSourceParser()
+ */
+ protected ISourceParser getSourceParser() {
+ // return new JRubySourceParser(null);
+ try {
return DLTKLanguageManager.getSourceParser(RubyNature.NATURE_ID);
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (DLTKCore.DEBUG) {
+ e.printStackTrace();
+ }
}
return null;
- }
+ }
- /*
- * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getLog()
- */
- protected ILog getLog() {
- return RubyUI.getDefault().getLog();
- }
+ /*
+ * @see org.eclipse.dltk.ui.text.folding.AbstractASTFoldingStructureProvider#getLog()
+ */
+ protected ILog getLog() {
+ return RubyUI.getDefault().getLog();
+ }
}