}
if (key == null)
return null;
// look up the entry
BlackboardEntry entry = blackboard.get(key);
if (entry != null) {
if (entry.getObject() != null) {
return entry.getObject();
} else {
Object object = null;
try {
// have to load from memento
String memento2 = entry.getMemento();
if (memento2 == null || memento2.length() == 0) {
return null;
}
XMLMemento memento = XMLMemento.createReadRoot(new StringReader(memento2));
IPersister<Object> persister = (IPersister<Object>) findPersister(entry,
memento);
if (persister != null) {
object = persister.load(memento);
entry.setObject(object);
entry.setObjectClass(object.getClass());
} else {
// real object which cannot be saved between runs
}
} catch (Exception e) {
String msg = "Error loading content: " + entry.getObjectClass(); //$NON-NLS-1$
IStatus status = new Status(IStatus.WARNING, ProjectPlugin.ID, 0, msg, e); //$NON-NLS-1$
ProjectPlugin.getPlugin().getLog().log(status);
}
return object;