workingCopies= JavaUI.getSharedWorkingCopiesOnClasspath(); result= doSearchForReferences("A", workingCopies);
result= doSearchForReferences("A", null);
	public void testSearchInWorkingCopies2() throws Exception {			IPackageFragmentRoot root1= JavaProjectHelper.addSourceContainer(fJavaProject1, "src");		IPackageFragment pack1= root1.createPackageFragment("pack1", true, null);				StringBuffer buf= new StringBuffer();		buf.append("public class A {\n");		buf.append("}\n");		ICompilationUnit cu1= pack1.getCompilationUnit("A.java");		cu1.createType(buf.toString(), null, true, null);		buf= new StringBuffer();		buf.append("public class B {\n");		buf.append("    A a;\n");		buf.append("}\n");		ICompilationUnit cu2= pack1.getCompilationUnit("B.java");		cu2.createType(buf.toString(), null, true, null);				IPackageFragment pack2= root1.createPackageFragment("pack2", true, null);				buf= new StringBuffer();		buf.append("public class C {\n");		buf.append("    //Here\n");		buf.append("}\n");		ICompilationUnit cu3= pack2.getCompilationUnit("C.java");		cu3.createType(buf.toString(), null, true, null);				// empty array when USE_WORKING_COPY_OWNERS is true		IWorkingCopy[] workingCopies= JavaUI.getSharedWorkingCopiesOnClasspath();					List result= doSearchForReferences("A", workingCopies);		assertTrue("Should contain 1 references, contains: " + result.size(), result.size() == 1);				IEditorPart part= EditorUtility.openInEditor(cu3);		try {			IDocument document= JavaUI.getDocumentProvider().getDocument(part.getEditorInput());			String replacedString= "//Here";						int offset= document.search(0, replacedString, true, true, false);						document.replace(offset, replacedString.length(), "A a;");						workingCopies= JavaUI.getSharedWorkingCopiesOnClasspath();			result= doSearchForReferences("A", workingCopies);			assertTrue("Should contain 2 references, contains: " + result.size(), result.size() == 2);								ICompilationUnit wcopy= (ICompilationUnit) cu2.getWorkingCopy(); // create sand box working copy			try {				String source= wcopy.getSource();				replacedString= "A a;";				offset= source.indexOf(replacedString);				source= source.substring(0, offset) + source.substring(offset + replacedString.length()); // remove reference				wcopy.getBuffer().setContents(source);					workingCopies= JavaUI.getSharedWorkingCopiesOnClasspath();				IWorkingCopy[] newWorkingCopies= new IWorkingCopy[workingCopies.length + 1];				System.arraycopy(workingCopies, 0, newWorkingCopies, 0, workingCopies.length);				newWorkingCopies[workingCopies.length]= wcopy;								result= doSearchForReferences("A", newWorkingCopies);				assertTrue("Should contain 1 references, contains: " + result.size(), result.size() == 1);								// no save			} finally {				wcopy.destroy();			}		} finally {			JavaPlugin.getActivePage().closeAllEditors(false);		}				workingCopies= JavaUI.getSharedWorkingCopiesOnClasspath();		result= doSearchForReferences("A", workingCopies);		assertTrue("Should contain 1 references, contains: " + result.size(), result.size() == 1);	}