333
|
1 |
"{ Package: 'stx:goodies/petitparser/gui' }"
|
|
2 |
|
|
3 |
Object subclass:#PPRefactoringUtils
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitGui-Core'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPRefactoringUtils methodsFor:'private refactoring'!
|
|
12 |
|
|
13 |
handleError: anException
|
|
14 |
anException actionBlock isNil
|
|
15 |
ifTrue: [ UIManager default inform: anException messageText ]
|
|
16 |
ifFalse: [
|
|
17 |
(UIManager default confirm: anException messageText)
|
|
18 |
ifTrue: [ anException actionBlock value ] ].
|
|
19 |
anException return
|
|
20 |
!
|
|
21 |
|
|
22 |
handleWarning: anException
|
|
23 |
| message |
|
|
24 |
message := (anException messageText endsWith: '?')
|
|
25 |
ifTrue: [ anException messageText ]
|
|
26 |
ifFalse: [ anException messageText , String cr , 'Do you want to proceed?' ].
|
|
27 |
(UIManager default confirm: message)
|
|
28 |
ifTrue: [ anException resume ]
|
|
29 |
ifFalse: [ anException return ]
|
|
30 |
!
|
|
31 |
|
|
32 |
performRefactoring: aRefactoring
|
|
33 |
[ [ aRefactoring execute ]
|
|
34 |
on: RBRefactoringWarning
|
|
35 |
do: [ :exception | self handleWarning: exception ] ]
|
|
36 |
on: RBRefactoringError
|
|
37 |
do: [ :exception | self handleError: exception ]
|
|
38 |
!
|
|
39 |
|
|
40 |
performRenameProduction: oldName from: class
|
|
41 |
| refactoring newName |
|
|
42 |
newName := UIManager default request: 'Production name:' initialAnswer: oldName.
|
|
43 |
refactoring := PPRenameProdcutionRefactoring onClass: class rename: oldName to: newName.
|
|
44 |
self performRefactoring: refactoring.
|
|
45 |
^ refactoring
|
|
46 |
! !
|
|
47 |
|
|
48 |
!PPRefactoringUtils class methodsFor:'documentation'!
|
|
49 |
|
|
50 |
version
|
|
51 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRefactoringUtils.st,v 1.1 2014-03-04 21:14:51 cg Exp $'
|
|
52 |
!
|
|
53 |
|
|
54 |
version_CVS
|
|
55 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPRefactoringUtils.st,v 1.1 2014-03-04 21:14:51 cg Exp $'
|
|
56 |
! !
|
|
57 |
|