Bug 29696 JavaMarkerAnnotation.initialize() can be called in non UI thread.
Build I20020315 Refactoring uses documents and annotation models to actual perform the textual changes. Since refactoring operations can be executed in a non UI thread (e.g. when executed as an operation) the JavaMarkerAnnotation.initialize() method may be called in a non UI thread resulting in an assertion failure due to image creation. Caused by: org.eclipse.jface.util.Assert$AssertionFailedException: null argument; at org.eclipse.jface.util.Assert.isNotNull(Assert.java:133) at org.eclipse.jface.util.Assert.isNotNull(Assert.java:110) at org.eclipse.jface.resource.ImageRegistry.<init> (ImageRegistry.java:51) at org.eclipse.jdt.internal.ui.JavaPluginImages.getImageRegistry (JavaPluginImages.java:341) at org.eclipse.jdt.internal.ui.JavaPluginImages.get (JavaPluginImages.java:317) at org.eclipse.jdt.internal.ui.javaeditor.JavaMarkerAnnotation.initialize (JavaMarkerAnnotation.java:111) at org.eclipse.ui.texteditor.MarkerAnnotation.<init> (MarkerAnnotation.java:111) at org.eclipse.jdt.internal.ui.javaeditor.JavaMarkerAnnotation.<init> (JavaMarkerAnnotation.java:53) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$Compilati onUnitAnnotationModel.createMarkerAnnotation (CompilationUnitDocumentProvider.java:381) at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.addMarkerAnnotation (AbstractMarkerAnnotationModel.java:215) at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.catchupWithMarkers (AbstractMarkerAnnotationModel.java:394) at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.connected (AbstractMarkerAnnotationModel.java:228) at org.eclipse.jface.text.source.AnnotationModel.connect (AnnotationModel.java:139) at org.eclipse.jdt.internal.corext.textmanipulation.TextBufferFactory.acquire (TextBufferFactory.java:88) at org.eclipse.jdt.internal.corext.textmanipulation.TextBuffer.acquire (TextBuffer.java:371) at org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.aquireTextBuff er(ImportsStructure.java:538) at org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.<init> (ImportsStructure.java:85) at org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit.<init> (ImportEdit.java:33) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.getImportE dit(MoveCuUpdateCreator.java:217) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.addImport (MoveCuUpdateCreator.java:208) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.addImports ToDestinationPackage(MoveCuUpdateCreator.java:199) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.createChan geManager(MoveCuUpdateCreator.java:89) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveRefactoring.createChangeMa nager(MoveRefactoring.java:475) at org.eclipse.jdt.internal.corext.refactoring.reorg.MoveRefactoring.checkInput (MoveRefactoring.java:158) at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:59) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:94) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:95)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaMarkerAnnotation.java
break;
			case GRAY_IMAGE:
				if (fImageType != ORIGINAL_MARKER_IMAGE)
					setImage(null);
				Image originalImage= super.getImage(display);
				if (originalImage != null) {
					ImageRegistry imageRegistry= getGrayMarkerImageRegistry(display);
					if (imageRegistry != null) {
						String key= Integer.toString(originalImage.hashCode());
						Image grayImage= imageRegistry.get(key);
						if (grayImage == null) {
							grayImage= new Image(display, originalImage, SWT.IMAGE_GRAY);
							imageRegistry.put(key, grayImage);
						}
						newImage= grayImage;
					}
				}
				break;
			default:
				Assert.isLegal(false);
		}
		fImageType= newImageType;
		setImage(newImage);
		return super.getImage(display);
	}
	
	private ImageRegistry getGrayMarkerImageRegistry(Display display) {
		if (fgGrayMarkersImageRegistry == null)
			fgGrayMarkersImageRegistry= new ImageRegistry(display);
		return fgGrayMarkersImageRegistry;