/
SycExtractSetUpRefactoring.class.st
57 lines (50 loc) · 1.4 KB
/
SycExtractSetUpRefactoring.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"
I am a command to extract setUp method and then replaces its occurrences
"
Class {
#name : #SycExtractSetUpRefactoring,
#superclass : #SycSourceCodeCmCommand,
#instVars : [
'method',
'sourceNode',
'selectedTextInterval'
],
#category : #'SystemCommands-SourceCodeCommands'
}
{ #category : #executing }
SycExtractSetUpRefactoring >> executeRefactoring [
| selectedInterval refactoring |
selectedInterval := selectedTextInterval ifEmpty: [
sourceNode sourceInterval ].
refactoring := RBExtractSetUpMethodAndOccurrences
extract: selectedInterval
from: method selector
in: method origin.
self initializeDefaultOptionsOf: refactoring.
refactoring execute
]
{ #category : #accessing }
SycExtractSetUpRefactoring >> icon [
^ self iconNamed: #glamorousRestart
]
{ #category : #initialization }
SycExtractSetUpRefactoring >> initialize [
super initialize.
self
description: 'Extract setUp and find occurrences.'
]
{ #category : #testing }
SycExtractSetUpRefactoring >> isApplicable [
^ context lastSelectedMethod selector isTestSelector
]
{ #category : #accessing }
SycExtractSetUpRefactoring >> name [
^ 'Extract setUp'
]
{ #category : #preparation }
SycExtractSetUpRefactoring >> prepareFullExecution [
super prepareFullExecution.
method := context lastSelectedMethod.
sourceNode := context lastSelectedSourceNode.
selectedTextInterval := context selectedTextInterval.
]