UIHelpTool.st
changeset 1772 e33aee13defe
parent 1737 de6abd3c55d2
child 1775 695f10f213d1
equal deleted inserted replaced
1771:1bb15bba99ee 1772:e33aee13defe
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 "{ Package: 'stx:libtool2' }"
    13 "{ Package: 'stx:libtool2' }"
    14 
    14 
    15 ToolApplicationModel subclass:#UIHelpTool
    15 ResourceSpecEditor subclass:#UIHelpTool
    16 	instanceVariableNames:'specClass specSelector classItemList classItemModel keyItemModel
    16 	instanceVariableNames:'classItemList classItemModel keyItemModel helpTextView
    17 		helpTextView modifiedHolder contentsModifiedChannel editModel'
    17 		modifiedHolder contentsModifiedChannel editModel'
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
    99 
    99 
   100 label
   100 label
   101     "returns the label; used if embedded as sub canvas in the GUI Painter or Menu Editor
   101     "returns the label; used if embedded as sub canvas in the GUI Painter or Menu Editor
   102     "
   102     "
   103     ^'Help'
   103     ^'Help'
       
   104 ! !
       
   105 
       
   106 !UIHelpTool class methodsFor:'defaults'!
       
   107 
       
   108 resourceType
       
   109     "get the type of the resource of the method generated by the UIHelpTool"
       
   110 
       
   111     ^ #help
   104 ! !
   112 ! !
   105 
   113 
   106 !UIHelpTool class methodsFor:'help specs'!
   114 !UIHelpTool class methodsFor:'help specs'!
   107 
   115 
   108 helpSpec
   116 helpSpec
   857     ^ aBlock ensure:[modifiedHolder := holder]
   865     ^ aBlock ensure:[modifiedHolder := holder]
   858 ! !
   866 ! !
   859 
   867 
   860 !UIHelpTool methodsFor:'private'!
   868 !UIHelpTool methodsFor:'private'!
   861 
   869 
   862 askForModification
       
   863     "asks for modification; launch a dialog if something is modified;
       
   864      returns true if the modifications are accepted by user otherwise
       
   865      false.
       
   866     "
       
   867     |dialog|
       
   868 
       
   869     self modified ifTrue:[
       
   870 	dialog := YesNoBox title:(resources string:'List was modified !!')
       
   871 			 yesText:(resources string:'Forget it and proceed')
       
   872 			  noText:(resources string:'Cancel').
       
   873 
       
   874 	dialog showAtPointer.
       
   875 	dialog accepted ifFalse:[^ false].
       
   876 	self modified:false.
       
   877     ].
       
   878     ^ true
       
   879 !
       
   880 
       
   881 extractResourceFrom:aString
   870 extractResourceFrom:aString
   882     "extracts class and selector from a resource string. On success
   871     "extracts class and selector from a resource string. On success
   883      an association with the key a class and the selector as value
   872      an association with the key a class and the selector as value
   884      is returned. Otherwise nil is returned
   873      is returned. Otherwise nil is returned
   885     "
   874     "
   996 ! !
   985 ! !
   997 
   986 
   998 !UIHelpTool methodsFor:'startup & release'!
   987 !UIHelpTool methodsFor:'startup & release'!
   999 
   988 
  1000 closeRequest
   989 closeRequest
  1001     "asks for permission before closing
   990     "asks for permission before closing"
  1002     "
   991 
  1003     (masterApplication isNil and:[self askForModification]) ifTrue:[
   992     masterApplication isNil ifTrue:[
  1004 	super closeRequest.
   993         super closeRequest.
  1005     ].
   994     ].
  1006 !
   995 !
  1007 
   996 
  1008 initialize
   997 initialize
  1009     "setup default attributes
   998     "setup default attributes