.getKey(ref));
if (ref instanceof ViewReference) {
viewMemento.putString(IWorkbenchConstants.TAG_PART_NAME,
((ViewReference) ref).getPartName());
}
final IViewReference viewRef = ref;
final IViewPart view = (IViewPart) ref.getPart(false);
if (view != null) {
SafeRunner.run(new SafeRunnable() {
public void run() {
if (view instanceof IWorkbenchPart3) {
Map properties = ((IWorkbenchPart3) view)
.getPartProperties();
if (!properties.isEmpty()) {
IMemento propBag = viewMemento
.createChild(IWorkbenchConstants.TAG_PROPERTIES);
Iterator i = properties.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
IMemento p = propBag.createChild(
IWorkbenchConstants.TAG_PROPERTY,
(String) entry.getKey());
p.putTextData((String) entry.getValue());
}
}
}
view.saveState(viewMemento
.createChild(IWorkbenchConstants.TAG_VIEW_STATE));
}
public void handleException(Throwable e) {
result
.add(new Status(
IStatus.ERROR,
PlatformUI.PLUGIN_ID,
0,
NLS.bind(WorkbenchMessages.ViewFactory_couldNotSave, viewRef.getTitle() ),
e));
}
});
} else {
IMemento mem = null;