简体   繁体   English

如何使用源导入org.eclipse.pde.internal?

[英]How can I import org.eclipse.pde.internal with sources?

The problem is, that this package and its children are not seen in the list of packages of "import". 问题是,此软件包及其子级在“导入”的软件包列表中找不到。 When I import all pde packages, org.eclipse.pde.internal somehow becomes usable anyway. 当我导入所有pde软件包时,org.eclipse.pde.internal无论如何都会变得可用。 But I don't see its sources. 但我看不到它的来源。 How can I manage this package? 我如何管理这个包裹?

Here are some rules from the Eclipse community that might help: 以下是Eclipse社区中的一些规则可能会有所帮助:

  1. Package names should match plug-in names. 软件包名称应与插件名称匹配。 If they don't strip from the right. 如果他们没有从右边剥离。 The code you seek should be in the plug-in org.eclipse.pde.internal (doesn't exist). 您要查找的代码应该在插件org.eclipse.pde.internal (不存在)。 Strip internal and you get an existing plug-in. 剥离internal ,您将获得一个现有插件。

  2. OSGi allows to hide packages in plug-in X from other plugins. OSGi允许从其他插件隐藏插件X中的软件包。 This feature isn't really used. 此功能并未真正使用。 You can still import the classes but Eclipse don't show them in code completion and you will get warnings. 您仍然可以导入类,但是Eclipse不会在代码完成时显示它们,并且您会收到警告。 There is an option for the OSGi/bundle classloader to throw NoClassDefFoundError but that option is usually disabled. OSGi /捆绑类加载器有一个抛出NoClassDefFoundError选项,但是通常禁用该选项。 You can find the exports list in the MANIFEST.MF of the plug-in that you try to import from. 您可以在尝试从中导入的插件的MANIFEST.MF中找到导出列表。

    Most of the non-exported packages are in below a package internal , so this is a hint: Don't use this code. 大部分未导出的软件包都在internal之下,所以这是一个提示:不要使用此代码。 It's not part of the official API. 它不是官方API的一部分。 It can change in the next version of Eclipse or the plug-in and nobody will care if your code breaks (unlike with the official API). 它可以在Eclipse的下一版本或插件中进行更改,并且如果您的代码中断,则没人会在意(与官方API不同)。

Of course, the world isn't that simple. 当然,世界并不是那么简单。 Which is why using internal code is frowned upon but the classloader option is disabled (= Eclipse could enforce this behavior but they don't). 这就是为什么不赞成使用内部代码而禁用classloader选项的原因(= Eclipse可以强制执行此行为,但事实并非如此)。

If you think some internal API would be great to use, file a bug report at https://bugs.eclipse.org/bugs/ 如果您认为某些内部API很好用,请在https://bugs.eclipse.org/bugs/上提交错误报告。

The problem was solved by my colleague. 我的同事解决了这个问题。

  1. org.eclipse.pde.internal is in org.eclipse.pde.ui . org.eclipse.pde.internalorg.eclipse.pde.ui

  2. Eclipse 3.7.2 simply haven't the PDE sources. Eclipse 3.7.2根本没有PDE源代码。 Appropriate directories in repository are empty. 存储库中的适当目录为空。 I downshifted to 3.7.0 and it is OK now. 我降级到3.7.0,现在可以了。

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

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