<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . internal . codeassist . ISearchRequestor ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; public class CancelableNameEnvironment extends SearchableEnvironment implements INameEnvironmentWithProgress { private IProgressMonitor monitor ; public CancelableNameEnvironment ( JavaProject project , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { super ( project , owner ) ; setMonitor ( monitor ) ; } private void checkCanceled ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) { if ( NameLookup . VERBOSE ) System . out . println ( Thread . currentThread ( ) + "" ) ; throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; } } public void findPackages ( char [ ] prefix , ISearchRequestor requestor ) { checkCanceled ( ) ; super . findPackages ( prefix , requestor ) ; } public NameEnvironmentAnswer findType ( char [ ] name , char [ ] [ ] packageName ) { checkCanceled ( ) ; return super . findType ( name , packageName ) ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { checkCanceled ( ) ; return super . findType ( compoundTypeName ) ; } public void findTypes ( char [ ] prefix , boolean findMembers , boolean camelCaseMatch , int searchFor , ISearchRequestor storage , IProgressMonitor progressMonitor ) { checkCanceled ( ) ; super . findTypes ( prefix , findMembers , camelCaseMatch , searchFor , storage , progressMonitor ) ; } public void setMonitor ( IProgressMonitor monitor ) { this . monitor = monitor ; } } </s>