Source:
<code>protected void addToCompare(IProgressMonitor monitor, CompareData data, PresentationType presentationType, ArtifactDelta artifactDelta) throws OseeCoreException { Pair<String, Boolean> originalValue = null; Artifact baseArtifact = artifactDelta.getStartArtifact(); Artifact newerArtifact = artifactDelta.getEndArtifact(); Attribute<String> baseContent = getWordContent(baseArtifact); Attribute<String> newerContent = getWordContent(newerArtifact); if (!UserManager.getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) { originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent); } monitor.setTaskName("Preparing comparison for: " + (newerArtifact == null ? baseArtifact.getName() : newerArtifact.getName())); Pair<IFile, IFile> compareFiles; if (artifactDelta.getStartArtifact() == artifactDelta.getBaseArtifact()) { compareFiles = converter.convertToFile(presentationType, artifactDelta); } else { List<IFile> outputFiles = new ArrayList<IFile>(); converter.convertToFileForMerge(outputFiles, artifactDelta.getBaseArtifact(), artifactDelta.getStartArtifact()); converter.convertToFileForMerge(outputFiles, artifactDelta.getBaseArtifact(), artifactDelta.getEndArtifact()); if (outputFiles.size() == 1) { <START> try { <END> String tempFileName = outputFiles.get(0).getRawLocation().toOSString(); tempFileName = tempFileName.substring(0, tempFileName.length() - 4); File tempFile = new File(tempFileName + ".temp.xml"); Lib.writeStringToFile("", tempFile); IFile constructIFile = AIFile.constructIFile(tempFile.getPath()); outputFiles.add(constructIFile); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } } compareFiles = new Pair<IFile, IFile>(outputFiles.get(0), outputFiles.get(1)); data.addMerge(outputFiles.get(0).getLocation().toOSString()); } WordImageChecker.restoreOriginalValue(baseContent, originalValue); data.add(compareFiles.getFirst().getLocation().toOSString(), compareFiles.getSecond().getLocation().toOSString()); }</code><technical_language>Lib.removeExtension</technical_language>

Target:
protected void addToCompare(IProgressMonitor monitor, CompareData data, PresentationType presentationType, ArtifactDelta artifactDelta) throws OseeCoreException { Pair<String, Boolean> originalValue = null; Artifact baseArtifact = artifactDelta.getStartArtifact(); Artifact newerArtifact = artifactDelta.getEndArtifact(); Attribute<String> baseContent = getWordContent(baseArtifact); Attribute<String> newerContent = getWordContent(newerArtifact); if (!UserManager.getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) { originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent); } monitor.setTaskName("Preparing comparison for: " + (newerArtifact == null ? baseArtifact.getName() : newerArtifact.getName())); Pair<IFile, IFile> compareFiles; if (artifactDelta.getStartArtifact() == artifactDelta.getBaseArtifact()) { compareFiles = converter.convertToFile(presentationType, artifactDelta); } else { List<IFile> outputFiles = new ArrayList<IFile>(); converter.convertToFileForMerge(outputFiles, artifactDelta.getBaseArtifact(), artifactDelta.getStartArtifact()); converter.convertToFileForMerge(outputFiles, artifactDelta.getBaseArtifact(), artifactDelta.getEndArtifact()); if (outputFiles.size() == 1) { String outputFileName = outputFiles.get(0).getRawLocation().toOSString(); try { String tempFileName = Lib.removeExtension(outputFileName); File tempFile = new File(tempFileName + ".temp.xml"); Lib.writeStringToFile("", tempFile); IFile constructIFile = AIFile.constructIFile(tempFile.getPath()); outputFiles.add(constructIFile); } catch (IOException ex) { throw new OseeCoreException(ex, "Empty file for comparison could not be created, [%s]", outputFileName); } } compareFiles = new Pair<IFile, IFile>(outputFiles.get(0), outputFiles.get(1)); data.addMerge(outputFiles.get(0).getLocation().toOSString()); } WordImageChecker.restoreOriginalValue(baseContent, originalValue); data.add(compareFiles.getFirst().getLocation().toOSString(), compareFiles.getSecond().getLocation().toOSString()); }