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

标签 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);
    }
}    

最佳答案

打开包含需要可见的 xml 层的模块的属性对话框。选择API 版本控制,然后在公共(public)包 下选择包含 xml 文件的包。单击确定

关于java - 使模块的 xml 层对其他模块可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25772317/

相关文章:

node.js - NodeJS 需要在另一个模块中的模块

java - Spring JDBC 中区分唯一键约束异常和主键约束异常

java - 设计题: Serverside form validation using ajax and Servlet

java - 升序子字符串编译错误

java - 如何更新 Jess 规则引擎中的事实?

netbeans - 如何更改 Netbeans 预览文档的字体和颜色?

Docker 从缓存中构建已删除的模块

jquery - 加载非 main 的 npm 模块的最佳实践

java - 使用 Java Web Start 程序创建客户端-服务器应用程序的最佳方法是什么?

java - 运行 apache tomcat 服务器时出错