[英]Eclipse plugin detected but not loaded
I am writing a plugin that uses the compilationParticipant
extension point of the JDT. 我正在编写一个使用JDT的
compilationParticipant
扩展点的插件。 The plugin isn't working right now and I try to figure out why. 该插件目前无法正常工作,我尝试找出原因。
I have one CompilationParticipant
: 我有一名
CompilationParticipant
:
public class CompParticipant extends CompilationParticipant {
private static CompParticipant instance = null;
private CompParticipant() {
super();
Activator.log("CompilationParticipant initialized");
}
public CompParticipant getSingleton() {
if (instance == null)
instance = new CompParticipant();
return instance;
}
@Override
public void buildStarting(BuildContext[] files, boolean isBatch) {
Activator.log("Build Starting");
}
}
And one (not lazy) Activator
: 还有一个(不是惰性的)
Activator
:
public class Activator extends Plugin implements BundleActivator {
private static Activator instance;
public static String PLUGINID = "myplugin";
public Activator() {
super();
log("Activator");
}
public static void log(String msg) {
if (instance == null)
instance = new Activator();
instance.getLog().log(new Status(Status.WARNING, PLUGINID, 1, msg, null));
}
@Override
public void start(BundleContext context) throws Exception { log("Start"); }
@Override
public void stop(BundleContext context) throws Exception {}
}
In my manifest I specify: 在清单中,我指定:
Bundle-Activator: myplugin.Activator
And in my plugin.xml I specify: 然后在我的plugin.xml中指定:
<extension point="org.eclipse.jdt.core.compilationParticipant">
<compilationParticipant class="myplugin.CompParticipant" id="myplugin" createsProblems="true">
</compilationParticipant>
</extension>
I exported the plugin to an archive and put the contents in the dropins
folder. 我将插件导出到存档中,并将内容放入
dropins
文件夹中。 When I start Eclipse I see in the Installation Details > Configuration section *** Plug-in Registry
: 当我启动Eclipse时,我会在“ 安装详细信息”>“配置”部分中看到
*** Plug-in Registry
:
myplugin (1.0.0) "My Plugin" [Installed]
However no log messages are printed to the error log (or in the console). 但是,没有日志消息被打印到错误日志中(或在控制台中)。 Is my logging incorrect or why does my plugin not get run?
我的日志记录不正确吗?为什么我的插件无法运行?
Re-reading the question, the following looks inconsistent to me: 重新阅读该问题后,以下内容与我不一致:
this
from within the constructor or start()
method. this
从构造方法中或start()
方法。 Bundle-ActivationPolicy: lazy
Bundle-ActivationPolicy: lazy
When all this is corrected, the builder should be able to instantiate your CompilationParticipant (as read from the extension declaration). 更正所有这些之后,构建器应该能够实例化您的CompilationParticipant(从扩展声明中读取)。 This instantiation should then activate your bundle and start the activator.
然后,此实例化应激活您的捆绑软件并启动激活器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.