java.srt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ;; java.srt
  2. ;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
  3. ;; Author: Eric M. Ludlam <eric@siege-engine.com>
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs is free software: you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; GNU Emacs is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. set mode "java-mode"
  16. set escape_start "{{"
  17. set escape_end "}}"
  18. context file
  19. set comment_start "/**"
  20. set comment_end " */"
  21. set comment_prefix " *"
  22. template empty :file :user :time :java :indent
  23. "Fill out an empty file."
  24. sectiondictionary "CLASSSECTION"
  25. set NAME macro "FILENAME_AS_CLASS"
  26. ----
  27. {{>:filecomment}}
  28. package {{FILENAME_AS_PACKAGE}};
  29. {{>CLASSSECTION:declaration:class}}
  30. ----
  31. bind "e"
  32. context declaration
  33. template import :blank :indent
  34. "Template to import a package."
  35. ----
  36. {{>:declaration:include}}
  37. ----
  38. bind "i"
  39. template class :blank :indent
  40. "Template to declare a variable."
  41. sectiondictionary "DOCSECTION"
  42. set NAME macro "NAME"
  43. ----
  44. {{>DOCSECTION:declaration:javadoc-class}}
  45. public class {{?NAME}} {
  46. {{^}}
  47. } // {{NAME}}
  48. ----
  49. bind "c"
  50. ;;; Semantic Tag support
  51. ;;
  52. template class-tag :indent :blank
  53. "Insert a Java class with the expectation of it being used by a tag inserter.
  54. Override this to affect applications, or the outer class structure for
  55. the user-facing template."
  56. ----
  57. {{>:declaration:javadoc-class}}
  58. public Class {{?NAME}} {{#PARENTS}}{{#FIRST}}extends {{/FIRST}}{{#NOTFIRST}}implements {{/NOTFIRST}}{{NAME}}{{/PARENTS}}
  59. {
  60. {{^}}
  61. };
  62. ----
  63. template include :blank
  64. "An include statement."
  65. ----
  66. import {{?NAME}};
  67. ----
  68. context misc
  69. template arglist
  70. "Insert an argument list for a function.
  71. @todo - Support smart CR in a buffer for not too long lines."
  72. ----
  73. ({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}})
  74. ----
  75. context classdecl
  76. template function :indent :blank
  77. ----
  78. public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} {
  79. {{^}}
  80. }
  81. ----
  82. bind "m"
  83. template variable :indent :blank
  84. "Insert a variable declaration."
  85. ----
  86. {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}};
  87. ----
  88. bind "v"
  89. ;;; Java Doc Comments
  90. ;;
  91. context classdecl
  92. prompt GROUPNAME "Name of declaration group: "
  93. template javadoc-function-group-start :indent :blank
  94. ----
  95. /**
  96. * {{?GROUPNAME}}
  97. * @{
  98. */
  99. ----
  100. template javadoc-function-group-end :indent :blank
  101. ----
  102. /**
  103. * @}
  104. */
  105. ----
  106. context declaration
  107. template javadoc-class :indent :blank :time :user :tag
  108. ----
  109. /**
  110. * {{DOC}}{{^}}
  111. *
  112. * Created: {{DATE}}
  113. *
  114. * @author {{AUTHOR}}
  115. * @version
  116. * @since
  117. */
  118. ----
  119. template javadoc-function :indent :blank :tag
  120. ----
  121. /**
  122. * {{DOC}}{{^}}
  123. * {{#ARGS}}
  124. * @param {{?NAME}} - {{DOC}}{{/ARGS}}
  125. * @return {{TYPE}}{{#THROWS}}
  126. * @exception {{NAME}} - {{EXDOC}}{{/THROWS}}
  127. */
  128. ----
  129. template javadoc-variable-same-line
  130. ----
  131. /**< {{DOC}}{{^}} */
  132. ----
  133. template javadoc-section-comment :blank :indent
  134. "Insert a comment that separates sections of an Emacs Lisp file."
  135. ----
  136. /** {{?TITLE}}
  137. *
  138. * {{^}}
  139. */
  140. ----
  141. ;; end