Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-03-08 18:55:41 +0000
committerKai Maetzel2004-03-08 18:55:41 +0000
commit6cd5b5ffd09910a580d408987ae315ed672c1086 (patch)
tree7c16ef880432a4153841742b729046166f26ce5d /org.eclipse.ui.editors
parentecbcffd018e5782f4d15df0530e181d26eff2357 (diff)
downloadeclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.tar.gz
eclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.tar.xz
eclipse.platform.text-6cd5b5ffd09910a580d408987ae315ed672c1086.zip
unwind #54058
Diffstat (limited to 'org.eclipse.ui.editors')
-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
2 files changed, 6 insertions, 26 deletions
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 2baa9d1c2..ffbea9281 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 be6216b8a..5b6787d37 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