1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
154 @Override |
154 @Override |
155 void usage() { |
155 void usage() { |
156 usage(true); |
156 usage(true); |
157 } |
157 } |
158 |
158 |
159 |
159 void usage(boolean exit) { |
160 /** |
160 usage("main.usage", "-help", null, exit); |
161 * Usage |
|
162 */ |
|
163 private void usage(boolean exit) { |
|
164 // RFE: it would be better to replace the following with code to |
|
165 // write a header, then help for each option, then a footer. |
|
166 messager.notice("main.usage"); |
|
167 |
|
168 // let doclet print usage information (does nothing on error) |
|
169 if (docletInvoker != null) { |
|
170 docletInvoker.optionLength("-help"); |
|
171 } |
|
172 |
|
173 if (exit) exit(); |
|
174 } |
161 } |
175 |
162 |
176 @Override |
163 @Override |
177 void Xusage() { |
164 void Xusage() { |
178 Xusage(true); |
165 Xusage(true); |
179 } |
166 } |
180 |
167 |
181 /** |
168 void Xusage(boolean exit) { |
182 * Usage |
169 usage("main.Xusage", "-X", "main.Xusage.foot", exit); |
183 */ |
170 } |
184 private void Xusage(boolean exit) { |
171 |
185 messager.notice("main.Xusage"); |
172 private void usage(String main, String doclet, String foot, boolean exit) { |
|
173 // RFE: it would be better to replace the following with code to |
|
174 // write a header, then help for each option, then a footer. |
|
175 messager.notice(main); |
|
176 |
|
177 // let doclet print usage information (does nothing on error) |
|
178 if (docletInvoker != null) { |
|
179 // RFE: this is a pretty bad way to get the doclet to show |
|
180 // help info. Moreover, the output appears on stdout, |
|
181 // and <i>not</i> on any of the standard streams passed |
|
182 // to javadoc, and in particular, not to the noticeWriter |
|
183 // But, to fix this, we need to fix the Doclet API. |
|
184 docletInvoker.optionLength(doclet); |
|
185 } |
|
186 |
|
187 if (foot != null) |
|
188 messager.notice(foot); |
|
189 |
186 if (exit) exit(); |
190 if (exit) exit(); |
187 } |
191 } |
188 |
192 |
189 /** |
193 /** |
190 * Exit |
194 * Exit |