src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Nov 14 13:31:43 2017 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Nov 14 13:44:07 2017 -0800
@@ -133,6 +133,11 @@
public String stylesheetfile = "";
/**
+ * Argument for command line option "--add-stylesheet".
+ */
+ public List<String> additionalStylesheets = new ArrayList<>();
+
+ /**
* Argument for command line option "-Xdocrootparent".
*/
public String docrootparent = "";
@@ -304,6 +309,22 @@
return false;
}
}
+ // check if stylesheetfile exists
+ if (!stylesheetfile.isEmpty()) {
+ DocFile stylesheet = DocFile.createFileForInput(this, stylesheetfile);
+ if (!stylesheet.exists()) {
+ reporter.print(ERROR, getText("doclet.File_not_found", stylesheetfile));
+ return false;
+ }
+ }
+ // check if additional stylesheets exists
+ for (String ssheet : additionalStylesheets) {
+ DocFile ssfile = DocFile.createFileForInput(this, ssheet);
+ if (!ssfile.exists()) {
+ reporter.print(ERROR, getText("doclet.File_not_found", ssheet));
+ return false;
+ }
+ }
// In a more object-oriented world, this would be done by methods on the Option objects.
// Note that -windowtitle silently removes any and all HTML elements, and so does not need
@@ -554,6 +575,13 @@
public Set<Doclet.Option> getSupportedOptions() {
Resources resources = getResources();
Doclet.Option[] options = {
+ new Option(resources, "--add-stylesheet", 1) {
+ @Override
+ public boolean process(String opt, List<String> args) {
+ additionalStylesheets.add(args.get(0));
+ return true;
+ }
+ },
new Option(resources, "-bottom", 1) {
@Override
public boolean process(String opt, List<String> args) {
@@ -722,7 +750,7 @@
return true;
}
},
- new Option(resources, "-stylesheetfile", 1) {
+ new Option(resources, "--main-stylesheet -stylesheetfile", 1) {
@Override
public boolean process(String opt, List<String> args) {
stylesheetfile = args.get(0);