eclipse无法编辑xml的解决方法

前不久重装系统,下载了3.7版本的eclipse。其它功能都挺好的,就是不能编辑xml文件。如果要修改xml文件的话,必须右击,选择用text editor的方法打开。之前一直没放在心上,今天下午终于把这个问题解决了。

打开一个xml文件,输入任何一个字符,回车,就会出现下面这个error:

Message:Unhandled event loop exception

java.lang.AbstractMethodError: org.eclipse.wst.sse.ui.EditorExecutionContext.execute(Lorg/eclipse/core/runtime/ISafeRunnable;)V
    at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replace(JobSafeStructuredDocument.java:106)
    at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111)
    at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1184)
    at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
    at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:629)
    at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
    at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180)
    at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
    at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
    at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911)
    at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941)
    at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5635)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
    at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
    at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
    at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

在网了搜了下,原来就是eclipse 3.7版本在win7里的一个Bug, 详见https://bugs.eclipse.org/bugs/show_bug.cgi?id=360242 。

大意就是,3.7和3.7.1版本里有两个插件,org.eclipse.wst.sse.core and org.eclipse.wst.sse.ui ,与eclipse的版本不一致或者不兼容什么的。

本来想找下有没有修复的办法,后来发现暂时还没有人提出什么行之有效的解决方案。

解铃还须系铃人。我又到官网上看了下,目前的最新版本是3.7.2,果断下载。谁知道,打开后还是有问题。考虑到还要再重新搭建环境什么的,我就不高兴了,直接升级版本的方法不可取。然后,我又抱着试一试的心态,在原先的3.7版本里,Help-> Check for Updates->select all. 结果,完全OK!

仔细一想,这个bug是去年11月份发布的,至今快半年了。看来eclipse的效率还是蛮高的,向他们致敬!

代码改变世界 我 正在学习如何改变自己
原文地址:https://www.cnblogs.com/pinky878/p/2494810.html