Ejemplo n.º 1
0
 def __init__(self, *args):
     super(SbtWindowCommand, self).__init__(*args)
     self._project = Project(self.window)
     self._runner = SbtRunner(self.window)
     self._sbt_view = SbtView(self.window)
     self._error_view = ErrorView(self.window)
     self._error_reporter = self._project.error_reporter
     self._error_report = self._project.error_report
     self._monitor_compile_output = BuildOutputMonitor(self._project)
Ejemplo n.º 2
0
 def __init__(self, *args):
     super(SbtCommand, self).__init__(*args)
     self._project = Project.get_project(self.window)
     self._runner = SbtRunner.get_runner(self.window)
     self._sbt_view = SbtView.get_sbt_view(self.window)
     self._error_reporter = self._project.error_reporter
     self._error_report = self._project.error_report
     self._monitor_compile_output = BuildOutputMonitor(self._error_reporter)
Ejemplo n.º 3
0
 def on_query_context(self, view, key, operator, operand, match_all):
     if key == "in_sbt_view":
         if SbtView.is_sbt_view(view):
             return SbtRunner.is_sbt_running_for(view.window())
         else:
             return False
Ejemplo n.º 4
0
 def on_selection_modified(self, view):
     if SbtView.is_sbt_view(view):
         SbtView(view.window()).update_writability()
     else:
         for reporter in maybe(self._reporter(view)):
             reporter.update_status()
Ejemplo n.º 5
0
class SbtCommand(sublime_plugin.WindowCommand):

    def __init__(self, *args):
        super(SbtCommand, self).__init__(*args)
        self._project = Project(self.window)
        self._runner = SbtRunner(self.window)
        self._sbt_view = SbtView(self.window)
        self._error_view = ErrorView(self.window)
        self._error_reporter = self._project.error_reporter
        self._error_report = self._project.error_report
        self._monitor_compile_output = BuildOutputMonitor(self._project)

    def is_sbt_project(self):
        return self._project.is_sbt_project()

    def is_play_project(self):
        return self._project.is_play_project()

    def is_sbt_running(self):
        return self._runner.is_sbt_running()

    def start_sbt(self, command=None):
        self._runner.start_sbt(command,
                               on_start=self._sbt_view.start,
                               on_stop=self._sbt_view.finish,
                               on_stdout=self._on_stdout,
                               on_stderr=self._on_stderr)

    def stop_sbt(self):
        self._runner.stop_sbt()

    def kill_sbt(self):
        self._runner.kill_sbt()

    def show_sbt(self):
        self._sbt_view.show()

    def hide_sbt(self):
        self._sbt_view.hide()

    def focus_sbt(self):
        self._sbt_view.focus()

    def take_input(self):
        return self._sbt_view.take_input()

    def send_to_sbt(self, cmd):
        self._runner.send_to_sbt(cmd)

    @delayed(0)
    def show_error(self, error):
        self._error_report.focus_error(error)
        self._error_reporter.show_errors()
        self._error_view.show_error(error)
        self.goto_error(error)

    @delayed(0)
    def goto_error(self, error):
        self.window.open_file(error.encoded_position(), sublime.ENCODED_POSITION)

    def show_error_output(self):
        self._error_view.show()

    def setting(self, name):
        return self._project.setting(name)

    def _on_stdout(self, output):
        self._monitor_compile_output(output)
        self._show_output(output)

    def _on_stderr(self, output):
        self._show_output(output)

    @delayed(0)
    def _show_output(self, output):
        self._sbt_view.show_output(output)
Ejemplo n.º 6
0
 def on_query_context(self, view, key, operator, operand, match_all):
     if key == "in_sbt_view":
         if SbtView.is_sbt_view(view):
             return SbtRunner.is_sbt_running_for(view.window())
         else:
             return False
Ejemplo n.º 7
0
 def on_selection_modified(self, view):
     if SbtView.is_sbt_view(view):
         SbtView(view.window()).update_writability()
     else:
         for reporter in maybe(self._reporter(view)):
             reporter.update_status_now()
Ejemplo n.º 8
0
class SbtWindowCommand(sublime_plugin.WindowCommand):
    def __init__(self, *args):
        super(SbtWindowCommand, self).__init__(*args)
        self._project = Project(self.window)
        self._runner = SbtRunner(self.window)
        self._sbt_view = SbtView(self.window)
        self._error_view = ErrorView(self.window)
        self._error_reporter = self._project.error_reporter
        self._error_report = self._project.error_report
        self._monitor_compile_output = BuildOutputMonitor(self._project)

    def is_sbt_project(self):
        return self._project.is_sbt_project()

    def is_play_project(self):
        return self._project.is_play_project()

    def is_sbt_running(self):
        return self._runner.is_sbt_running()

    def start_sbt(self, command=None):
        self._runner.start_sbt(command,
                               on_start=self._sbt_view.start,
                               on_stop=self._sbt_view.finish,
                               on_stdout=self._on_stdout,
                               on_stderr=self._on_stderr)

    def stop_sbt(self):
        self._runner.stop_sbt()

    def kill_sbt(self):
        self._runner.kill_sbt()

    def show_sbt(self):
        self._sbt_view.show()

    def hide_sbt(self):
        self._sbt_view.hide()

    def focus_sbt(self):
        self._sbt_view.focus()

    def take_input(self):
        return self._sbt_view.take_input()

    def send_to_sbt(self, cmd):
        self._runner.send_to_sbt(cmd)

    @delayed(0)
    def show_error(self, error):
        self._error_report.focus_error(error)
        self._error_reporter.show_errors()
        self._error_view.show_error(error)
        self.goto_error(error)

    @delayed(0)
    def goto_error(self, error):
        self.window.open_file(error.encoded_position(),
                              sublime.ENCODED_POSITION)

    def show_error_output(self):
        self._error_view.show()

    def setting(self, name):
        return self._project.setting(name)

    def _on_stdout(self, output):
        self._monitor_compile_output(output)
        self._show_output(output)

    def _on_stderr(self, output):
        self._show_output(output)

    @delayed(0)
    def _show_output(self, output):
        output = self._work_around_JLine_bug(output)
        self._sbt_view.show_output(output)

    # If we have a single character, space, CR then we are probably seeing a
    # JLine bug which has inserted the space, CR at column 80 of a prompt
    # line. Delete the space and CR so that it doesn't mess up the display
    # of the prompt line (ie. hide the stuff before the CR). Just remove
    # the space, CR pair.
    def _work_around_JLine_bug(self, output):
        return re.sub(r'^(.) \r$', r'\1', output)
