Hello,
Ironically enough, the method ecb-jde-display-class-at-point shows the same behaviour
as Sandip's code when I invoke it with point in the variable logger in class B.
public class A {
protected Logger logger = new Logger();
public A() {
}
public String toString() {
logger.debug("A.toString() invoked.");
return "A";
}
}
public class B extends A {
public B() {
}
public String toString() {
logger.debug("B.toString() invoked.");
// ^-- invoke ecb-jde-display-class-at-point here
return "B";
}
}
If I invoke ecb-jde-display-class-at-point with point inside logger in the toString
method of class A, all is well and I get:
Logger [-]
Varia... [+]
Logger()
Logger(String)
void debug(String)
void debug(String,Throwable)
void error(String)
void error(String,Throwable)
void info(String)
void info(String,Throwable)
void warn(String)
void warn(String,Throwable)
Invoking ecb-jde-display-class-at-point with point inside logger in B's toString
method will show
B [-]
Parents [+]
+ B()
+ String toString()
Is this a semantic problem?
Cheers,
Karel
-----Original Message-----
From: Berndl, Klaus [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 19, 2003 11:07
To: 'Sandip Chitale'; [EMAIL PROTECTED]
Subject: RE: Introspection based Java class browser....also demonstrates alittle bit
of java and lisp integration...
Hello,
attached is a small library ecb-jde.el which enables you to display
the contents of class at point in the method-window of ECB:
(defun ecb-jde-display-class-at-point ()
"Displays in the ECB-methods-buffer the contents \(methods, attributes
etc...) of the class which contains the definition of the \"thing\" under
point \(this can be a variablename, classname, methodname, attributename).
This function needs the same requirements to work as the method-completion
feature of JDE \(see `jde-complete-at-point')!. The source-file is searched
first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH,
then in current-directory."
(interactive)
...
)
Just do:
1. Save ecb-jde.el somewhere in your load-path - probably best in the
ecb-directory ;-)
2. Activate ECB
3. Open a java-source
4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET
5. Try it.
Differences to Sandips code:
- uses ECB method-window to display the class-contents
- uses semantic for getting the contents of a class
- needs the source-file of the class to work
The first point can be seen as advantage or disadvantage ;-)
Especially the latter point is a disadvantage because it prevents
from working for classes which are only available as *.class-file or
within a jar-file...
But it demonstrates another elegant way of displaying things of a class
under point without needing java-introspection.
Klaus
-----Original Message-----
From: Sandip Chitale [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 19, 2003 7:32 AM
To: [EMAIL PROTECTED]
Subject: Introspection based Java class browser....also demonstrates alittle bit of
java and lisp integration...
>To use :
>1. unzip the attached zip at in the jde directory
>2. Just put the following in your .emacs
>(require 'jde-introspect)
>Now put the point anywhere in Java buffer where you would
>normally invoke jde-complete functions. Then type
>(control c) (control v) (/) to see the java typeinfo
>buffer.
>For example:
>With point in the 'System' below :
>public class Foo {
> public static void main(String[] args) {
> System.out.println(args.length);
> }
>}
>here is what you get in a temp buffer. All the java class names are
>hyperlinks (activated by
>mouse or <RET> key).
>class java.lang.System