在Eclipse3.4.1下运行Eclispe Article:Simplifying Preference Pages with Field Editors的示例程序

进行插件开发学习时,将Eclipse Articles下的一些插件开发例子直接导入到Eclipse3.4.1环境下无法直接运行,以Eclipse Article:Simplifying Preference Pages with Field Editors(http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html)为例,说明如下

 

在Eclipse3.4.1环境下新建插件开发工程,拷贝例子程序到src目录下,并修改MAINFEST.MF文件中的Bundle-Activator属性值,运行插件报如下错误:

 

org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException:
An error occurred while automatically activating bundle xxx(line no.).

 

 

解决方法

 

1.修改构造函数

 

public HTMLEditorPlugin(IPluginDescriptor descriptor) {
 super(descriptor); 
 plugin = this; 
}    

 

修改为

 

public HTMLEditorPlugin() {
} 
  
   

 

2.添加start(BundleContext context)和stop(BundleContext context)方法

 

private BundleContext context = null;    
/* 
 * (non-Javadoc) 
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
 */ 
public void start(BundleContext context) throws Exception { 
 super.start(context); 
 plugin = this; 
} 
  
/* 
 * (non-Javadoc) 
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 */ 
public void stop(BundleContext context) throws Exception { 
 plugin = null; 
 super.stop(context); 
}       

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值