Launcher.st
changeset 17584 a2fc58d24e2c
parent 15143 afe9ea05ebe9
equal deleted inserted replaced
17583:57658c266723 17584:a2fc58d24e2c
   354     ifTrue:[
   354     ifTrue:[
   355         Smalltalk exit
   355         Smalltalk exit
   356     ]
   356     ]
   357 
   357 
   358     "Modified: 8.1.1997 / 14:50:00 / cg"
   358     "Modified: 8.1.1997 / 14:50:00 / cg"
   359 !
       
   360 
       
   361 snapshot
       
   362     "saves a snapshot image, after asking for a fileName"
       
   363 
       
   364     |fileName|
       
   365 
       
   366     fileName := DialogBox
       
   367 		    request:(resources at:'filename for image:') withCRs
       
   368 	      initialAnswer:(ObjectMemory nameForSnapshot) 
       
   369 		    okLabel:(resources at:'save')
       
   370 		      title:(resources string:'save image')
       
   371 		   onCancel:nil.
       
   372 
       
   373     fileName notNil ifTrue:[
       
   374 	self showCursor:Cursor write.
       
   375 	[
       
   376 	    (ObjectMemory snapShotOn:fileName) ifFalse:[
       
   377 		"
       
   378 		 snapshot failed for some reason (disk full, no permission etc.)
       
   379 		"
       
   380 		self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
       
   381 	    ]
       
   382 	] valueNowOrOnUnwindDo:[
       
   383 	    self restoreCursors.
       
   384 	].
       
   385     ].
       
   386 
       
   387     "Modified: 8.1.1997 / 14:50:29 / cg"
       
   388 !
       
   389 
       
   390 snapshotAndExit
       
   391     "saves a snapshot image and exits, after asking for a fileName"
       
   392 
       
   393     |fileName ok|
       
   394 
       
   395     fileName := DialogBox
       
   396 		    request:(resources at:'filename for image:') withCRs
       
   397 	      initialAnswer:(ObjectMemory nameForSnapshot) 
       
   398 		    okLabel:(resources at:'save & exit')
       
   399 		      title:(resources string:'save image & exit')
       
   400 		   onCancel:nil.
       
   401 
       
   402     fileName notNil ifTrue:[
       
   403 	self showCursor:Cursor write.
       
   404 	[
       
   405 	    ok := ObjectMemory snapShotOn:fileName.
       
   406 	] valueNowOrOnUnwindDo:[
       
   407 	    self restoreCursors.
       
   408 	].
       
   409 
       
   410 	ok ifFalse:[
       
   411 	    "
       
   412 	     snapshot failed for some reason (disk full, no permission etc.)
       
   413 	     Do NOT exit in this case.
       
   414 	    "
       
   415 	    self warn:(resources string:'failed to save snapshot image (disk full or not writable)').
       
   416 	] ifTrue:[
       
   417 	    "
       
   418 	     saveAllViews tells all views to shutdown neatly 
       
   419 	     (i.e. offer a chance to save the contents to a file).
       
   420 
       
   421 	     This is NOT required - all data should be in the snapshot ...
       
   422 	     ... however, if remote disks/mountable filesystems are involved,
       
   423 	     which may not be present the next time, it may make sense to 
       
   424 	     uncomment it and query for saving - time will show which is better.
       
   425 	    "
       
   426 "
       
   427 	    self saveAllViews.
       
   428 "
       
   429 	    Smalltalk exit
       
   430 	]
       
   431     ].
       
   432 
       
   433     "Modified: 8.1.1997 / 14:50:36 / cg"
       
   434 ! !
   359 ! !
   435 
   360 
   436 !Launcher methodsFor:'actions - goodies'!
   361 !Launcher methodsFor:'actions - goodies'!
   437 
   362 
   438 openGoodie:className
   363 openGoodie:className
  1723 ! !
  1648 ! !
  1724 
  1649 
  1725 !Launcher class methodsFor:'documentation'!
  1650 !Launcher class methodsFor:'documentation'!
  1726 
  1651 
  1727 version
  1652 version
  1728     ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.407 2015-01-31 13:28:01 cg Exp $'
  1653     ^ '$Header$'
  1729 ! !
  1654 ! !
  1730 
  1655