Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80493 Details for
Bug 190268
Need to perform a validateEdit() before setting encoding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for 3.2.2
bug190268.txt (text/plain), 2.48 KB, created by
Walter Harley
on 2007-10-16 15:50:57 EDT
(
hide
)
Description:
Patch for 3.2.2
Filename:
MIME Type:
Creator:
Walter Harley
Created:
2007-10-16 15:50:57 EDT
Size:
2.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.apt.core >Index: src/org/eclipse/jdt/apt/core/internal/env/EncodedFileOutputStream.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/EncodedFileOutputStream.java,v >retrieving revision 1.2 >diff -u -r1.2 EncodedFileOutputStream.java >--- src/org/eclipse/jdt/apt/core/internal/env/EncodedFileOutputStream.java 19 Apr 2006 23:22:23 -0000 1.2 >+++ src/org/eclipse/jdt/apt/core/internal/env/EncodedFileOutputStream.java 16 Oct 2007 19:48:59 -0000 >@@ -14,7 +14,11 @@ > import java.io.IOException; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.jdt.apt.core.internal.AptPlugin; > > /** > * Sets the encoding for the IFile on close of the stream >@@ -23,6 +27,8 @@ > > private final String _charsetName; > >+ private static boolean _loggedEncodingFailure = false; >+ > public EncodedFileOutputStream(IFile file, BuildEnv env, String charsetName) { > super(file, env); > _charsetName = charsetName; >@@ -32,6 +38,26 @@ > public void close() throws IOException { > super.close(); > if (_charsetName != null) { >+ // Need to check for source control on the resources encoding file >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=190268 >+ IWorkspace ws = ResourcesPlugin.getWorkspace(); >+ >+ // Yuck -- we need to hardcode the location of the prefs file for file encoding >+ IFile resourceFile = _file.getProject().getFile(".settings/org.eclipse.core.resources.prefs"); //$NON-NLS-1$ >+ IStatus result = ws.validateEdit(new IFile[]{resourceFile}, null); >+ if (result.getSeverity() == IStatus.CANCEL) { >+ // User cancelled the checkout. Don't try to edit the encoding for the file >+ return; >+ } >+ else if (result.getSeverity() == IStatus.ERROR) { >+ // No file modification validator, and prefs file is read-only. Log warning and continue. >+ if (!_loggedEncodingFailure) { >+ _loggedEncodingFailure = true; >+ AptPlugin.logWarning(null, "Unable to set encoding on file " + _file.getName() + //$NON-NLS-1$ >+ ": check that .settings/org.eclipse.core.resources.prefs is writeable."); //$NON-NLS-1$ >+ } >+ return; >+ } > try { > _file.setCharset(_charsetName, null); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 190268
:
69640
| 80493