RefactoringRope/RefactoringClient.py

branch
server_client_variant
changeset 181
3e3d6de2f0ca
parent 180
a33ef7ab8c54
child 182
f7f2834dc8d9
equal deleted inserted replaced
180:a33ef7ab8c54 181:3e3d6de2f0ca
70 "CalculateMoveChanges": self.__calculateMoveChanges, 70 "CalculateMoveChanges": self.__calculateMoveChanges,
71 "RequestUseFunction": self.__requestUseFunction, 71 "RequestUseFunction": self.__requestUseFunction,
72 "CalculateUseFunctionChanges": self.__calculateUseFunctionChanges, 72 "CalculateUseFunctionChanges": self.__calculateUseFunctionChanges,
73 "CalculateIntroduceFactoryChanges": 73 "CalculateIntroduceFactoryChanges":
74 self.__calculateIntroduceFactoryChanges, 74 self.__calculateIntroduceFactoryChanges,
75 "CalculateIntroduceParameterChanges":
76 self.__calculateIntroduceParameterChanges,
75 } 77 }
76 78
77 from FileSystemCommands import RefactoringClientFileSystemCommands 79 from FileSystemCommands import RefactoringClientFileSystemCommands
78 self.__fsCommands = RefactoringClientFileSystemCommands(self) 80 self.__fsCommands = RefactoringClientFileSystemCommands(self)
79 81
999 1001
1000 result["Subcommand"] = "ChangesCalculated" 1002 result["Subcommand"] = "ChangesCalculated"
1001 result.update(errorDict) 1003 result.update(errorDict)
1002 1004
1003 self.sendJson("Changes", result) 1005 self.sendJson("Changes", result)
1006
1007 def __calculateIntroduceParameterChanges(self, params):
1008 """
1009 Private method to calculate the 'Introduce Parameter' changes based on
1010 the parameters sent by the server.
1011
1012 @param params dictionary containing the method parameters sent by
1013 the server
1014 @type dict
1015 """
1016 changeGroup = params["ChangeGroup"]
1017 title = params["Title"]
1018 filename = params["FileName"]
1019 offset = params["Offset"]
1020 parameterName = params["Name"]
1021
1022 errorDict = {}
1023 changes = []
1024 result = {
1025 "ChangeGroup": changeGroup,
1026 "Title": title,
1027 }
1028
1029 import rope.refactor.introduce_parameter
1030 resource = rope.base.libutils.path_to_resource(
1031 self.__project, filename)
1032 try:
1033 introducer = rope.refactor.introduce_parameter.IntroduceParameter(
1034 self.__project, resource, offset)
1035 changes = introducer.get_changes(parameterName)
1036 except Exception as err:
1037 errorDict = self.__handleRopeError(err)
1038
1039 self.__changes[changeGroup] = changes
1040
1041 result["Subcommand"] = "ChangesCalculated"
1042 result.update(errorDict)
1043
1044 self.sendJson("Changes", result)
1004 1045
1005 1046
1006 if __name__ == '__main__': 1047 if __name__ == '__main__':
1007 if len(sys.argv) != 4: 1048 if len(sys.argv) != 4:
1008 print('Host, port and project path parameters are missing. Abort.') 1049 print('Host, port and project path parameters are missing. Abort.')

eric ide

mercurial