Hi Yigal,
I tried the "what's this" feature on the class that you sent me.
It works fine for me, i.e., when point is in a method, it displays
[M:methodName], when point is in class, [C:className], and when it
is outside a class [???]. This feature uses an Emacs hook function.
If an error occurs in any of the hook functions, Emacs stops
invoking the hook functions. This would cause the feature to
appear to stop working.
Paul
Yigal Hochberg writes:
>
> Paul,
>
> I started to use your jde mode for Java development in emacs. Thank
> you for the excellent work.
>
> I would like to display the current class and method on the mode-line
> in [].
>
> Some of the times it works ok, some other times it does not display
> anything just [???] Even when the cursor is inside a method inside a
> class.
>
> Some of the times it displays only the method but not the class it is
> in.
>
> I use a very simple file to check this feature. See below.
>
> Regards,
>
>
> --
> - Yigal
>
>
> ===File ~/java/hello.java===================================
> /* Last edit: Fri Mar 25 09:34:59 2005
> */
>
> public class hello {
>
> /**
> * main entry
> */
> public static void main(String[] args) {
>
> Throwable t = new Throwable();
>
> StackTraceElement thisOne = t.getStackTrace()[0];
> String myMethod = thisOne.getMethodName();
> String myClass = thisOne.getClassName();
>
> String s = "world";
> String arg0 = "no-args";
> if (args.length > 0)
> arg0 = args[0];
>
> int x;
> x = 5;
> System.out.println("args=" +arg0 +" hello " +s +" x=" +x);
> System.out.println("class=" +myClass +" method=" +myMethod);
> System.out.println(getCurrentMethodName() +"hello");
> }
>
> /**
> * Gets the name of the class and method that called this method to
> stdout
> *
> * @return String the name of the class and method that called this
> method.
> */
> public static String getCurrentMethodName() {
>
> Throwable t = new Throwable();
> StackTraceElement thisOne = t.getStackTrace()[1];
> String myMethod = thisOne.getMethodName();
> String myClass = thisOne.getClassName();
> return myClass +"/" +myMethod +"():";
> }
>
>
> } // class hello
>
>
> /*
> * Local Variables:
> * compile-command: "c:\\Progra~1\\Java\\jdk1.4.2_04\\bin\\javac -g
> hello.java"
> * End:
> */ // end hello()
>
> ============================================================
>