使模块的xml层对其他模块可见

时间:2014-09-10 18:15:11

标签: java netbeans module encapsulation netbeans-platform

在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);
    }
}    

1 个答案:

答案 0 :(得分:1)

使用需要显示的xml图层打开模块的属性对话框。选择API Versioning,然后在Public packages下选择包含xml文件的包。点击OK