Bug 3658 JDT change listener efficiency issue (1GEMN5F)
ClassFileMarkerAnnotationModel.visit is very much less than optimal if fMarkerResource is set. It traverses the entire delta only looking for a particular resource! I don't understand when fMarkerResource is set and when it is not but in the case I saw, it was set to be a particular project resource which was not even in the list of resources which changed in the large delta I was processing. The net result of this was that the listener traversed the entire delta (~1500 resources) checking at each node to see if the node was equal to fMarkerResource. Since the listener knows that it is only interested in that one resource, it should just take the delta and look in it to see if the resource in question is there. The current IResourceDelta api is not optimal for doing this but it certainly can be done and would be very much more efficient than the current approach. We will look at adding the required API but this late in the game I would not hope for too much. NOTES: JBL (6/1/2001 11:47:09 AM) ClassFileMarkerAnnotationModel is JUI. Moving to ITPJUI. KUM (8/6/2001 4:41:57 PM) Sent mail to JMA regarding expected core support.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileMarkerAnnotationModel.java
package org.eclipse.jdt.internal.ui.javaeditor;
/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.JavaCore;
/**
 *
 */
public class ClassFileMarkerAnnotationModel extends AbstractMarkerAnnotationModel implements IResourceChangeListener, IResourceDeltaVisitor {
	protected IClassFile fClassFile;
	protected IWorkspace fWorkspace;
	protected IResource fMarkerResource;