简体   繁体   English

如何将自定义文件夹添加到导出的Eclipse RCP应用程序?

[英]How to add custom folders to an exported Eclipse RCP application?

I have an eclipse application which loads a file from a folder. 我有一个Eclipse应用程序,它从文件夹加载文件。 When I export the project and run it, the folder is only compiled binary in a jar file. 当我导出项目并运行它时,该文件夹仅在jar文件中编译为二进制文件。 But I want to edit the file after the export and so I need it in the product directory and not inside a jar. 但是我想在导出后编辑文件,因此我需要在产品目录中而不是在jar中。 The folder is checked in the build.properties which should be the right way but it still does not work. 在build.properties中检查了该文件夹,这应该是正确的方法,但是仍然无法正常工作。 Does anyone know where else to configure that the folder is exported as a real folder? 有谁知道将文件夹导出为真实文件夹的其他配置? Thanks for your help! 谢谢你的帮助!

You can export additional files via features, and these can be contributed as folders to the root. 您可以通过功能导出其他文件,这些文件可以作为文件夹添加到根目录。 Look for rootfolders in the eclipse PDE documentation. 在eclipse PDE文档中查找rootfolders。 You have to use some special entries in the build.properties of your feature, that can not be done via PDE ui. 您必须在功能的build.properties中使用一些特殊的条目,而这些不能通过PDE ui完成。

Having said that, it is probably a bad idea to alter those files and the product directory. 话虽如此,更改这些文件和产品目录可能不是一个好主意。 This will cause issues on most multi-user and modern operating systems. 这将在大多数多用户和现代操作系统上引起问题。 The changes should be stored with the data for the plugin/OSGI bundle that produces them. 所做的更改应与产生更改的插件/ OSGI捆绑软件的数据一起存储。 Consider this method: http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#getDataFile(java.lang.String ) 考虑以下方法: http : //www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#getDataFile(java.lang.String

If I understand you correctly, you want to install the plug-in in the "unpacked" form rather than in the "jar" form. 如果我对您的理解正确,那么您希望以“未包装”形式而不是“ jar”形式安装插件。 This way the folders of the plug-in project in the Eclipse IDE, will also be "physical" folders when the plug-in is installed in an Eclipse framework. 这样,当将插件安装在Eclipse框架中时,Eclipse IDE中的插件项目的文件夹也将是“物理”文件夹。

This can be accomplished in a number of ways, whether the most portable currently seems to be to add the line Eclipse-BundleShape: dir to the MANIFEST.MF file. 无论当前是否最容易移植,似乎是通过将Eclipse-BundleShape: dir行添加到MANIFEST.MF文件中,这可以通过多种方式来实现。 (Some tools - most notably Tycho - does not understand the alternatives.) (某些工具-最著名的是Tycho-不了解替代方法。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM