PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/rtlib/emacs/support-jde.el

https://code.google.com/p/lino/
Emacs Lisp | 134 lines | 53 code | 49 blank | 32 comment | 2 complexity | e881895fe94ab1d4e2ded9306dc7df3c MD5 | raw file
Possible License(s): GPL-3.0
  1. (add-to-list 'load-path (expand-file-name "t:/soft/emacs/site-lisp/jde/lisp"))
  2. (add-to-list 'load-path (expand-file-name "t:/soft/emacs/site-lisp/semantic"))
  3. (add-to-list 'load-path (expand-file-name "t:/soft/emacs/site-lisp/speedbar"))
  4. (add-to-list 'load-path (expand-file-name "t:/soft/emacs/site-lisp/elib"))
  5. (add-to-list 'load-path (expand-file-name "t:/soft/emacs/site-lisp/eieio"))
  6. ;; If you want Emacs to defer loading the JDE until you open a
  7. ;; Java file, edit the following line
  8. ;;(setq defer-loading-jde nil)
  9. ;; to read:
  10. ;;
  11. (setq defer-loading-jde t)
  12. ;;
  13. (if defer-loading-jde
  14. (progn
  15. (autoload 'jde-mode "jde" "JDE mode." t)
  16. (setq auto-mode-alist
  17. (append
  18. '(("\\.java\\'" . jde-mode))
  19. auto-mode-alist)))
  20. (require 'jde))
  21. ;; Sets the basic indentation for Java source files
  22. ;; to two spaces.
  23. (defun my-jde-mode-hook ()
  24. (setq c-basic-offset 2))
  25. (add-hook 'jde-mode-hook 'my-jde-mode-hook)
  26. ;;Problem I can't get the JDE to use Internet Explorer to display the
  27. ;;JDK doc or the JDE User's Guide.
  28. ;;Solution The JDE uses Emacs browse-url interface to web
  29. ;;browsers. browse-url supports Netscape by default. To use Internet
  30. ;;Explorer:
  31. ;; 1. Add the following code to your .emacs file
  32. (if (eq system-type 'windows-nt)
  33. (defadvice browse-url-generic (around show-window act)
  34. "*Sets `start-process-show-window' on."
  35. (let ((w32-start-process-show-window t))
  36. ad-do-it)))
  37. ;;This code causes Emacs to show the window of the browser launched by
  38. ;;the function browse-url-generic.
  39. ;;From: Richard den Adel
  40. ;;Subject: Small extension to jde-run to run JUnit tests
  41. ;;Date: Tue, 20 Feb 2001 23:01:26 -0800
  42. ;;Hi all,
  43. ;;I have written some lisp functions that allow me to run the JUnit
  44. ;;test that corresponds with the current buffer. If your current
  45. ;;buffer is :com/acriter/util/GUIAccess.java, the jde-run-test-class
  46. ;;will run the class com.acriter.util.TestGUIAccess and
  47. ;;jde-run-package-test-class will run the class com.acriter.util.Test
  48. ;;(we use this syntax to run all tests in a current package, it is an
  49. ;;automatically generated TestSuite of JUnit.)
  50. ;;I don't know if it is of any use to anyone but me, but anyway
  51. ;;It is my first tryout in lisp, so please be gentle to me ;-)
  52. (defun jde-run-test-class()
  53. "Runs the corresponding test class that belongs to the current buffer"
  54. (interactive)
  55. (jde-run-internal (jde-run-get-test-class)))
  56. (defun jde-run-get-test-class()
  57. "Gets the test class for the current buffer"
  58. (let ((test-class (jde-run-get-main-class)))
  59. (if (string-match ".*Test.*" (jde-run-get-main-class))
  60. (setq test-class (jde-run-get-main-class))
  61. (setq test-class
  62. (concat (jde-db-get-package)
  63. "Test"
  64. (file-name-sans-extension
  65. (file-name-nondirectory (buffer-file-name))))))
  66. test-class))
  67. (defun jde-run-package-test-class()
  68. "Runs the corresponding test class that belongs to the package of the current
  69. buffer"
  70. (interactive)
  71. (jde-run-internal (jde-run-get-package-test-class)))
  72. (defun jde-run-get-package-test-class()
  73. "Gets the package test class for the current buffer"
  74. (let ((package-test-class (concat (jde-db-get-package) "Test")))
  75. package-test-class))
  76. ;; Include the following only if you want to run
  77. ;; bash as your shell.
  78. ;; Setup Emacs to run bash as its primary shell.
  79. (setq shell-file-name "bash")
  80. (setq shell-command-switch "-c")
  81. (setq explicit-shell-file-name shell-file-name)
  82. (setenv "SHELL" shell-file-name)
  83. (setq explicit-sh-args '("-login" "-i"))
  84. (if (boundp 'w32-quote-process-args)
  85. (setq w32-quote-process-args ?\")) ;; Include only for MS Windows.