def on_click(self, index):
     if index == -1 or index == 0:
         if len(self.history) >= 1:
             self.selected_file = self.history.pop()
             self.show_tree(self.b_expand)
         else:
             USMain.evt_m().parsing_finished -= self.on_parsing_finished
     elif index == 1:
         print("open")
     elif index == 2:
         self.show_tree(not self.b_expand)
     else:
         self.history.append(self.selected_file)
         comp = self.selected_file.get_variables(
         ) + self.selected_file.get_functions()
         if self.input_list[index - 3][0][0] == "|":
             self.view.window().run_command(
                 "unreal_goto_definition", {
                     "b_new_start_point": True,
                     "line_number": comp[index - 3].line_number(),
                     "filename": comp[index - 3].file_name()
                 })
         else:
             self.selected_file = self.selected_file.children()[
                 index - 3 - (len(comp) if self.b_expand else 0)]
             self.show_tree(self.b_expand)
 def run(self, edit):
     # Object
     # --open file--
     # --show members--
     #   Actor
     USMain.evt_m().parsing_finished += self.on_parsing_finished
     USMain.evt_m().get_class_reference(self.receive_object)
     self.show_tree()
 def run(self, edit):
     # Object
     # --open file--
     # --show members--
     #   Actor
     USMain.evt_m().parsing_finished += self.on_parsing_finished
     USMain.evt_m().get_class_reference(self.receive_object)
     self.show_tree()
Exemplo n.º 4
0
    def run(self, edit, b_new_start_point=False, line_number=-1, filename=""):
        if USMain.is_unrealscript_file():
            # open the file at line line_number if specified (gets called after it was calculated by the main instance)
            if line_number != -1 and filename != "":
                self.open_file(filename, line_number, b_new_start_point)
                return

            # get selected word
            region_word = self.view.word(self.view.sel()[0])
            word = self.view.substr(region_word)

            # if no word is selected or the cursor is at the beginning of the line, return to last location
            global last_location, current_location
            row, col = self.view.rowcol(self.view.sel()[0].begin())

            if last_location is not None and (word.strip() == "" or col == 0):
                active_file = self.view.file_name()

                if current_location.lower() == active_file.lower():
                    window = sublime.active_window()
                    window.open_file(last_location, sublime.ENCODED_POSITION)
                    window.open_file(last_location, sublime.ENCODED_POSITION)
                    last_location = None
                    return

            # get line left of cursor
            line = self.view.substr(
                sublime.Region(
                    self.view.line(self.view.sel()[0]).begin(),
                    region_word.begin()))
            line = line.lstrip().lower()
            # print line

            # if the end of the line is a whitespace or a '(' (meaning it is a function argument)
            # empty left_line
            if line == "" or ' ' == line[-1] or '\t' == line[
                    -1] or '(' == line[-1]:
                left_line = ""
            else:
                # get relevant part of the line
                left_line = USMain.get_relevant_text(line)
                # print left_line

            # calculate where to go inside the main instance of my plug-in.
            # Then, call this command again with a filename and a line number.
            USMain.evt_m().go_to_definition(left_line, word, line,
                                            b_new_start_point)

        elif is_unreal_log_file():  # self.view.file_name()
            line = self.view.substr(self.view.line(self.view.sel()[0]))
            split_line = re.split(r"\(|\)", line)  # line.split("()")
            if len(split_line) > 1:
                self.open_file(split_line[0], split_line[1], True)
            else:
                self.view.set_status('UnrealScriptGotoDefinition',
                                     '"' + line + '" not found!')
    def run(self, edit, b_new_start_point=False, line_number=-1, filename=""):
        if USMain.is_unrealscript_file():
            # open the file at line line_number if specified (gets called after it was calculated by the main instance)
            if line_number != -1 and filename != "":
                self.open_file(filename, line_number, b_new_start_point)
                return

            # get selected word
            region_word = self.view.word(self.view.sel()[0])
            word = self.view.substr(region_word)

            # if no word is selected or the cursor is at the beginning of the line, return to last location
            global last_location, current_location
            row, col = self.view.rowcol(self.view.sel()[0].begin())

            if last_location is not None and (word.strip() == "" or col == 0):
                active_file = self.view.file_name()

                if current_location.lower() == active_file.lower():
                    window = sublime.active_window()
                    window.open_file(last_location, sublime.ENCODED_POSITION)
                    window.open_file(last_location, sublime.ENCODED_POSITION)
                    last_location = None
                    return

            # get line left of cursor
            line = self.view.substr(sublime.Region(self.view.line(self.view.sel()[0]).begin(), region_word.begin()))
            line = line.lstrip().lower()
            # print line

            # if the end of the line is a whitespace or a '(' (meaning it is a function argument)
            # empty left_line
            if line == "" or ' ' == line[-1] or '\t' == line[-1] or '(' == line[-1]:
                left_line = ""
            else:
                # get relevant part of the line
                left_line = USMain.get_relevant_text(line)
                # print left_line

            # calculate where to go inside the main instance of my plug-in.
            # Then, call this command again with a filename and a line number.
            USMain.evt_m().go_to_definition(left_line, word, line, b_new_start_point)

        elif is_unreal_log_file():  # self.view.file_name()
            line = self.view.substr(self.view.line(self.view.sel()[0]))
            split_line = re.split(r"\(|\)", line)   # line.split("()")
            if len(split_line) > 1:
                self.open_file(split_line[0], split_line[1], True)
            else:
                self.view.set_status('UnrealScriptGotoDefinition', '"' + line + '" not found!')
 def on_click(self, index):
     if index == -1 or index == 0:
         if len(self.history) >= 1:
             self.selected_file = self.history.pop()
             self.show_tree(self.b_expand)
         else:
             USMain.evt_m().parsing_finished -= self.on_parsing_finished
     elif index == 1:
         print("open")
     elif index == 2:
         self.show_tree(not self.b_expand)
     else:
         self.history.append(self.selected_file)
         comp = self.selected_file.get_variables() + self.selected_file.get_functions()
         if self.input_list[index - 3][0][0] == "|":
             self.view.window().run_command("unreal_goto_definition", {"b_new_start_point": True, "line_number": comp[index - 3].line_number(), "filename": comp[index - 3].file_name()})
         else:
             self.selected_file = self.selected_file.children()[index - 3 - (len(comp) if self.b_expand else 0)]
             self.show_tree(self.b_expand)