Community
Participate
Working Groups
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(); }
Nice polish idea
Given that the encodign story needs some revisiting we will defer this to 3.1.
Reopening now that 3.0 has shipped
This has been released in M4.