Bug 75711 AstProvider should not create AST if requested by SelectionListenerWithASTManager
3.1 M2 If SelectionListenerWithASTManager waits for an AST and the editor closes we should not create an AST for that one but return null instead.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/FindOccurrencesEngine.java
}
	
	protected FindOccurrencesEngine(IOccurrencesFinder finder) {
		fFinder= finder;
	}
	
	public static FindOccurrencesEngine create(IJavaElement root, IOccurrencesFinder finder) {
		if (root == null || finder == null)
			return null;
		
		ICompilationUnit unit= (ICompilationUnit)root.getAncestor(IJavaElement.COMPILATION_UNIT);
		if (unit != null)
			return new FindOccurencesCUEngine(unit, finder);
		IClassFile cf= (IClassFile)root.getAncestor(IJavaElement.CLASS_FILE);
		if (cf != null)
			return new FindOccurencesClassFileEngine(cf, finder);
		return null;
	}
	protected abstract CompilationUnit createAST();
	
	protected abstract IJavaElement getInput();
	
	protected abstract ISourceReference getSourceReference();
	
	
	protected abstract IResource getMarkerOwner() throws JavaModelException;
	
	
	protected abstract void addSpecialAttributes(Map attributes) throws JavaModelException;