示例#1
0
    def is_enabled(self, paths, goals, props=None, kill=False):
        view = self.window.active_view()

        if view and len(paths) == 0 and view.file_name():
            paths = [self.window.active_view().file_name()]
        return ((len(paths) == 1) and
                (pom.find_nearest_pom(paths[0]) != None)) or kill
示例#2
0
文件: maven.py 项目: zaipass/sublime3
    def run(self, paths, goals, props=None, kill=False):
        if self.window.active_view():
            self.window.active_view().erase_status('_mvn')

        if kill:
            if self.proc:
                self.proc.kill()
                self.proc = None
                self.append_string(None, "[Cancelled]")
            return

        if len(paths) == 0 and self.window.active_view().file_name():
            paths = [self.window.active_view().file_name()]
        self.pomDir = pom.find_nearest_pom(paths[0])
        if not self.pomDir:
            self.window.active_view().set_status(
                '_mvn', 'No pom.xml found for path ' + paths[0])
            return

        if not hasattr(self, 'output_view'):
            # Try not to call create_output_panel until the regexes are assigned
            self.output_view = self.window.create_output_panel("mvn_exec")

        self.output_view.settings().set("result_file_regex",
                                        file_regex_pattern)
        self.output_view.settings().set("result_base_dir", self.pomDir)
        self.output_view.settings().set("word_wrap", False)
        self.output_view.settings().set("line_numbers", False)
        self.output_view.settings().set("gutter", False)
        self.output_view.settings().set("scroll_past_end", False)

        # Call create_output_panel a second time after assigning the above
        # settings, so that it'll be picked up as a result buffer
        self.window.create_output_panel("mvn_exec")

        # now lets show the thing
        self.window.run_command("show_panel", {"panel": "output.mvn_exec"})

        if len(goals) == 0:
            self.window.show_input_panel('mvn', ' '.join(self.last_run_goals),
                                         self.on_done, None, None)
        else:
            self.last_run_goals = goals
            if props:
                self.last_run_goals += [
                    self.replace_class(prop) for prop in props
                ]
            self.on_done(' '.join(self.last_run_goals))
示例#3
0
    def run(self, paths, goals, props=None, kill=False):
        if self.window.active_view():
            self.window.active_view().erase_status('_mvn')

        if kill:
            if self.proc:
                self.proc.kill()
                self.proc = None
                self.append_string(None, "[Cancelled]")
            return

        if len(paths) == 0 and self.window.active_view().file_name():
            paths = [self.window.active_view().file_name()]
        self.pomDir = pom.find_nearest_pom(paths[0])
        if not self.pomDir:
            self.window.active_view().set_status('_mvn', 'No pom.xml found for path ' + paths[0])
            return

        if not hasattr(self, 'output_view'):
            # Try not to call create_output_panel until the regexes are assigned
            self.output_view = self.window.create_output_panel("mvn_exec")

        self.output_view.settings().set("result_file_regex", file_regex_pattern)
        self.output_view.settings().set("result_base_dir", self.pomDir)
        self.output_view.settings().set("word_wrap", False)
        self.output_view.settings().set("line_numbers", False)
        self.output_view.settings().set("gutter", False)
        self.output_view.settings().set("scroll_past_end", False)

        # Call create_output_panel a second time after assigning the above
        # settings, so that it'll be picked up as a result buffer
        self.window.create_output_panel("mvn_exec")

        # now lets show the thing
        self.window.run_command("show_panel", {"panel": "output.mvn_exec"})

        if len(goals) == 0:
            self.window.show_input_panel('mvn',' '.join(self.last_run_goals), self.on_done, None, None)
        else:
            self.last_run_goals = goals
            if props:
                self.last_run_goals += [ self.replace_class(prop) for prop in props ]
            self.on_done(' '.join(self.last_run_goals))
示例#4
0
def is_current_view_linted(view):
    if view:
        file = view.file_name()
    else:
        return False
    return pom.find_nearest_pom(file) != None if file else False
示例#5
0
 def is_enabled(self, paths, goals, props = None, kill = False):
     if len(paths) == 0 and self.window.active_view().file_name():
         paths = [self.window.active_view().file_name()]
     return ((len(paths) == 1) and (pom.find_nearest_pom(paths[0]) != None)) or kill