Commit | Line | Data |
---|---|---|
c05676c5 CY |
1 | ;; java.srt |
2 | ||
73b0cd50 | 3 | ;; Copyright (C) 2009-2011 Free Software Foundation, Inc. |
c05676c5 CY |
4 | |
5 | ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
6 | ||
7 | ;; This file is part of GNU Emacs. | |
8 | ||
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. | |
13 | ||
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. | |
18 | ||
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/>. | |
21 | ||
22 | set mode "java-mode" | |
23 | set escape_start "{{" | |
24 | set escape_end "}}" | |
25 | ||
26 | context file | |
27 | ||
28 | set comment_start "/**" | |
29 | set comment_end " */" | |
30 | set comment_prefix " *" | |
31 | ||
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}} | |
38 | ||
39 | package {{FILENAME_AS_PACKAGE}}; | |
40 | ||
41 | {{>CLASSSECTION:declaration:class}} | |
42 | ||
43 | ---- | |
44 | bind "e" | |
45 | ||
46 | context declaration | |
47 | ||
48 | template import :blank :indent | |
49 | "Template to import a package." | |
50 | ---- | |
51 | {{>:declaration:include}} | |
52 | ---- | |
53 | bind "i" | |
54 | ||
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}} { | |
62 | ||
63 | {{^}} | |
64 | ||
65 | } // {{NAME}} | |
66 | ---- | |
67 | bind "c" | |
68 | ||
69 | ;;; Semantic Tag support | |
70 | ;; | |
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 | {{^}} | |
80 | }; | |
81 | ---- | |
82 | ||
83 | template include :blank | |
84 | "An include statement." | |
85 | ---- | |
b9749554 | 86 | import {{?NAME}}; |
c05676c5 CY |
87 | ---- |
88 | ||
89 | context misc | |
90 | ||
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 | ---- | |
97 | ||
98 | context classdecl | |
99 | ||
100 | template function :indent :blank | |
101 | ---- | |
102 | public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} { | |
103 | {{^}} | |
104 | } | |
105 | ---- | |
106 | bind "m" | |
107 | ||
108 | template variable :indent :blank | |
109 | "Insert a variable declaration." | |
110 | ---- | |
111 | {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}}; | |
112 | ---- | |
113 | bind "v" | |
114 | ||
115 | ;;; Java Doc Comments | |
116 | ;; | |
117 | context classdecl | |
118 | ||
119 | prompt GROUPNAME "Name of declaration group: " | |
120 | ||
121 | template javadoc-function-group-start :indent :blank | |
122 | ---- | |
123 | /** | |
124 | * {{?GROUPNAME}} | |
125 | * @{ | |
126 | */ | |
127 | ||
128 | ---- | |
129 | ||
130 | template javadoc-function-group-end :indent :blank | |
131 | ---- | |
132 | /** | |
133 | * @} | |
134 | */ | |
135 | ||
136 | ---- | |
137 | ||
138 | context declaration | |
139 | ||
140 | template javadoc-class :indent :blank :time :user :tag | |
141 | ---- | |
142 | /** | |
143 | * {{DOC}}{{^}} | |
144 | * | |
145 | * Created: {{DATE}} | |
146 | * | |
147 | * @author {{AUTHOR}} | |
148 | * @version | |
149 | * @since | |
150 | */ | |
151 | ---- | |
152 | ||
153 | template javadoc-function :indent :blank :tag | |
154 | ---- | |
155 | /** | |
156 | * {{DOC}}{{^}} | |
157 | * {{#ARGS}} | |
158 | * @param {{?NAME}} - {{DOC}}{{/ARGS}} | |
159 | * @return {{TYPE}}{{#THROWS}} | |
160 | * @exception {{NAME}} - {{EXDOC}}{{/THROWS}} | |
161 | */ | |
162 | ---- | |
163 | ||
164 | template javadoc-variable-same-line | |
165 | ---- | |
166 | /**< {{DOC}}{{^}} */ | |
167 | ---- | |
168 | ||
169 | template javadoc-section-comment :blank :indent | |
170 | "Insert a comment that separates sections of an Emacs Lisp file." | |
171 | ---- | |
172 | \f | |
173 | /** {{?TITLE}} | |
174 | * | |
175 | * {{^}} | |
176 | */ | |
177 | ||
178 | ---- | |
179 | ||
180 | ||
114f9c96 | 181 | ;; end |