// Only commit changes to the model if the document text has
// actually changed since we switched to the page; this prevents us
// losing selection in the Components and Imports tabs.
// We can't use the dirty flag for this because "undo" will clear
// the dirty flag.
IDocument doc = getDocument();
String currentContent = doc.get();
if (!currentContent.equals(lastLoaded))
formEditor.getEditModel().loadFrom(getDocument());
} catch (IOException e) {
logger.logError("Error loading model from document.", e);
}