From 3db8c41531f3660150594a387d12145dab0767a5 Mon Sep 17 00:00:00 2001 From: Karsten Thoms Date: Sun, 10 Feb 2019 13:01:01 +0100 Subject: Bug 518569 - Use StandardCharset constants Also: version bump for 4.11 Change-Id: I7055e6a2ceb521dbe6065888b735ac62caa73ef6 Signed-off-by: Karsten Thoms --- org.eclipse.core.filebuffers/META-INF/MANIFEST.MF | 2 +- org.eclipse.core.filebuffers/pom.xml | 2 +- .../filebuffers/FileStoreTextFileBuffer.java | 12 ++++------ .../filebuffers/ResourceTextFileBuffer.java | 25 +++++--------------- org.eclipse.search.tests/META-INF/MANIFEST.MF | 2 +- org.eclipse.search.tests/pom.xml | 2 +- .../tests/filesearch/FileCharSequenceTests.java | 10 ++++---- .../core/text/FileCharSequenceProvider.java | 6 ++--- org.eclipse.text/META-INF/MANIFEST.MF | 2 +- org.eclipse.text/pom.xml | 2 +- .../text/templates/TemplateReaderWriter.java | 3 ++- org.eclipse.ui.editors/META-INF/MANIFEST.MF | 2 +- org.eclipse.ui.editors/pom.xml | 2 +- .../ui/editors/text/FileDocumentProvider.java | 27 +++++----------------- .../quickdiff/LastSaveReferenceProvider.java | 3 ++- .../ui/texteditor/AbstractDecoratedTextEditor.java | 3 ++- .../META-INF/MANIFEST.MF | 2 +- org.eclipse.ui.genericeditor.tests/pom.xml | 2 +- .../tests/AbstratGenericEditorTest.java | 7 +++--- org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF | 2 +- org.eclipse.ui.genericeditor/pom.xml | 2 +- 21 files changed, 44 insertions(+), 76 deletions(-) diff --git a/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF b/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF index 4100db504eb..07a476c2824 100644 --- a/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF +++ b/org.eclipse.core.filebuffers/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.core.filebuffers; singleton:=true -Bundle-Version: 3.6.400.qualifier +Bundle-Version: 3.6.500.qualifier Bundle-Activator: org.eclipse.core.internal.filebuffers.FileBuffersPlugin Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/org.eclipse.core.filebuffers/pom.xml b/org.eclipse.core.filebuffers/pom.xml index 357f65179e5..b761eaebb6d 100644 --- a/org.eclipse.core.filebuffers/pom.xml +++ b/org.eclipse.core.filebuffers/pom.xml @@ -18,6 +18,6 @@ org.eclipse.core org.eclipse.core.filebuffers - 3.6.400-SNAPSHOT + 3.6.500-SNAPSHOT eclipse-plugin diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java index 171e3686254..bbaad7989a7 100644 --- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java +++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java @@ -29,6 +29,7 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.CodingErrorAction; import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.nio.charset.UnmappableCharacterException; import java.nio.charset.UnsupportedCharsetException; @@ -93,10 +94,6 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex * Constant for representing the error status. This is considered a value object. */ private static final IStatus STATUS_ERROR= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.FileBuffer_status_error, null); - /** - * Constant denoting UTF-8 encoding. - */ - private static final String CHARSET_UTF_8= "UTF-8"; //$NON-NLS-1$ /** * Constant denoting an empty set of properties @@ -297,7 +294,6 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex return desc.getContentType(); return null; } - } catch (IOException x) { throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(FileBuffersMessages.FileBuffer_error_queryContentDescription, fFileStore.toString()), x)); } @@ -427,7 +423,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (fHasBOM && CHARSET_UTF_8.equals(encoding)) + if (fHasBOM && StandardCharsets.UTF_8.name().equals(encoding)) stream= new SequenceInputStream(new ByteArrayInputStream(IContentDescription.BOM_UTF_8), stream); @@ -451,7 +447,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (fHasBOM && CHARSET_UTF_8.equals(encoding)) + if (fHasBOM && StandardCharsets.UTF_8.name().equals(encoding)) out.write(IContentDescription.BOM_UTF_8); out.write(bytes, 0, bytesLength); @@ -524,7 +520,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (hasBOM && CHARSET_UTF_8.equals(encoding)) { + if (hasBOM && StandardCharsets.UTF_8.name().equals(encoding)) { int n= 0; do { int bytes= contentStream.read(new byte[IContentDescription.BOM_UTF_8.length]); 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 cc1fd6c43b8..69a3e4dc164 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 @@ -27,6 +27,7 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.CodingErrorAction; import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.nio.charset.UnmappableCharacterException; import java.nio.charset.UnsupportedCharsetException; @@ -97,20 +98,6 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF * Constant for representing the error status. This is considered a value object. */ static final private IStatus STATUS_ERROR= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.FileBuffer_status_error, null); - /** - * Constant denoting UTF-8 encoding. - */ - private static final String CHARSET_UTF_8= "UTF-8"; //$NON-NLS-1$ - /** - * Constant denoting UTF-16 encoding. - * @since 3.4 - */ - private static final String CHARSET_UTF_16= "UTF-16"; //$NON-NLS-1$ - /** - * Constant denoting UTF-16LE encoding. - * @since 3.4 - */ - private static final String CHARSET_UTF_16LE= "UTF-16LE"; //$NON-NLS-1$ /** * Constant denoting an empty set of properties @@ -311,8 +298,8 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF String encoding= computeEncoding(); - if (fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16.equals(encoding)) - encoding= CHARSET_UTF_16LE; + if (fBOM == IContentDescription.BOM_UTF_16LE && StandardCharsets.UTF_16.name().equals(encoding)) + encoding= StandardCharsets.UTF_16LE.name(); Charset charset; try { @@ -355,10 +342,10 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (fBOM == IContentDescription.BOM_UTF_8 && CHARSET_UTF_8.equals(encoding)) + if (fBOM == IContentDescription.BOM_UTF_8 && StandardCharsets.UTF_8.name().equals(encoding)) stream= new SequenceInputStream(new ByteArrayInputStream(IContentDescription.BOM_UTF_8), stream); - if (fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16LE.equals(encoding)) + if (fBOM == IContentDescription.BOM_UTF_16LE && StandardCharsets.UTF_16LE.name().equals(encoding)) stream= new SequenceInputStream(new ByteArrayInputStream(IContentDescription.BOM_UTF_16LE), stream); if (fFile.exists()) { @@ -513,7 +500,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (fBOM != null && CHARSET_UTF_8.equals(encoding)) { + if (fBOM != null && StandardCharsets.UTF_8.name().equals(encoding)) { int n= 0; do { int bytes= contentStream.read(new byte[IContentDescription.BOM_UTF_8.length]); diff --git a/org.eclipse.search.tests/META-INF/MANIFEST.MF b/org.eclipse.search.tests/META-INF/MANIFEST.MF index 08de3d9b906..34965719969 100644 --- a/org.eclipse.search.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.search.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.search.tests -Bundle-Version: 3.9.200.qualifier +Bundle-Version: 3.9.300.qualifier Bundle-Activator: org.eclipse.search.tests.SearchTestPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/org.eclipse.search.tests/pom.xml b/org.eclipse.search.tests/pom.xml index 5db2b4e4d66..bd9da0c0c09 100644 --- a/org.eclipse.search.tests/pom.xml +++ b/org.eclipse.search.tests/pom.xml @@ -19,7 +19,7 @@ org.eclipse.search org.eclipse.search.tests - 3.9.200-SNAPSHOT + 3.9.300-SNAPSHOT eclipse-test-plugin ${project.artifactId} diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileCharSequenceTests.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileCharSequenceTests.java index 04e6af4a646..89943e6b03e 100644 --- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileCharSequenceTests.java +++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileCharSequenceTests.java @@ -16,6 +16,7 @@ package org.eclipse.search.tests.filesearch; import static org.junit.Assert.assertFalse; import java.io.IOException; +import java.nio.charset.StandardCharsets; import org.junit.After; import org.junit.Assert; @@ -53,8 +54,7 @@ public class FileCharSequenceTests { for (int i= 0; i < 500; i++) { buf.append(TEST_CONTENT); } - String encoding= "ISO-8859-1"; - testForEncoding(buf, encoding); + testForEncoding(buf, StandardCharsets.ISO_8859_1.name()); } @Test @@ -63,8 +63,7 @@ public class FileCharSequenceTests { for (int i= 0; i < 2000; i++) { buf.append(TEST_CONTENT); } - String encoding= "UTF-8"; - testForEncoding(buf, encoding); + testForEncoding(buf, StandardCharsets.UTF_8.name()); } @Test @@ -73,8 +72,7 @@ public class FileCharSequenceTests { for (int i= 0; i < FileCharSequenceProvider.BUFFER_SIZE * 2; i++) { buf.append(TEST_CONTENT); } - String encoding= "UTF-16"; - testForEncoding(buf, encoding); + testForEncoding(buf, StandardCharsets.UTF_16.name()); } private void testForEncoding(CharSequence buf, String encoding) throws CoreException, IOException { diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java index cc8daff399c..080ac46459b 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import org.eclipse.core.runtime.CoreException; @@ -232,9 +233,6 @@ public class FileCharSequenceProvider { } private final class FileCharSequence implements CharSequence { - - private static final String CHARSET_UTF_8= "UTF-8"; //$NON-NLS-1$ - private Reader fReader; private int fReaderPos; @@ -277,7 +275,7 @@ public class FileCharSequenceProvider { boolean ok= false; InputStream contents= fFile.getContents(); try { - if (CHARSET_UTF_8.equals(charset)) { + if (StandardCharsets.UTF_8.name().equals(charset)) { /* * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html diff --git a/org.eclipse.text/META-INF/MANIFEST.MF b/org.eclipse.text/META-INF/MANIFEST.MF index e0240c679f5..f311cdea65e 100644 --- a/org.eclipse.text/META-INF/MANIFEST.MF +++ b/org.eclipse.text/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.text -Bundle-Version: 3.8.0.qualifier +Bundle-Version: 3.8.100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: diff --git a/org.eclipse.text/pom.xml b/org.eclipse.text/pom.xml index 0d88dcc9f23..67dcf235cbc 100644 --- a/org.eclipse.text/pom.xml +++ b/org.eclipse.text/pom.xml @@ -18,6 +18,6 @@ org.eclipse.text org.eclipse.text - 3.8.0-SNAPSHOT + 3.8.100-SNAPSHOT eclipse-plugin diff --git a/org.eclipse.text/src/org/eclipse/text/templates/TemplateReaderWriter.java b/org.eclipse.text/src/org/eclipse/text/templates/TemplateReaderWriter.java index bb958c0368c..a0768f829a2 100644 --- a/org.eclipse.text/src/org/eclipse/text/templates/TemplateReaderWriter.java +++ b/org.eclipse.text/src/org/eclipse/text/templates/TemplateReaderWriter.java @@ -18,6 +18,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -325,7 +326,7 @@ public class TemplateReaderWriter { Transformer transformer=TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ + transformer.setOutputProperty(OutputKeys.ENCODING, StandardCharsets.UTF_8.name()); DOMSource source = new DOMSource(document); transformer.transform(source, result); diff --git a/org.eclipse.ui.editors/META-INF/MANIFEST.MF b/org.eclipse.ui.editors/META-INF/MANIFEST.MF index 50e1e791cec..e9aeb5d8dd9 100644 --- a/org.eclipse.ui.editors/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.editors/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.ui.editors; singleton:=true -Bundle-Version: 3.11.300.qualifier +Bundle-Version: 3.11.400.qualifier Bundle-Activator: org.eclipse.ui.internal.editors.text.EditorsPlugin Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName diff --git a/org.eclipse.ui.editors/pom.xml b/org.eclipse.ui.editors/pom.xml index c9837f33ed6..dcc04cf7374 100644 --- a/org.eclipse.ui.editors/pom.xml +++ b/org.eclipse.ui.editors/pom.xml @@ -18,6 +18,6 @@ org.eclipse.ui org.eclipse.ui.editors - 3.11.300-SNAPSHOT + 3.11.400-SNAPSHOT eclipse-plugin 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 2922335fe93..c7351d7bb38 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 @@ -25,6 +25,7 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.CodingErrorAction; import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.nio.charset.UnmappableCharacterException; import java.nio.charset.UnsupportedCharsetException; @@ -94,22 +95,6 @@ public class FileDocumentProvider extends StorageDocumentProvider { * @since 2.1 */ private static final QualifiedName ENCODING_KEY = new QualifiedName(EditorsUI.PLUGIN_ID, "encoding"); //$NON-NLS-1$ - /** - * Constant denoting UTF-8 encoding. - * @since 3.0 - */ - private static final String CHARSET_UTF_8= "UTF-8"; //$NON-NLS-1$ - /** - * Constant denoting UTF-16 encoding. - * @since 3.4 - */ - private static final String CHARSET_UTF_16= "UTF-16"; //$NON-NLS-1$ - /** - * Constant denoting UTF-16LE encoding. - * @since 3.4 - */ - private static final String CHARSET_UTF_16LE= "UTF-16LE"; //$NON-NLS-1$ - /** * The runnable context for that provider. @@ -396,7 +381,7 @@ public class FileDocumentProvider extends StorageDocumentProvider { try (InputStream contentStream= file.getContents(false)) { FileInfo info= (FileInfo)getElementInfo(editorInput); boolean removeBOM= false; - if (CHARSET_UTF_8.equals(encoding)) { + if (StandardCharsets.UTF_8.name().equals(encoding)) { if (info != null) removeBOM= info.fBOM != null; else @@ -549,8 +534,8 @@ public class FileDocumentProvider extends StorageDocumentProvider { IFile file= input.getFile(); encoding= getCharsetForNewFile(file, document, info); - if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16.equals(encoding)) - encoding= CHARSET_UTF_16LE; + if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && StandardCharsets.UTF_16.name().equals(encoding)) + encoding= StandardCharsets.UTF_16LE.name(); Charset charset; try { @@ -593,10 +578,10 @@ public class FileDocumentProvider extends StorageDocumentProvider { * This is a workaround for a corresponding bug in Java readers and writer, * see http://developer.java.sun.com/developer/bugParade/bugs/4508058.html */ - if (info != null && info.fBOM == IContentDescription.BOM_UTF_8 && CHARSET_UTF_8.equals(encoding)) + if (info != null && info.fBOM == IContentDescription.BOM_UTF_8 && StandardCharsets.UTF_8.name().equals(encoding)) stream= new SequenceInputStream(new ByteArrayInputStream(IContentDescription.BOM_UTF_8), stream); - if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16LE.equals(encoding)) + if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && StandardCharsets.UTF_16LE.name().equals(encoding)) stream= new SequenceInputStream(new ByteArrayInputStream(IContentDescription.BOM_UTF_16LE), stream); if (file.exists()) { diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java index 605d4e49bfa..d91aa42e68c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.StandardCharsets; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; @@ -416,7 +417,7 @@ public class LastSaveReferenceProvider implements IQuickDiffReferenceProvider, I * - byte order mark is not valid for UTF-8 */ private static boolean isUTF8BOM(String encoding, IStorage storage) throws CoreException { - if (storage instanceof IFile && "UTF-8".equals(encoding)) { //$NON-NLS-1$ + if (storage instanceof IFile && StandardCharsets.UTF_8.name().equals(encoding)) { //$NON-NLS-1$ IFile file= (IFile) storage; IContentDescription description= file.getContentDescription(); if (description != null) { diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java index 30b35a68224..bd8ee10238b 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java @@ -18,6 +18,7 @@ import java.lang.reflect.InvocationTargetException; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.nio.charset.UnsupportedCharsetException; import java.util.Iterator; import java.util.List; @@ -1679,7 +1680,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { int returnCode= errorDialog.open(); if (returnCode == saveAsUTF8ButtonId) { - ((IStorageDocumentProvider)documentProvider).setEncoding(getEditorInput(), "UTF-8"); //$NON-NLS-1$ + ((IStorageDocumentProvider) documentProvider).setEncoding(getEditorInput(), StandardCharsets.UTF_8.name()); IProgressMonitor monitor= getProgressMonitor(); try { doSave(monitor); diff --git a/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF b/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF index a54a74258cd..6fc9d3932d9 100644 --- a/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.genericeditor.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Plugin.name Bundle-SymbolicName: org.eclipse.ui.genericeditor.tests;singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.200.qualifier Bundle-Vendor: %Plugin.providerName Bundle-Localization: plugin Export-Package: org.eclipse.ui.genericeditor.tests, diff --git a/org.eclipse.ui.genericeditor.tests/pom.xml b/org.eclipse.ui.genericeditor.tests/pom.xml index 8bbdc4a99c9..7c77d66aaa4 100644 --- a/org.eclipse.ui.genericeditor.tests/pom.xml +++ b/org.eclipse.ui.genericeditor.tests/pom.xml @@ -19,7 +19,7 @@ org.eclipse.ui org.eclipse.ui.genericeditor.tests - 1.1.100-SNAPSHOT + 1.1.200-SNAPSHOT eclipse-test-plugin ${project.artifactId} diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java index 3e6589d529a..6cd63024ca8 100644 --- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java +++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java @@ -14,6 +14,7 @@ package org.eclipse.ui.genericeditor.tests; import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; import org.junit.After; import org.junit.Before; @@ -58,7 +59,7 @@ public class AbstratGenericEditorTest { project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.currentTimeMillis()); project.create(null); project.open(null); - project.setDefaultCharset("UTF-8", null); + project.setDefaultCharset(StandardCharsets.UTF_8.name(), null); createAndOpenFile(); } @@ -75,8 +76,8 @@ public class AbstratGenericEditorTest { */ protected void createAndOpenFile(String name, String contents) throws Exception { this.file = project.getFile(name); - this.file.create(new ByteArrayInputStream(contents.getBytes("UTF-8")), true, null); - this.file.setCharset("UTF-8", null); + this.file.create(new ByteArrayInputStream(contents.getBytes(StandardCharsets.UTF_8)), true, null); + this.file.setCharset(StandardCharsets.UTF_8.name(), null); this.editor = (ExtensionBasedTextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().openEditor(new FileEditorInput(this.file), "org.eclipse.ui.genericeditor.GenericEditor"); } diff --git a/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF b/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF index 0a3b811af44..c132b017717 100644 --- a/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.ui.genericeditor;singleton:=true -Bundle-Version: 1.1.200.qualifier +Bundle-Version: 1.1.300.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.ui.workbench.texteditor;bundle-version="3.10.0", diff --git a/org.eclipse.ui.genericeditor/pom.xml b/org.eclipse.ui.genericeditor/pom.xml index bcbda6494a7..5524ec1d51a 100644 --- a/org.eclipse.ui.genericeditor/pom.xml +++ b/org.eclipse.ui.genericeditor/pom.xml @@ -18,6 +18,6 @@ org.eclipse.ui org.eclipse.ui.genericeditor - 1.1.200-SNAPSHOT + 1.1.300-SNAPSHOT eclipse-plugin -- cgit v1.2.3