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