Improved patch to jde-wiz.el (for deep inner-class names)

"Jeff Peck" <[email protected]>
Newsgroups gmane.emacs.jdee.devel
Message-ID <191D8B0C0C6D4CA1B7BDC0B682C8AB5E@blue>
Improved patch to jde-wiz.el, so implement-interface can find deeply nested class/interface.
(recurse, replacing last '.' with '$' until class is found)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
jdee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jdee-devel
jde-wiz.patch (application/octet-stream, 1.6 KB)
Index: lisp/jde-wiz.el
===================================================================
--- lisp/jde-wiz.el	(revision 164)
+++ lisp/jde-wiz.el	(working copy)
@@ -125,12 +125,9 @@
 	    (insert (concat " " keyword " " interface " "))))))))
 
 (defun jde-dollar-name (name) 
-  "Convert pkg.Outer.Inner to pkg.Outer$Inner"
-  (let* ((ndx (string-match "^\\(.*\\)\\.\\([^.]*\\)$" name ))
-	 (pkg (substring name (match-beginning 1) (match-end 1)))
-	 (cls (substring name (match-beginning 2) (match-end 2))))
-    (concat pkg "$" cls))
-  )
+  "Convert pkg[.Outer].Inner[$Inner] to pkg[.Outer]$Inner[$Inner]"
+  ;; change last '.' to '$'
+  (replace-in-string name "[.]\\([^.]+$\\)" "$\\1"))  
 
 (defun jde-jeval-classname (fmt interface-name &optional eval-return)
   "Try jde-jeval on the command derived from (format FMT INTERFACE-NAME),
@@ -141,11 +138,15 @@
   (flet ((jeval (name) (if eval-return
 			   (jde-jeval (format fmt name) t)
 			 (read (jde-jeval (format fmt name))))))
-    (let ((code (jeval interface-name)))
-      (if (and code (eq (car code) 'error))
-	  (jeval (jde-dollar-name interface-name)); try again if there was an error:
+    (let ((code (jeval interface-name)) dollar-name)
+      (if (and code (eq (car code) 'error)
+	       (setq dollar-name (jde-dollar-name interface-name))
+	       ;; recurse as long as '.'s are changing:
+	       (not (eq dollar-name interface-name)))
+	  (jde-jeval-classname fmt dollar-name eval-return) ; try again with dollar-name
 	code)
-      )))
+      )
+    ))
 
 (defun jde-wiz-generate-interface (interface-name)
   "*Generate a skeleton implementation of a specified interface."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.