PlantUML-NB uses SourceStringReader when converting .puml file to SVG for display in NetBeans.
SourceStringReader uses BlockUmlBuilder internally, which accepts a File newCurrentDir parameter, but SourceStringReader doesn't have a constructor to allow passing in this parameter.
So currently, the include directive doesn't work in NetBeans because without a current directory defined, PlantUML ends up looking in C:\Program Files\NetBeans 8.1 for the file to include, and of course it's not there because the file is in my project source directory.
Please add these constructors to SourceStringReader:
public SourceStringReader(String source, File newCurrentDir) {
this(new Defines(), source, "UTF-8", Collections.<String> emptyList(), newCurrentDir);
}
public SourceStringReader(Defines defines, String source, String charset, List<String> config, File newCurrentDir) {
// WARNING GLOBAL LOCK HERE
synchronized (SourceStringReader.class) {
try {
final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source), newCurrentDir, null);
this.blocks = builder.getBlockUmls();
} catch (IOException e) {
Log.error("error " + e);
throw new IllegalStateException(e);
}
}
}
Then, PUMLGenerator in PlantUML-NB can be modified like this:
SourceStringReader reader = new SourceStringReader(inputFile.asText(), FileUtil.toFile(inputFile).getParentFile());
And this fixes the issue, so the !include directive works in NetBeans by looking in directory of the file being processed.