int offset= document.search(0, replacedString, true, true, false);
int offset= document.get().indexOf(replacedString);
	public void testLineDelimiterConsistency1() throws Exception {		// mixed line delimiters				IPackageFragmentRoot root1= JavaProjectHelper.addSourceContainer(fJavaProject1, "src");		IPackageFragment pack1= root1.createPackageFragment("pack1", true, null);				StringBuffer buf= new StringBuffer();		buf.append("package pack1;\n");		buf.append("\n");		buf.append("public class A {\n");		buf.append("    //Here\r\n");		buf.append("}\n");		ICompilationUnit cu1= pack1.createCompilationUnit("A.java", buf.toString(), true, null);		IEditorPart part= EditorUtility.openInEditor(cu1);		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;");						cu1= JavaModelUtil.toWorkingCopy(cu1); // no-op when USE_WORKING_COPY_OWNERS is true			buf= new StringBuffer();			buf.append("package pack1;\n");			buf.append("\n");			buf.append("public class A {\n");			buf.append("    A a;\r\n");			buf.append("}\n");			String expected= buf.toString();						assertEqualString(cu1.getSource(), expected);						ICompilationUnit wcopy= (ICompilationUnit) cu1.getWorkingCopy(); // create sand box working copy			try {				assertEqualString(wcopy.getSource(), expected);				IResource resource= wcopy.getResource();				assertNotNull(resource);				// no save			} finally {				wcopy.destroy();			}		} finally {			JavaPlugin.getActivePage().closeAllEditors(false);		}	}