[英]NullPointerException at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.addStandaloneView
I try to add several views to my rcp project. 我尝试将多个视图添加到我的rcp项目。
At first I created plugin project with a view using Plugin Project wizard. 首先,我使用Plugin Project向导创建了一个带有视图的插件项目。 View was added by two extensions: org.eclipse.ui.perspectiveExtensions and org.eclipse.ui.views.
视图由两个扩展名添加:org.eclipse.ui.perspectiveExtensions和org.eclipse.ui.views。 I started the project and see that view was added successfully.
我启动了该项目,并看到该视图已成功添加。
Then I tried to add several views by the exactly same way. 然后,我尝试以完全相同的方式添加多个视图。 The only difference was that "standalone" property was absent.
唯一的区别是缺少“独立”属性。 Views were not added without any errors.
没有添加视图,没有任何错误。
Than I tried to comment the declaration of the initial view and restart the app. 比我尝试注释初始视图的声明并重新启动应用程序。 Result was the same - new views were not displayed.
结果相同-未显示新视图。
Than I add property "standalone=true" to the extensions of other views. 比我在其他视图的扩展中添加属性“ standalone = true”。 Аnd get the error
get得到错误
java.lang.NullPointerException
at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.addStandaloneView(ModeledPageLayout.java:243)
at org.eclipse.ui.internal.PerspectiveExtensionReader.processView(PerspectiveExtensionReader.java:289)
at org.eclipse.ui.internal.PerspectiveExtensionReader.processExtension(PerspectiveExtensionReader.java:112)
at org.eclipse.ui.internal.PerspectiveExtensionReader.readElement(PerspectiveExtensionReader.java:350)
at org.eclipse.ui.internal.registry.RegistryReader.readElements(RegistryReader.java:145)
at org.eclipse.ui.internal.registry.RegistryReader.readExtension(RegistryReader.java:156)
at org.eclipse.ui.internal.registry.RegistryReader.readRegistry(RegistryReader.java:177)
at org.eclipse.ui.internal.PerspectiveExtensionReader.extendLayout(PerspectiveExtensionReader.java:76)
at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:4038)
at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:733)
I found this bug . 我发现了这个错误 。 And try to do all the same on Eclipse Mars.
并尝试在Eclipse Mars上执行所有相同的操作。 Result was the same.
结果是一样的。
I uncomment declarations of the initial view with "standalone" property and delete "standalone" property from other views. 我用“ standalone”属性取消注释初始视图的声明,并从其他视图中删除“ standalone”属性。 Error disappeared.
错误消失了。
I check the code in few generated classes and didn't find any other mentions of the creation or configuration of the initial view. 我检查了几个生成的类中的代码,但没有找到其他有关初始视图的创建或配置的提及。
What other difference may be between a view, which was created by the project wizard, and a view, which was added manually? 由项目向导创建的视图和手动添加的视图之间可能还有什么区别?
Workaround: add view via code in perspective class. 解决方法:通过透视图类中的代码添加视图。
layout.addView(View.ID, IPageLayout.TOP, IPageLayout.RATIO_MAX, IPageLayout.ID_EDITOR_AREA);
http://vogella.com/tutorials/Eclipse3RCP/article.html#add-view-to-perspective-via-code http://vogella.com/tutorials/Eclipse3RCP/article.html#add-view-to-perspective-via-code
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.