boolean failed = false;
IStructuredModel internalModel = getInternalModel();
if (internalModel != null) {
IStructuredDocument doc = internalModel.getStructuredDocument();
EncodingMemento memento = doc.getEncodingMemento();
IDocumentCharsetDetector detector = internalModel.getModelHandler().getEncodingDetector();
if (memento != null && detector != null) {
detector.set(doc);
try {
String newEncoding = detector.getEncoding();
if (newEncoding != null) {
memento.setDetectedCharsetName(newEncoding);
}
}
catch (IOException e) {