|
From: <caw...@us...> - 2007-02-10 20:21:35
|
Revision: 1945
http://svn.sourceforge.net/rubyeclipse/?rev=1945&view=rev
Author: cawilliams
Date: 2007-02-10 12:21:33 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
an instance method is actually "static"/class-level if it is a constructor. Don't show instance level methods when it looks like we're invoking completion on the type
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionContext.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionContext.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionContext.java 2007-02-10 20:00:17 UTC (rev 1944)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionContext.java 2007-02-10 20:21:33 UTC (rev 1945)
@@ -124,4 +124,8 @@
return !emptyPrefix() && !isMethodInvokation() && getPartialPrefix().startsWith("$");
}
+ public boolean fullPrefixIsConstant() {
+ return Character.isUpperCase(getFullPrefix().charAt(0));
+ }
+
}
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-02-10 20:00:17 UTC (rev 1944)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-02-10 20:21:33 UTC (rev 1945)
@@ -150,9 +150,14 @@
int flags = Flags.AccDefault;
if (method.isSingleton()) {
flags |= Flags.AccStatic;
- name = name.substring(typeName.length() + 1);
+ if (method.isConstructor())
+ name = "new";
+ else
+ name = name.substring(typeName.length() + 1);
} else {
-// FIXME Don't show instance methods if the thing we're working on is a constant (class name)!
+ // 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 (context.fullPrefixIsConstant()) return;
}
if (!context.prefixStartsWith(name))
return;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java 2007-02-10 20:00:17 UTC (rev 1944)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyMethod.java 2007-02-10 20:21:33 UTC (rev 1945)
@@ -101,6 +101,7 @@
* @see org.rubypeople.rdt.core.IRubyMethod#getVisibility()
*/
public int getVisibility() throws RubyModelException {
+ if (isConstructor()) return IMethod.PUBLIC;
RubyMethodElementInfo info = (RubyMethodElementInfo) getElementInfo();
return info.getVisibility();
}
@@ -110,7 +111,7 @@
}
public boolean isSingleton() {
- return false;
+ return isConstructor();
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|