我正在使用graphiti应用程序并实现了一个修改资源属性的功能。在更改时,它会通知我实现的ResourceSetListener类并更新图编辑器中的相应形状。它做得很好,正是我想要它做的,除了它显示弹出错误说"图形被处理"。
org.eclipse.swt.SWTException: Graphic is disposed
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.SWT.error(SWT.java:4327)
at org.eclipse.swt.graphics.Font.getFontData(Font.java:184)
at org.eclipse.draw2d.ScaledGraphics.getCachedFontData(ScaledGraphics.java:533)
at org.eclipse.draw2d.ScaledGraphics.zoomFont(ScaledGraphics.java:922)
at org.eclipse.draw2d.ScaledGraphics.setLocalFont(ScaledGraphics.java:848)
at org.eclipse.draw2d.ScaledGraphics.setFont(ScaledGraphics.java:767)
at org.eclipse.draw2d.Figure.paint(Figure.java:1111)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1206)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.graphiti.ui.internal.fixed.FixedScalableFreeformLayeredPane.paintClientArea(FixedScalableFreeformLayeredPane.java:53)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1197)
at org.eclipse.draw2d.Viewport.paintClientArea(Viewport.java:160)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1167)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1202)
at org.eclipse.draw2d.Figure.paint(Figure.java:1117)
at org.eclipse.draw2d.DeferredUpdateManager.paint(DeferredUpdateManager.java:165)
at org.eclipse.draw2d.LightweightSystem.paint(LightweightSystem.java:203)
at org.eclipse.draw2d.LightweightSystem$2.handleEvent(LightweightSystem.java:110)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1491)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4667)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5036)
at org.eclipse.swt.internal.win32.OS.RedrawWindow(Native Method)
at org.eclipse.swt.widgets.Control.update(Control.java:4436)
at org.eclipse.swt.widgets.Control.update(Control.java:4426)
at org.eclipse.jface.fieldassist.ExampleControlDecoration.update(ExampleControlDecoration.java:1060)
at org.eclipse.jface.fieldassist.ExampleControlDecoration.setImage(ExampleControlDecoration.java:947)
at com.myproject.example.common.control.ExampleDecoratedField.showDecoration(ExampleDecoratedField.java:215)
at com.myproject.example.common.control.ExampleDecoratedField.setContentAssistMessage(ExampleDecoratedField.java:160)
at com.myproject.example.common.control.ExampleTextField.setFieldMessage(ExampleTextField.java:113)
at com.myproject.example.common.control.ExampleTextField.<init>(ExampleTextField.java:95)
at com.myproject.example.common.properties.ExampleAbstractPropertyPage.createTextField2(ExampleAbstractPropertyPage.java:725)
at com.myproject.example.common.properties.ExampleAbstractPropertyPage.createTextField(ExampleAbstractPropertyPage.java:649)
at com.myproject.example.common.properties.ExampleAbstractPropertyPage.createField(ExampleAbstractPropertyPage.java:516)
at com.myproject.example.propertypages.ExampleCommonDescriptionPP.createControl(ExampleCommonDescriptionPP.java:81)
at com.myproject.example.common.properties.ExampleAbstractPropertyPage.createControls(ExampleAbstractPropertyPage.java:273)
at org.eclipse.ui.views.properties.tabbed.TabContents$1.run(TabContents.java:109)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
at org.eclipse.ui.views.properties.tabbed.TabContents.createControls(TabContents.java:112)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage$SelectionChangedListener.selectionChanged(TabbedPropertySheetPage.java:206)
at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2171)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1202)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1231)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:236)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:408)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:782)
at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList.select(TabbedPropertyList.java:864)
at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer.setSelectionToWidget(TabbedPropertyViewer.java:122)
at org.eclipse.jface.viewers.StructuredViewer.setSelectionToWidget(StructuredViewer.java:1749)
at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1705)
at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:388)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.setInput(TabbedPropertySheetPage.java:748)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.selectionChanged(TabbedPropertySheetPage.java:556)
at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:365)
at org.eclipse.ui.internal.e4.compatibility.SelectionService.notifyListeners(SelectionService.java:218)
at org.eclipse.ui.internal.e4.compatibility.SelectionService.handlePostSelectionChanged(SelectionService.java:122)
at org.eclipse.ui.internal.e4.compatibility.SelectionService.access$1(SelectionService.java:112)
at org.eclipse.ui.internal.e4.compatibility.SelectionService$3.selectionChanged(SelectionService.java:80)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$4.run(SelectionAggregator.java:166)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.notifyPostListeners(SelectionAggregator.java:163)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.access$8(SelectionAggregator.java:160)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8$1.run(SelectionAggregator.java:272)
at org.eclipse.e4.core.contexts.RunAndTrack.runExternalCode(RunAndTrack.java:56)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8.changed(SelectionAggregator.java:269)
at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110)
at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:338)
at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:352)
at org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl.setPostSelection(SelectionServiceImpl.java:36)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$3.selectionChanged(CompatibilityPart.java:127)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer.fireSelectionChanged(AbstractEditPartViewer.java:247)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer$1.run(AbstractEditPartViewer.java:131)
at org.eclipse.gef.SelectionManager.fireSelectionChanged(SelectionManager.java:144)
at org.eclipse.gef.SelectionManager.deselect(SelectionManager.java:118)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer.deselect(AbstractEditPartViewer.java:202)
at org.eclipse.gef.editparts.AbstractEditPart.removeNotify(AbstractEditPart.java:942)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.removeNotify(AbstractGraphicalEditPart.java:823)
at org.eclipse.gef.editparts.AbstractEditPart.removeChild(AbstractEditPart.java:880)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.deleteChildAndRefresh(ShapeEditPart.java:153)
at org.eclipse.graphiti.ui.internal.parts.PictogramElementDelegate.refreshFigureForEditPart(PictogramElementDelegate.java:357)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refreshVisuals(ShapeEditPart.java:699)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:725)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refresh(ShapeEditPart.java:594)
at org.eclipse.graphiti.ui.internal.parts.PictogramElementDelegate.refreshEditPartsForModelChildrenAndSourceConnections(PictogramElementDelegate.java:313)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refreshChildren(ShapeEditPart.java:680)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:726)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refresh(ShapeEditPart.java:594)
at org.eclipse.graphiti.ui.internal.parts.PictogramElementDelegate.refreshEditPartsForModelChildrenAndSourceConnections(PictogramElementDelegate.java:313)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refreshChildren(ShapeEditPart.java:680)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:726)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
at org.eclipse.graphiti.ui.internal.parts.ShapeEditPart.refresh(ShapeEditPart.java:594)
at org.eclipse.graphiti.ui.internal.parts.DiagramEditPart.refresh(DiagramEditPart.java:187)
at org.eclipse.graphiti.ui.editor.DefaultRefreshBehavior.internalRefreshEditPart(DefaultRefreshBehavior.java:262)
at org.eclipse.graphiti.ui.editor.DefaultRefreshBehavior.refresh(DefaultRefreshBehavior.java:175)
at org.eclipse.graphiti.ui.editor.DiagramBehavior.refresh(DiagramBehavior.java:771)
at org.eclipse.graphiti.ui.internal.editor.DiagramRefreshJob.runInUIThread(DiagramRefreshJob.java:103)
at org.eclipse.graphiti.ui.internal.editor.DiagramChangeListener.resourceSetChanged(DiagramChangeListener.java:151)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:84)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:138)
at org.eclipse.graphiti.ui.editor.DiagramBehavior.executeFeature(DiagramBehavior.java:1088)
at com.myproject.example.screen.diagram.ExampleModelChangeListener$1.run(ExampleModelChangeListener.java:135)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
答案 0 :(得分:0)
我不知道graphiti,但听起来有时在控件处理后调用了侦听器(即窗口已关闭)。对于异步调用的侦听器,通常就是这种情况。
在您的侦听器中添加一个检查以查找正在处理的控件:
if (!control.isDisposed())
{
... do work
}
答案 1 :(得分:0)
尝试重新启动
或
文件->切换工作区->其他并选择当前文件。 第一个为我工作。