Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-03-08 18:55:41 +0000
committerKai Maetzel2004-03-08 18:55:41 +0000
commit6cd5b5ffd09910a580d408987ae315ed672c1086 (patch)
tree7c16ef880432a4153841742b729046166f26ce5d
parentecbcffd018e5782f4d15df0530e181d26eff2357 (diff)
downloadeclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.tar.gz
eclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.tar.xz
eclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.zip
unwind #54058
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java22
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java31
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties1
3 files changed, 8 insertions, 46 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
index 9a3535835a5..b18404c0475 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
@@ -111,7 +111,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
public void setEncoding(String encoding) {
fEncoding= encoding;
try {
- fFile.setCharset(encoding);
+ fFile.setPersistentProperty(ENCODING_KEY, encoding);
} catch (CoreException x) {
handleCoreException(x);
}
@@ -193,25 +193,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
*/
protected void initializeFileBufferContent(IProgressMonitor monitor) throws CoreException {
try {
- fEncoding= null;
- try {
- fEncoding= fFile.getPersistentProperty(ENCODING_KEY);
- } catch (CoreException x) {
- // we ignore exceptions here because we support the ENCODING_KEY property only for compatibility reasons
- }
- if (fEncoding != null) {
- // if we found an old encoding property, we try to migrate it to the new core.resources encoding support
- try {
- fFile.setCharset(fEncoding);
- // if successful delete old property
- fFile.setPersistentProperty(ENCODING_KEY, null);
- } catch (CoreException ex) {
- // log problem because we could not migrate the property successfully
- handleCoreException(ex);
- }
- } else {
- fEncoding= fFile.getCharset();
- }
+ fEncoding= fFile.getPersistentProperty(ENCODING_KEY);
fDocument= fManager.createEmptyDocument(fFile.getLocation());
setDocumentContent(fDocument, fFile.getContents(), fEncoding);
} catch (CoreException x) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
index 2baa9d1c2b9..ffbea928122 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
@@ -757,7 +757,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
// --------------- Encoding support ---------------
/**
- * Returns the persisted encoding for the given element.
+ * Returns the persited encoding for the given element.
*
* @param element the element for which to get the persisted encoding
* @since 2.1
@@ -766,31 +766,12 @@ public class FileDocumentProvider extends StorageDocumentProvider {
if (element instanceof IFileEditorInput) {
IFileEditorInput editorInput= (IFileEditorInput)element;
IFile file= editorInput.getFile();
- if (file != null) {
- String encoding= null;
+ if (file != null)
try {
- encoding= file.getPersistentProperty(ENCODING_KEY);
- } catch (CoreException x) {
- // we ignore exceptions here because we support the ENCODING_KEY property only for compatibility reasons
- }
- if (encoding != null) {
- // if we found an old encoding property, we try to migrate it to the new core.resources encoding support
- try {
- file.setCharset(encoding);
- // if successful delete old property
- file.setPersistentProperty(ENCODING_KEY, null);
- } catch (CoreException ex) {
- handleCoreException(ex, TextEditorMessages.getString("FileDocumentProvider.getPersistedEncoding")); //$NON-NLS-1$
- }
- } else {
- try {
- encoding= file.getCharset();
- } catch (CoreException e) {
- encoding= null;
- }
+ return file.getPersistentProperty(ENCODING_KEY);
+ } catch (CoreException ex) {
+ return null;
}
- return encoding;
- }
}
return null;
}
@@ -807,7 +788,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
IFileEditorInput editorInput= (IFileEditorInput)element;
IFile file= editorInput.getFile();
if (file != null)
- file.setCharset(encoding);
+ file.setPersistentProperty(ENCODING_KEY, encoding);
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
index be6216b8ad7..5b6787d3727 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
@@ -18,7 +18,6 @@ FileDocumentProvider.resourceChanged=FileDocumentProvider.resourceChanged
FileDocumentProvider.task.saving=Saving
FileDocumentProvider.updateContent=FileDocumentProvider.updateContent
FileDocumentProvider.resetDocument=FileDocumentProvider.resetDocument
-FileDocumentProvider.getPersistedEncoding=Cannot migrate encoding property
StorageDocumentProvider.updateCache=StorageDocumentProvider.updateCache
StorageDocumentProvider.isReadOnly=StorageDocumentProvider.isReadOnly

Back to the top