Eclipse插件开发报错:SampleView类型层次结构不一致求助
Eclipse插件开发求助:SampleView继承层次不一致
我正在学习《创建Eclipse插件》教程,目前卡在创建视图的环节:
最后一步是为org.eclipse.ui.views扩展点编写“Hello World!”视图的Java类,结果出现错误提示:"The hierarchy of the type SampleView is inconsistent."(类型SampleView的继承层次不一致)
查资料了解到,这个错误通常是因为继承类(此处为ViewPart)的jar包未加入项目构建路径。但我的目标平台已经包含org.eclipse.ui.views插件(该插件应该包含org.eclipse.ui.views.jar):
希望能得到解决思路!
更新:附上相关文件内容
plugin.xml
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.commands"> <category id="com.example.helloworld.commands.category" name="Sample Category"> </category> <command categoryId="com.example.helloworld.commands.category" name="Display Hello World" id="com.example.helloworld.commands.sampleCommand"> </command> </extension> <extension point="org.eclipse.ui.handlers"> <handler class="com.example.helloworld.handlers.SampleHandler" commandId="com.example.helloworld.commands.sampleCommand"> </handler> </extension> <extension point="org.eclipse.ui.bindings"> <key commandId="com.example.helloworld.commands.sampleCommand" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" contextId="org.eclipse.ui.contexts.window" sequence="M1+6"> </key> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions"> <menu id="com.example.helloworld.menus.sampleMenu" label="Sample Menu" mnemonic="M"> <command commandId="com.example.helloworld.commands.sampleCommand" id="com.example.helloworld.menus.sampleCommand" mnemonic="S"> </command> </menu> </menuContribution> <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> <toolbar id="com.example.helloworld.toolbars.sampleToolbar"> <command id="com.example.helloworld.toolbars.sampleCommand" commandId="com.example.helloworld.commands.sampleCommand" icon="icons/sample.png" tooltip="Say hello world"> </command> </toolbar> </menuContribution> </extension> <extension point="org.eclipse.ui.views"> <category id="com.example.helloworld.view.helloworldcategory" name="Hello World!"> </category> <view category="com.example.helloworld.view.helloworldcategory" class="com.example.helloworld.view.SampleView" id="com.example.helloworld.view.helloworldview" name="Hello World!" restorable="true"> </view> </extension> </plugin>
MANIFEST.MF
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Helloworld Bundle-SymbolicName: com.example.helloworld;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Vendor: EXAMPLE Require-Bundle: org.eclipse.ui Automatic-Module-Name: com.example.helloworld Bundle-RequiredExecutionEnvironment: JavaSE-17
内容的提问来源于stack exchange,提问作者Piscercube
相关产品推荐
相关产品推荐

