Bug 65258 - [Encoding] Consider using new platform.core API for BOMs
Summary: [Encoding] Consider using new platform.core API for BOMs
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2004-06-02 06:22 EDT by Andre Weinand CLA
Modified: 2005-01-06 10:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weinand CLA 2004-06-02 06:22:54 EDT
From Rafael:
Instead of doing this in ResourceInfoPage:

private String getEncodingFromContent(IFile file) {
	IContentDescription description = getContentDescription(file);
	if (description != null) {
		byte[] bom = (byte[]) description.getProperty(IContentDescription.BYTE_ORDER_MARK);
		if (bom == null)
			return (String) description.getProperty(IContentDescription.CHARSET);
		if (bom == IContentDescription.BOM_UTF_8)
			return IDEWorkbenchMessages.getString("WorkbenchPreference.encoding.BOM_UTF_8"); 
//$NON-NLS-1$
		if (bom == IContentDescription.BOM_UTF_16BE)
			return 
IDEWorkbenchMessages.getString("WorkbenchPreference.encoding.BOM_UTF_16BE"); //$NON-NLS-1$
		if (bom == IContentDescription.BOM_UTF_16LE)
			return 
IDEWorkbenchMessages.getString("WorkbenchPreference.encoding.BOM_UTF_16LE"); //$NON-NLS-1$
	}
	return null;
}

You can do:

private String getEncodingFromContent(IFile file) {
	IContentDescription description = getContentDescription(file);
	return description == null ? null : description.getCharset();
}
Comment 1 Tod Creasey CLA 2004-06-02 09:42:54 EDT
Nice polish idea
Comment 2 Tod Creasey CLA 2004-06-02 14:17:37 EDT
Given that the encodign story needs some revisiting we will defer this to 3.1.
Comment 3 Tod Creasey CLA 2004-06-28 11:27:30 EDT
Reopening now that 3.0 has shipped
Comment 4 Tod Creasey CLA 2005-01-06 10:53:33 EST
This has been released in M4.