espera...@cumego.com (Przemysław Wojnowski) writes:

> Thanks for implementing it.
>
> I have version from repository, had a few minutes to play with it:
> 1. It would be nice if jdibug-run-main-class could be calculated in
> run-time when not set and use class from current buffer in such case.
>
> 2. IMHO Jdibug could build classpath like jde-db-classpath-arg does.
>

I've implemented it, so that JDibug can start from current JDEE buffer
and uses it's class if jdibug-run-main-class is not set.

Regards,
Przemek

Index: jdibug-run.el
===================================================================
--- jdibug-run.el	(revision 411)
+++ jdibug-run.el	(working copy)
@@ -69,15 +69,14 @@
 and the application arguments are `jdibug-run-application-args'"
   (interactive)
 
-  (unless (stringp jdibug-run-main-class)
-	(error "jdibug-run-main-class must be a string"))
-
-  (let* ((name (concat "*" jdibug-run-main-class "*"))
+  (let* ((main-class (jdibug-run-get-main-class))
+		(name (concat "*" main-class "*"))
 		(buffer (get-buffer-create name))
 		(args (append (jdibug-run-server-args)
-					  jdibug-run-jvm-args
-					  (list jdibug-run-main-class)
+					  (jdibug-run-get-jvm-args)
+					  (list main-class)
 					  jdibug-run-application-args)))
+
 	;; Remove any old output from the buffer
 	(pop-to-buffer buffer)
 	(erase-buffer)
@@ -118,4 +117,34 @@
 		  (format "-Xrunjdwp:transport=dt_socket,address=%s,server=y,suspend=y"
 				  port))))
 
+(defun jdibug-run-get-main-class ()
+  "Returns main class to run, which is `jdibug-run-main-class' or one from
+current buffer."
+  (if (and (stringp jdibug-run-main-class)
+	   (not (string= "" jdibug-run-main-class)))
+      jdibug-run-main-class
+    (jde-parse-get-buffer-class)))
+
+(defun jdibug-run-get-jvm-args ()
+  "Returns args which will be passed to JVM."
+  (jdibug-run-classpath-arg))
+
+;; copy of jde-db-classpath-arg method
+(defun jdibug-run-classpath-arg ()
+  "Generate the -classpath command line argument for jdibug."
+
+  ;; Set the classpath option. Use the local
+  ;; classpath, if set; otherwise, the global
+  ;; classpath.
+  (let ((classpath
+	 (if jde-db-option-classpath
+	     jde-db-option-classpath
+	   jde-global-classpath))
+	(symbol
+	 (if jde-db-option-classpath
+	     'jde-db-option-classpath
+	   'jde-global-classpath)))
+    (if classpath
+	(list "-classpath" (jde-build-classpath classpath symbol)))))
+
 (provide 'jdibug-run)
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
jdee-devel mailing list
jdee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jdee-devel

Reply via email to