Bug 84747 Widget is disposed error updating ProblemTableViewer
I20050208-0800 I had just done a refactoring that had moved a static method to another class. The refactoring had introduced errors in the moved methods as it referenced private static variables in the original location. I received the warning dialog about these errors but continued. On the next save: org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:2839) at org.eclipse.swt.SWT.error(SWT.java:2762) at org.eclipse.swt.SWT.error(SWT.java:2733) at org.eclipse.swt.widgets.Widget.error(Widget.java:393) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:295) at org.eclipse.swt.widgets.Widget.getData(Widget.java:446) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTableViewer.doUpdateItem (ProblemTableViewer.java:75) at org.eclipse.jdt.internal.ui.viewsupport.ResourceToItemsMapper.updateItem (ResourceToItemsMapper.java:73) at org.eclipse.jdt.internal.ui.viewsupport.ResourceToItemsMapper.resourceChanged (ResourceToItemsMapper.java:67) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTableViewer.handleLabelProviderC hanged(ProblemTableViewer.java:123) at org.eclipse.jface.viewers.ContentViewer$1.labelProviderChanged (ContentViewer.java:74) at org.eclipse.jdt.ui.ProblemsLabelDecorator.fireProblemsChanged (ProblemsLabelDecorator.java:357) at org.eclipse.jdt.ui.ProblemsLabelDecorator.access$0 (ProblemsLabelDecorator.java:352) at org.eclipse.jdt.ui.ProblemsLabelDecorator$1.problemsChanged (ProblemsLabelDecorator.java:332) at org.eclipse.jdt.internal.ui.viewsupport.ProblemMarkerManager$1.run (ProblemMarkerManager.java:176) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:118) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2855) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2519) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1622) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1588) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:299) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:227) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:281) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:131) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:261) at org.eclipse.core.launcher.Main.run(Main.java:817) at org.eclipse.core.launcher.Main.main(Main.java:801)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/ResourceToItemsMapper.java
public boolean isEmpty() {
		return fResourceToItem.isEmpty();
	}	
	
	/**
	 * Method that decides which elements can have error markers
	 * Returns null if an element can not have error markers.
	 * @param element The input element
	 * @return Returns the corresponding resource or null
	 */	
	private static IResource getCorrespondingResource(Object element) {
		if (element instanceof IJavaElement) {
			IJavaElement elem= (IJavaElement) element;
			IResource res= elem.getResource();
			if (res == null) {
				ICompilationUnit cu= (ICompilationUnit) elem.getAncestor(IJavaElement.COMPILATION_UNIT);
				if (cu != null) {
					
					res= cu.getResource();
				}
			}
			return res; 
		} else if (element instanceof IResource) {
			return (IResource) element;
		}
		return null;
	}
	
}