Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 941 by v.blonde...@gmail.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
When calling export to MSE from Moose Panel, exporting to a file doesn't work.
Comment #1 on issue 941 by v.blonde...@gmail.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
Corrected
Updates: Status: Fixed Labels: Component-MooseCore
Comment #2 on issue 941 by anquetil...@gmail.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
(No comment was entered for this change.)
Updates: Status: Started Labels: Milestone-4.8
Comment #3 on issue 941 by tu...@tudorgirba.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
Wait. Please take the time to explain what was wrong.
How can I reproduce the problem? What was the fix about?
Comment #4 on issue 941 by v.blonde...@gmail.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
The file picker 'UITheme' returns a 'FileReference' object instead of a 'Stream'. So I have converted the 'FileReference' in a 'Stream' by adding the 'writeStream' message.
To reproduce : - Create a MooseModel - Open the contextual menu by clicking on the Model on the left of the Moose Panel. - Choose 'Export model to MSE' in the category: 'Import / Export'
Updates: Status: Fixed
Comment #5 on issue 941 by tu...@tudorgirba.com: Can't export moose model to MSE file from pharo 2.0 http://code.google.com/p/moose-technology/issues/detail?id=941
Thanks for the explanations. I reviewed the code, and the fix was not quite complete.
Your fix looked like that:
exportToMSE <menuItem: 'Export model to MSE' category: 'Import / Export'> | stream | stream := UITheme builder fileSave: 'Your title here' extensions: #('mse') path: nil. stream isNil ifFalse: [ self exportToMSEStream: stream writeStream. stream close. Notification signal: 'Save successful!' ]
The problem was that "stream close" raised an exception because stream is a FileReference.
I fixed this now and the code looks like:
exportToMSE <menuItem: 'Export model to MSE' category: 'Import / Export'> | fileReference | fileReference := UITheme builder fileSave: 'Your title here' extensions: #('mse') path: nil. fileReference isNil ifFalse: [ fileReference writeStreamDo: [ :stream | self exportToMSEStream: stream. Notification signal: 'Save successful!' ] ]
In any case, thanks for spotting the issue.