Summary: | Make all supported character sets available for selection | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Tobias Schmidt <tobias.schmidt24080878> | ||||||
Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> | ||||||
Status: | NEW --- | QA Contact: | |||||||
Severity: | enhancement | ||||||||
Priority: | P3 | CC: | loskutov | ||||||
Version: | 4.23 | ||||||||
Target Milestone: | --- | ||||||||
Hardware: | PC | ||||||||
OS: | All | ||||||||
See Also: |
https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/189982 https://bugs.eclipse.org/bugs/show_bug.cgi?id=34421 |
||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Tobias Schmidt
2022-01-22 20:56:42 EST
Created attachment 287879 [details]
eclipse - Proposed "Text file encoding" combo box
I also added an image of a possible solution.
Please see ancient discussion on bug 34421 why do we have a fixed list of encodings. At least one point is still valid: by adding all encodings, the combo (at least on Linux) becomes unusable. Note: *if* we will change that, it should go to org.eclipse.ui.WorkbenchEncoding.getDefinedEncodings(), something like this: diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java index d1e38f0..9940633 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java @@ -20,2 +20,5 @@ import java.util.List; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; import org.eclipse.core.runtime.IConfigurationElement; @@ -101,4 +104,7 @@ } - - return definedEncodings; + SortedMap<String, Charset> charsets = new TreeMap<>(Charset.availableCharsets()); + Charset dummy = Charset.defaultCharset(); + definedEncodings.forEach(e -> charsets.putIfAbsent(e, dummy)); + Set<String> all = charsets.keySet(); + return Collections.synchronizedList(new ArrayList<>(all)); } |