Beispiel #1
0
    def run(self, edit):
        # get selected text
        (lineText, methodName) = self._get_selection()

        (objName, args) = self._parse_selection(methodName, lineText)

        # get all defenition of object in current view
        points = self._get_object_defs(objName)

        className = self.get_class_name(points, self.lineRegion)
        
        numOfArgs = self._get_numofargs(args)

        methodText = ClassMenager.get_method_text(methodName, numOfArgs)
        self.add_method(className, methodText, edit)
Beispiel #2
0
    def on_done(self, fileName):

        root = self._get_base()
        path = os.path.join(root, fileName)
        path = os.path.normpath(path)

        classText = ClassMenager.get_class_text(self.className)
        assert(classText)

        fileUpdated = False
        if not os.path.exists(path):
            self._create_new_file(path, classText)
            fileUpdated = True

        fileView = self.window.open_file(path)
       
        if not fileUpdated:
            fEdit = fileView.begin_edit()
            # TODO: at the moment there is an assumption that file is empty
            # adding new text at the begining
            fileView.insert(fEdit, 0, "classText")
            fileView.end_edit(fEdit)