Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 制作一个模块';对其他模块可见的xml层_Java_Netbeans_Module_Encapsulation_Netbeans Platform - Fatal编程技术网

Java 制作一个模块';对其他模块可见的xml层

Java 制作一个模块';对其他模块可见的xml层,java,netbeans,module,encapsulation,netbeans-platform,Java,Netbeans,Module,Encapsulation,Netbeans Platform,在Netbeans平台中,我让一个模块监视xml文件系统,当它被其他模块更改时做出响应 我在另一个模块中创建了layer.xml。当我在监视模块中单击XML层节点并打开时,IDE中会显示这些更改。但是,在运行时,当监视模块查看xml文件系统时,其他模块的更改并不存在。另一个模块可以在运行时看到自己的更改 是否有一个模块的设置可以让其他模块看到它的xml层 这是我在运行时用来检查xml文件系统的代码——它将所有节点的名称打印到一个文件中,当所有模块打开并运行时,我通过一个按钮触发它 private

在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);
    }
}    
private void btn1ActionPerformed(java.awt.event.ActionEvent evt)
{                                       
试一试{
BufferedWriter writer=Files.newBufferedWriter(path.get(“filesystemOut.txt”)、Charset.forName(“UTF-8”);
exportFilesystem(FileUtil.getConfigRoot(),writer,0);
writer.close();
}捕获(IOE异常){
System.err.println(“无法写入文件系统结构”);
}
}
void exportFilesystem(fileobjectroot、BufferedWriter writer、int-depth)引发IOException
{
对于(int i=0;i
打开模块的属性对话框,其中包含需要可见的xml层。选择
API版本控制
并在
Public packages
下选择包含xml文件的包。单击
OK