>>>>> "Jayakrishnan" == Jayakrishnan Nair <[EMAIL PROTECTED]> writes:

  Jayakrishnan> Hi,

  Jayakrishnan> While writing a large program, I put public static
  Jayakrishnan> void main() in different classes, so that I can run
  Jayakrishnan> them independently. If I need to switch the main
  Jayakrishnan> program, I have to customize jde-run-application-class
  Jayakrishnan> each time. Usually I am switching between a list of
  Jayakrishnan> say 5 programs. So it would be convenient if in the
  Jayakrishnan> customize window I can enter a list and select one
  Jayakrishnan> from that as the main program to run.

  Jayakrishnan> This would save some time.

  Jayakrishnan> Cheers,

  Jayakrishnan> JK

I do this something like this. It makes a menu item then allows you to
set the main class to the current buffer. Or to unset it again. 
I do the same for toggle between different ant programs ("antm" is my
own program so probably this is of no interest to anyone else) and
verbosity level. 

It falls short of what you want but its cheap and cheerful and should
give you the basic functionality you need. 

Cheers

Phil





(defvar jde-more
   (list "JDE+"
        ["Set as main class"        phil-java-set-as-main-class t]
        ["No main class"            phil-java-unset-main-class t]
        ["Toggle ant program"       phil-java-toggle-ant-program t]
        ["Toggle ant verbose"       phil-java-toggle-ant-verbose t]))
     

(easy-menu-do-define 'jde-more jde-mode-map   "Additn Menu for JDE" jde-more)



(defun phil-java-set-as-main-class()
  "Sets the current class as the main class"
  (interactive)
  (let ((main (concat (jde-db-get-package)
                      (file-name-sans-extension 
                       (file-name-nondirectory (buffer-file-name))))))
    (message "Setting %s as main class" main)
    (setq jde-run-application-class main)
    (jde-save-project)))

(defun phil-java-unset-main-class()
  "Sets the current class as the main class"
  (interactive)
  (message "Unsetting main class")
  (setq jde-run-application-class nil)
  (jde-save-project))

(defun phil-java-toggle-ant-program()
  "Toggle between ant/antm" 
  (interactive)
  (cond
   ((equal "ant" jde-ant-program)
    (progn
      (setq jde-ant-program "antm")
      (jde-save-project)
      (message "Setting ant program to antm")))
   ((equal "antm" jde-ant-program)
    (progn
      (setq jde-ant-program "ant")
      (jde-save-project)
      (message "Setting ant program to ant")))
   (t (message "Don't recognise existing program, giving up"))))

(defun phil-java-toggle-ant-verbose()
  "Toggle verbose ant"
  (interactive)
  (cond
   ((equal "-emacs" jde-ant-args)
    (progn 
      (setq jde-ant-args "-emacs -verbose")
      (jde-save-project)
      (message "Setting ant to verbose" )))
   ((equal "-emacs -verbose" jde-ant-args)
    (progn
      (setq jde-ant-args "-emacs")
      (jde-save-project)
      (message "Setting ant to non verbose")))
   (t (message "Don't recognise existing options, giving up"))))

Reply via email to