# HG changeset patch # User dadubrow # Date 1250192437 18000 # Node ID d19f4087230da5fd5113b4fef00b7df19fc8a291 # Parent f963b9801067ed52bbb6aa6291c55fb2cf7ec045 Bug 9619 - make sure saving model in main thread diff -r f963b9801067 -r d19f4087230d uidesigner/com.nokia.sdt.symbian/src/com/nokia/sdt/symbian/updater/DesignRefactoring.java --- a/uidesigner/com.nokia.sdt.symbian/src/com/nokia/sdt/symbian/updater/DesignRefactoring.java Thu Aug 13 14:21:16 2009 -0500 +++ b/uidesigner/com.nokia.sdt.symbian/src/com/nokia/sdt/symbian/updater/DesignRefactoring.java Thu Aug 13 14:40:37 2009 -0500 @@ -28,6 +28,7 @@ import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.swt.widgets.Display; +import com.nokia.cpp.internal.api.utils.core.Logging; import com.nokia.sdt.datamodel.IDesignerDataModel; import com.nokia.sdt.emf.dm.IComponentManifest; import com.nokia.sdt.emf.dm.IDesignerData; @@ -36,6 +37,7 @@ import com.nokia.sdt.sourcegen.ISourceGenUpgradingProvider; import com.nokia.sdt.sourcegen.PatchContext; import com.nokia.sdt.sourcegen.SourceGenUpdatingRefactoring; +import com.nokia.sdt.symbian.SymbianPlugin; import com.nokia.sdt.symbian.dm.ComponentManifestSourceGenVersionProvider; import com.nokia.sdt.symbian.dm.DesignerDataModel; import com.nokia.sdt.workspace.IProjectContext; @@ -202,7 +204,7 @@ * @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor) */ @Override - public Change perform(IProgressMonitor pm) throws CoreException { + public Change perform(final IProgressMonitor pm) throws CoreException { if (session != null) { // now save any patched sources session.getSourceGenProvider().saveGeneratedSources(pm); @@ -211,12 +213,16 @@ session.setUpgradingMode(false); } - // and save model based on patched sources - try { - model.saveModel(pm); - } catch (Exception e) { - e.printStackTrace(); - } + Display.getDefault().syncExec(new Runnable() { + public void run() { + // and save model based on patched sources + try { + model.saveModel(pm); + } catch (Exception e) { + Logging.log(SymbianPlugin.getDefault(), Logging.newSimpleStatus(0, e)); + } + } + }); // not undoable return null;