Lines 14-20
Link Here
|
14 |
import java.io.IOException; |
14 |
import java.io.IOException; |
15 |
|
15 |
|
16 |
import org.eclipse.core.resources.IFile; |
16 |
import org.eclipse.core.resources.IFile; |
|
|
17 |
import org.eclipse.core.resources.IWorkspace; |
18 |
import org.eclipse.core.resources.ResourcesPlugin; |
17 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.CoreException; |
|
|
20 |
import org.eclipse.core.runtime.IStatus; |
18 |
|
21 |
|
19 |
/** |
22 |
/** |
20 |
* Sets the encoding for the IFile on close of the stream |
23 |
* Sets the encoding for the IFile on close of the stream |
Lines 32-37
Link Here
|
32 |
public void close() throws IOException { |
35 |
public void close() throws IOException { |
33 |
super.close(); |
36 |
super.close(); |
34 |
if (_charsetName != null) { |
37 |
if (_charsetName != null) { |
|
|
38 |
|
39 |
// Need to check for source control on the resources encoding file |
40 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=190268 |
41 |
IWorkspace ws = ResourcesPlugin.getWorkspace(); |
42 |
|
43 |
// Yuck -- we need to hardcode the location of the prefs file for file encoding |
44 |
IFile resourceFile = _file.getProject().getFile(".settings/org.eclipse.core.resources.prefs"); //$NON-NLS-1$ |
45 |
IStatus result = ws.validateEdit(new IFile[]{resourceFile}, IWorkspace.VALIDATE_PROMPT); |
46 |
if (result.getSeverity() == IStatus.CANCEL) { |
47 |
// User cancelled the checkout. Don't try to edit the encoding for the file |
48 |
return; |
49 |
} |
35 |
try { |
50 |
try { |
36 |
_file.setCharset(_charsetName, null); |
51 |
_file.setCharset(_charsetName, null); |
37 |
} |
52 |
} |