* Save the workbench UI in a persistence file. */
| 1088 | * Save the workbench UI in a persistence file. |
| 1089 | */ |
| 1090 | bool Workbench::SaveMementoToFile(XMLMemento::Pointer memento) |
| 1091 | { |
| 1092 | // Save it to a file. |
| 1093 | // XXX: nobody currently checks the return value of this method. |
| 1094 | QString stateFile = GetWorkbenchStateFile(); |
| 1095 | if (stateFile.isNull()) |
| 1096 | { |
| 1097 | return false; |
| 1098 | } |
| 1099 | //BERRY_INFO << "Saving state to: " << stateFile.path() << std::endl; |
| 1100 | try |
| 1101 | { |
| 1102 | Poco::FileOutputStream stream(stateFile.toStdString()); |
| 1103 | memento->Save(stream); |
| 1104 | } |
| 1105 | catch (const Poco::IOException& /*e*/) |
| 1106 | { |
| 1107 | QFile::remove(stateFile); |
| 1108 | QMessageBox::critical(nullptr, |
| 1109 | "Saving Problems", |
| 1110 | "Unable to store workbench state."); |
| 1111 | return false; |
| 1112 | } |
| 1113 | |
| 1114 | // Success ! |
| 1115 | return true; |
| 1116 | } |
| 1117 | |
| 1118 | IWorkbenchWindow::Pointer Workbench::GetActiveWorkbenchWindow() const |
| 1119 | { |