@@ -186,13 +186,39 @@ on cancelExtensionInstall pExtensionIdentifier
186186 revIDECancelInstallExtension pExtensionIdentifier
187187end cancelExtensionInstall
188188
189+ local sSampleFileName
190+ local sOpenedStacksA
189191on launchExtensionSampleStack pSampleStack
192+ // Check if the sample stack has already been opened,
193+ // i.e. if its name is mapped in the array. If so, just
194+ // open it.
195+ if there is a stack (sOpenedStacksA [pSampleStack ]) then
196+ open stack sOpenedStacksA [pSampleStack ]
197+ exit launchExtensionSampleStack
198+ end if
199+
200+ // Otherwise open the stack from the file. Wait until we
201+ // get the openStack message before emptying the filename
202+ // otherwise we will get a long id clash
203+ revIDESubscribe "ideOpenStack"
204+ put pSampleStack into sSampleFileName
205+
190206 # # Open the sample stack
191- # # Clear the filename to force the user to choose save location if saving the stack
192207 open stack pSampleStack
193- set the filename of stack pSampleStack to empty
194208end launchExtensionSampleStack
195209
210+ on ideOpenStack pCard
211+ local tStack
212+ put the long id of the owner of pCard into tStack
213+ if tStack is the long id of stack sSampleFileName then
214+ # # Clear the filename to force the user to choose save location if saving the stack
215+ put the short name of tStack into sOpenedStacksA [sSampleFileName ]
216+ set the filename of tStack to empty
217+ put empty into sSampleFileName
218+ revIDEUnsubscribe "ideOpenStack"
219+ end if
220+ end ideOpenStack
221+
196222on ideExtensionStatusChanged pStatus
197223 local tElement , tRow , tIdentifier , tStatus , tProgress
198224 put item 1 of pStatus into tIdentifier
0 commit comments