Ejemplo n.º 9
0
class SbtWindowCommand(sublime_plugin.WindowCommand):
    def __init__(self, *args):
        super(SbtWindowCommand, self).__init__(*args)
        self._project = Project(self.window)
        self._runner = SbtRunner(self.window)
        self._sbt_view = SbtView(self.window)
        self._error_view = ErrorView(self.window)
        self._error_reporter = self._project.error_reporter
        self._error_report = self._project.error_report
        self._monitor_compile_output = BuildOutputMonitor(self._project)

    def is_sbt_project(self):
        return self._project.is_sbt_project()

    def is_play_project(self):
        return self._project.is_play_project()

    def is_sbt_running(self):
        return self._runner.is_sbt_running()

    def start_sbt(self, command=None):
        self._runner.start_sbt(
            command,
            on_start=self._sbt_view.start,
            on_stop=self._sbt_view.finish,
            on_stdout=self._on_stdout,
            on_stderr=self._on_stderr,
        )

    def stop_sbt(self):
        self._runner.stop_sbt()

    def kill_sbt(self):
        self._runner.kill_sbt()

    def show_sbt(self):
        self._sbt_view.show()

    def hide_sbt(self):
        self._sbt_view.hide()

    def focus_sbt(self):
        self._sbt_view.focus()

    def take_input(self):
        return self._sbt_view.take_input()

    def send_to_sbt(self, cmd):
        self._runner.send_to_sbt(cmd)

    @delayed(0)
    def show_error(self, error):
        self._error_report.focus_error(error)
        self._error_reporter.show_errors()
        self._error_view.show_error(error)
        self.goto_error(error)

    @delayed(0)
    def goto_error(self, error):
        self.window.open_file(error.encoded_position(), sublime.ENCODED_POSITION)

    def show_error_output(self):
        self._error_view.show()

    def setting(self, name):
        return self._project.setting(name)

    def _on_stdout(self, output):
        self._monitor_compile_output(output)
        self._show_output(output)

    def _on_stderr(self, output):
        self._show_output(output)

    @delayed(0)
    def _show_output(self, output):
        output = self._work_around_JLine_bug(output)
        self._sbt_view.show_output(output)

    # If we have a single character, space, CR then we are probably seeing a
    # JLine bug which has inserted the space, CR at column 80 of a prompt
    # line. Delete the space and CR so that it doesn't mess up the display
    # of the prompt line (ie. hide the stuff before the CR). Just remove
    # the space, CR pair.
    def _work_around_JLine_bug(self, output):
        return re.sub(r"^(.) \r$", r"\1", output)
Ejemplo n.º 10
0
class SbtWindowCommand(sublime_plugin.WindowCommand):
    def __init__(self, *args):
        super(SbtWindowCommand, self).__init__(*args)
        self._project = Project(self.window)
        self._runner = SbtRunner(self.window)
        self._sbt_view = SbtView(self.window)
        self._error_view = ErrorView(self.window)
        self._error_reporter = self._project.error_reporter
        self._error_report = self._project.error_report
        self._monitor_compile_output = BuildOutputMonitor(self._project)

    def is_sbt_project(self):
        return self._project.is_sbt_project()

    def is_play_project(self):
        return self._project.is_play_project()

    def is_sbt_running(self):
        return self._runner.is_sbt_running()

    def start_sbt(self, command=None):
        self._runner.start_sbt(command,
                               on_start=self._sbt_view.start,
                               on_stop=self._sbt_view.finish,
                               on_stdout=self._on_stdout,
                               on_stderr=self._on_stderr)

    def stop_sbt(self):
        self._runner.stop_sbt()

    def kill_sbt(self):
        self._runner.kill_sbt()

    def show_sbt(self):
        self._sbt_view.show()

    def hide_sbt(self):
        self._sbt_view.hide()

    def focus_sbt(self):
        self._sbt_view.focus()

    def take_input(self):
        return self._sbt_view.take_input()

    def send_to_sbt(self, cmd):
        self._runner.send_to_sbt(cmd)

    @delayed(0)
    def show_error(self, error):
        self._error_report.focus_error(error)
        self._error_reporter.show_errors()
        self._error_view.show_error(error)
        self.goto_error(error)

    @delayed(0)
    def goto_error(self, error):
        self.window.open_file(error.encoded_position(),
                              sublime.ENCODED_POSITION)

    def show_error_output(self):
        self._error_view.show()

    def setting(self, name):
        return self._project.setting(name)

    def _on_stdout(self, output):
        self._monitor_compile_output(output)
        self._show_output(output)

    def _on_stderr(self, output):
        self._show_output(output)

    @delayed(0)
    def _show_output(self, output):
        self._sbt_view.show_output(output)