从插件调用代码时出现问题:“org.eclipse.jface”

时间:2010-07-12 14:59:10

标签: java

我是新手,并且正在关注HelloWorld教程。我以编程方式运行它但是当我尝试使用XML时,我尝试运行时在日志文件中获取上面的消息。基本上每次我尝试将一个字符添加到res / layout目录中的strings.xml文件时,我都会得到一个带有java.lang.NullPointerException的错误窗口。我可以单击确定并继续编辑XML但是当我查看错误日志时,我得到了下面的转储,我无法弄清楚要做什么。我没有正确安装插件。我安装了2.2

java.lang.NullPointerException
 at org.eclipse.wst.xml.core.internal.document.ElementImpl.getDefaultValue(ElementImpl.java:259)
 at org.eclipse.wst.xml.core.internal.document.ElementImpl.getAttributeNS(ElementImpl.java:329)
 at com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode.getShortDescription(Unknown Source)
 at com.android.ide.eclipse.adt.internal.editors.ui.tree.UiModelTreeLabelProvider.getText(Unknown Source)
 at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getText(WrappedViewerLabelProvider.java:108)
 at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:164)
 at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:152)
 at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:934)
 at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:102)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
 at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
 at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1014)
 at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:481)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
 at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
 at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2141)
 at org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:2689)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:1867)
 at org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(TreeViewer.java:721)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1842)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1799)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1785)
 at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1487)
 at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1422)
 at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:403)
 at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1383)
 at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1485)
 at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:537)
 at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1444)
 at com.android.ide.eclipse.adt.internal.editors.ui.tree.UiTreeBlock$2.uiElementNodeUpdated(Unknown Source)
 at com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode.invokeUiUpdateListeners(Unknown Source)
 at com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode.loadFromXmlNode(Unknown Source)
 at com.android.ide.eclipse.adt.internal.editors.resources.ResourcesEditor.xmlModelChanged(Unknown Source)
 at com.android.ide.eclipse.adt.internal.editors.AndroidEditor$XmlModelStateListener.modelChanged(Unknown Source)
 at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel.fireModelChanged(AbstractStructuredModel.java:553)
 at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel.internalModelChanged(AbstractStructuredModel.java:887)
 at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel.changedModel(AbstractStructuredModel.java:382)
 at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.changedModel(DOMModelImpl.java:167)
 at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel$DocumentToModelNotifier.regionChanged(AbstractStructuredModel.java:164)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:542)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1181)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1964)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2419)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2404)
 at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
 at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
 at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:144)
 at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replace(BasicStructuredDocument.java:2364)
 at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$0(JobSafeStructuredDocument.java:1)
 at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$1.run(JobSafeStructuredDocument.java:103)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
 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:7168)
 at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7975)
 at org.eclipse.swt.custom.StyledText.doBackspace(StyledText.java:2267)
 at org.eclipse.swt.custom.StyledText.invokeAction(StyledText.java:6976)
 at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5932)
 at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5958)
 at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5652)
 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:1103)
 at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
 at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
 at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4268)
 at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
 at org.eclipse.swt.widgets.Control.windowProc(Control.java:4160)
 at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
 at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
 at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
 at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
 at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
 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:369)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

1 个答案:

答案 0 :(得分:4)

这是WTP(Eclipse Web Tools Platform)中的一个错误。

eclipse bug 318108的一个解决方法是转到 Window |首选项 XML | XML文件|编辑,关闭在没有DTD / Schema的情况下使用推断语法

android bug 8173中提供的替代解决方法是将strings.xml的开放<resources>标记更改为:

  

<resources xmlns:android="http://schemas.android.com/apk/res/android">