eclipse插件调试正常.打包后运行报错
前一阵类型转换的问题zsjpower帮忙解决了,现在打包发布插件时问题又出现了!!
打包成jar后,安装到rcp版的eclipse能正常运行,但安装到eclipse ide for cpp时,在
if (editor instanceof CompilationUnitEditor) {
处判断为false,之前出现过这个问题,通过在dependencies标签添加插件解决了。现在想来也是同样的问题,
但不知怎么解决。eclipse打包时配置有点乱,runtime->classpath和build->extra classpath和dependencies三个地方都要设置,可还是不行,我想关键是不懂打包时怎么配置这几个地方,求大神指导啊~
出问题的代码:
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
final IReusableEditor editor = (IReusableEditor)part;
if (editor instanceof CompilationUnitEditor) {
CompilationUnitEditor compEditor = (CompilationUnitEditor)editor;
IEditorInput input = compEditor.getEditorInput();
IDocumentProvider provider = compEditor.getDocumentProvider();
IDocument document = provider.getDocument(input);
下面是MANIFEST.MF文件:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: T1
Bundle-SymbolicName: t1;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: t1.Activator
Require-Bundle: org.eclipse.core.resources;bundle-version="3.8.100",
org.eclipse.jdt.ui;bundle-version="3.9.0",
org.eclipse.ui.ide;bundle-version="3.9.0",
org.eclipse.text;bundle-version="3.5.300",
org.eclipse.ui.workbench.texteditor;bundle-version="3.8.100",
org.eclipse.jface.text;bundle-version="3.8.100",
org.eclipse.ui.editors;bundle-version="3.8.100",
org.eclipse.jdt;bundle-version="3.9.0",
org.eclipse.jdt.core;bundle-version="3.9.0",
org.eclipse.ui;bundle-version="3.105.0",
org.eclipse.core.runtime;bundle-version="3.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/org.eclipse.core.resources_3.8.100.v20130521-2026.jar,
lib/org.eclipse.ui.ide_3.9.0.v20130517-0139.jar,
lib/org.eclipse.ui.editors_3.8.100.v20130513-1637.jar,
lib/org.eclipse.ui.workbench.texteditor_3.8.100.v20130514-1533.jar,
lib/org.eclipse.text_3.5.300.v20130515-1451.jar,
lib/org.eclipse.jface.text_3.8.100.v20130515-1957.jar,
lib/org.eclipse.jdt.ui_3.9.0.v20130605-1748.jar,
lib/org.eclipse.jdt_3.9.0.v20130605-2000.jar,
lib/org.eclipse.jdt.core_3.9.0.v20130604-1421.jar,
lib/org.eclipse.ui_3.105.0.v20130522-1122.jar,
lib/org.eclipse.core.runtime_3.9.0.v20130326-1255.jar
解决这个后,这个插件就差不多完成了,我也会整理下吧遇到的问题和解决方法都贴出来,大家共同进步吧
eclipse插件 插件 eclipse
[解决办法]
看起来是异常,而不是判断结果为false
Bundle-ClassPath: .,
lib/org.eclipse.core.resources_3.8.100.v20130521-2026.jar,
lib/org.eclipse.ui.ide_3.9.0.v20130517-0139.jar,
lib/org.eclipse.ui.editors_3.8.100.v20130513-1637.jar,
lib/org.eclipse.ui.workbench.texteditor_3.8.100.v20130514-1533.jar,
lib/org.eclipse.text_3.5.300.v20130515-1451.jar,
lib/org.eclipse.jface.text_3.8.100.v20130515-1957.jar,
这些都是eclipse的插件,在Require-Bundle: 中声明过就可以了,不要在Bundle-ClassPath中做,更不要把jar包拷到你自己的插件中