Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Pogorzelski2010-05-26 08:43:24 +0000
committerPawel Pogorzelski2010-05-26 08:43:24 +0000
commite90e5d9b454809dac56bfe84b3f912e3c8faee1c (patch)
treecd41e8e0cc86a5858d842648c684b12c8d5c0645
parent977af1efbd18010d27aca184d8ec62b2f3bb38b2 (diff)
downloadeclipse.platform.team-e90e5d9b454809dac56bfe84b3f912e3c8faee1c.tar.gz
eclipse.platform.team-e90e5d9b454809dac56bfe84b3f912e3c8faee1c.tar.xz
eclipse.platform.team-e90e5d9b454809dac56bfe84b3f912e3c8faee1c.zip
Bug 309430 - DBCS3.6: CVS can not display DBCS correctly in "Apply Patch" dialog under UTF-8.
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java5
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java16
3 files changed, 18 insertions, 7 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
index 0b5bc986b..3410270ac 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
@@ -102,7 +102,7 @@ public class FileDiffResult implements IFilePatchResult {
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
- hunk.setCharset(this.charset);
+ hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setMatches(false);
}
@@ -161,7 +161,7 @@ public class FileDiffResult implements IFilePatchResult {
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
- hunk.setCharset(this.charset);
+ hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setShift(shift);
if (result.patch(lines)) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
index 51876e3ae..86c5fff2d 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -89,8 +89,7 @@ public class PatchFileTypedElement implements ITypedElement,
}
public String getCharset() throws CoreException {
- // TODO Auto-generated method stub
- return null;
+ return result.getCharset();
}
public InputStream getContents() throws CoreException {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
index 81711f1ea..494dda42c 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,12 +12,14 @@ package org.eclipse.compare.internal.patch;
import java.util.List;
-import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.patch.PatchConfiguration;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
public class WorkspaceFileDiffResult extends FileDiffResult {
@@ -53,4 +55,14 @@ public class WorkspaceFileDiffResult extends FileDiffResult {
public void refresh() {
refresh(Utilities.getReaderCreator(getTargetFile()), null);
}
+
+ public String getCharset() {
+ IFile file = getTargetFile();
+ try {
+ if (file != null)
+ return file.getCharset();
+ } catch (CoreException e) {
+ }
+ return ResourcesPlugin.getEncoding();
+ }
}

Back to the top