【发布时间】:2014-09-10 18:15:10
【问题描述】:
在 Netbeans 平台中,我有一个模块监视 xml 文件系统并在它被其他模块更改时做出响应。
我在另一个模块中创建了一个 layer.xml。当在观看模块中单击 XML 层节点并打开时,更改会显示在 IDE 中。然而,在运行时,当观察模块正在查看 xml 文件系统时,来自其他模块的更改不存在。另一个模块可以在运行时看到自己的变化。
是否有某个模块的设置可以让其他模块看到它的 xml 层?
这是我在运行时用来检查 xml 文件系统的代码——它将所有节点的名称打印到一个文件中,当所有模块都打开并运行时,我从一个按钮触发它。
private void btn1ActionPerformed(java.awt.event.ActionEvent evt)
{
try {
BufferedWriter writer = Files.newBufferedWriter(Paths.get("filesystemOut.txt"), Charset.forName("UTF-8"));
exportFilesystem(FileUtil.getConfigRoot(), writer, 0);
writer.close();
} catch (IOException e) {
System.err.println("couldn't write filesystem structure");
}
}
void exportFilesystem(FileObject root, BufferedWriter writer, int depth) throws IOException
{
for (int i = 0; i < depth * 4; ++i)
{
writer.write(' ');
}
writer.write(root.getName());
writer.newLine();
FileObject[] children = root.getChildren();
for (FileObject child : children)
{
exportFilesystem(child, writer, depth + 1);
}
}
【问题讨论】:
标签: java netbeans module encapsulation netbeans-platform