|
From: <caw...@us...> - 2007-02-07 18:15:14
|
Revision: 1936
http://svn.sourceforge.net/rubyeclipse/?rev=1936&view=rev
Author: cawilliams
Date: 2007-02-07 10:15:08 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
when adding a new RubyClass, check for already existing versions of it in model. If one exists, then increment our occurence count so we're viewed as a different object. This has the by-product of fixing Bug # 215
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java 2007-02-07 18:12:48 UTC (rev 1935)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java 2007-02-07 18:15:08 UTC (rev 1936)
@@ -133,6 +133,8 @@
import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.util.ASTUtil;
@@ -495,6 +497,12 @@
String name = getFullyQualifiedName(iVisited.getCPath());
RubyType handle = new RubyType(modelStack.peek(), name);
+ RubyElement parent = modelStack.peek();
+ RubyType existing = (RubyType) findChild(parent, IRubyElement.TYPE, name);
+ if (existing != null) {
+ // FIXME Should we just increment the occurence count like I do here, or should we conglomerate the types into one LogicalType?
+ handle.occurrenceCount = existing.occurrenceCount + 1;
+ }
modelStack.push(handle);
RubyElementInfo parentInfo = infoStack.peek();
@@ -508,9 +516,6 @@
String superClass = getSuperClassName(iVisited.getSuperNode());
info.setSuperclassName(superClass);
- // FIXME Types do not explicitly include Kernel; if this is solely for completions, then Kernel elements are gotten elsewhere.
- // FIXME If this must include Kernel, then completions will have to handle this differently than current. (Otherwise dupes of Kernel elements will show up when bringing together Class & its Superclass completions?)
-// info.setIncludedModuleNames(new String[] { "Kernel" });
info.setIncludedModuleNames(new String[] {});
infoStack.push(info);
@@ -525,6 +530,18 @@
return null;
}
+ private RubyType findChild(RubyElement parent, int type, String name) {
+ try {
+ ArrayList<IRubyElement> children = parent.getChildrenOfType(type);
+ for (IRubyElement element : children) {
+ if (element.getElementName().equals(name)) return (RubyType) element;
+ }
+ } catch (RubyModelException e) {
+ RubyCore.log(e);
+ }
+ return null;
+ }
+
/**
* Build up the fully qualified name of the super class for a class
* declaration
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|