1168 |
1168 |
1169 ##################################################### |
1169 ##################################################### |
1170 ## Introduce refactorings |
1170 ## Introduce refactorings |
1171 ##################################################### |
1171 ##################################################### |
1172 |
1172 |
1173 # TODO: continue from here |
|
1174 def __introduceFactoryMethod(self): |
1173 def __introduceFactoryMethod(self): |
1175 """ |
1174 """ |
1176 Private slot to introduce a factory method or global function. |
1175 Private slot to introduce a factory method or global function. |
1177 """ |
1176 """ |
1178 aw = e5App().getObject("ViewManager").activeWindow() |
1177 aw = e5App().getObject("ViewManager").activeWindow() |
1194 |
1193 |
1195 filename = aw.getFileName() |
1194 filename = aw.getFileName() |
1196 line, index, line1, index1 = aw.getSelection() |
1195 line, index, line1, index1 = aw.getSelection() |
1197 offset = self.__getOffset(aw, line, index) |
1196 offset = self.__getOffset(aw, line, index) |
1198 |
1197 |
1199 import rope.refactor.introduce_factory |
|
1200 resource = rope.base.libutils.path_to_resource( |
|
1201 self.__project, filename) |
|
1202 try: |
|
1203 introducer = \ |
|
1204 rope.refactor.introduce_factory.IntroduceFactoryRefactoring( |
|
1205 self.__project, resource, offset) |
|
1206 except Exception as err: |
|
1207 self.handleRopeError(err, title) |
|
1208 return |
|
1209 |
|
1210 from IntroduceFactoryDialog import IntroduceFactoryDialog |
1198 from IntroduceFactoryDialog import IntroduceFactoryDialog |
1211 self.dlg = IntroduceFactoryDialog(self, title, introducer, |
1199 dlg = IntroduceFactoryDialog(self, title, filename, offset, |
1212 parent=self.__ui) |
1200 parent=self.__ui) |
1213 self.dlg.show() |
1201 changeGroup = dlg.getChangeGroupName() |
1214 |
1202 self.__refactoringDialogs[changeGroup] = dlg |
|
1203 dlg.finished.connect( |
|
1204 lambda: self.__refactoringDialogClosed(changeGroup)) |
|
1205 dlg.show() |
|
1206 |
|
1207 # TODO: continue from here |
1215 def __introduceParameter(self): |
1208 def __introduceParameter(self): |
1216 """ |
1209 """ |
1217 Private slot to introduce a parameter in a function. |
1210 Private slot to introduce a parameter in a function. |
1218 """ |
1211 """ |
1219 aw = e5App().getObject("ViewManager").activeWindow() |
1212 aw = e5App().getObject("ViewManager").activeWindow() |