在“撰写Eclipse”一书中写道,为了引入扩展点,您应该在plugin.xml
中键入下一部分
<extension point="org.eclipse.contribution.junit.listeners">
<listener
class="org.eclipse.contribution.junit.RunTestAction$Listener">
</listener>
</extension>
但是这段代码给了我“未知的扩展点”错误“。
答案 0 :(得分:1)
仔细阅读本书,扩展点在与<extension-point id="listeners" name="Test Listeners"/>
相同的plugin.xml中定义
从http://www.informit.com/store/product.aspx?isbn=0321205758
<?xml version="1.0" encoding="UTF-8"?>
<plugin
id="org.eclipse.contribution.junit"
name="JUnit Plug-in"
version="1.0.0"
provider-name=""
class="org.eclipse.contribution.junit.JUnitPlugin">
<runtime>
<library name="contribjunit.jar">
<export name = "*"/>
</library>
</runtime>
<requires>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.junit"/>
<import plugin="org.eclipse.debug.core"/>
<import plugin="org.eclipse.jdt.launching"/>
</requires>
<extension-point id="listeners" name="Test Listeners"/>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.jdt.core.IType"
id="org.eclipse.contribution.junit.runtest">
<action
label="Run Test"
class="org.eclipse.contribution.junit.RunTestAction"
enablesFor="1"
id="org.eclipse.contribution.junit.runtest.action">
</action>
</objectContribution>
</extension>
<extension point="org.eclipse.contribution.junit.listeners">
<listener
class="org.eclipse.contribution.junit.RunTestAction$Listener">
</listener>
</extension>
</plugin>
干杯, 最大