def on_input(self, input):
        view = self.window.active_view()
        settings = view.settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")
        is_module = self.mode == 'module'
        files_to_open = []

        old = to_disk_path_form(self.classpath, self.option, is_module)
        new = to_disk_path_form(self.classpath, input, is_module)

        if self.mode == 'module':
            for w in sublime.windows():
                for v in w.views():
                    if v.file_name() == old:
                        w.focus_view(v)
                        w.run_command('close')
                        files_to_open.append(new)
        elif self.mode == 'package':
            for w in sublime.windows():
                for v in w.views():
                    if old in v.file_name():
                        relpath = os.path.relpath(v.file_name(), old)
                        files_to_open.append(os.path.join(new, relpath))
                        w.focus_view(v)
                        w.run_command('close')

        res, err = runcmd([
            haxelib_path, 'run', 'refactor', '-vv', 'rename',
            self.classpath, old, new], '')
        print('\nRefactor:\n' + res)

        for f in files_to_open:
            self.window.open_file(f)
    def on_input(self, input):
        view = self.window.active_view()
        settings = view.settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")
        is_module = self.mode == 'module'
        files_to_open = []

        old = to_disk_path_form(self.classpath, self.option, is_module)
        new = to_disk_path_form(self.classpath, input, is_module)

        if self.mode == 'module':
            for w in sublime.windows():
                for v in w.views():
                    if v.file_name() == old:
                        w.focus_view(v)
                        w.run_command('close')
                        files_to_open.append(new)
        elif self.mode == 'package':
            for w in sublime.windows():
                for v in w.views():
                    if old in v.file_name():
                        relpath = os.path.relpath(v.file_name(), old)
                        files_to_open.append(os.path.join(new, relpath))
                        w.focus_view(v)
                        w.run_command('close')

        res, err = runcmd([
            haxelib_path, 'run', 'refactor', '-vv', 'rename',
            self.classpath, old, new], '')
        print('\nRefactor:\n' + res)

        for f in files_to_open:
            self.window.open_file(f)
    def check_refactor_lib(view):
        settings = view.settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")
        res, err = runcmd([haxelib_path, 'run', 'refactor'], '')

        HaxeRefactor.is_installed = 1
        if 'is not installed' in res:
            HaxeRefactor.is_installed = 0
    def check_refactor_lib(view):
        settings = view.settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")
        res, err = runcmd([haxelib_path, 'run', 'refactor'], '')

        HaxeRefactor.is_installed = 1
        if 'is not installed' in res:
            HaxeRefactor.is_installed = 0
Exemple #5
0
    def do_update(self, library):

        sublime.status_message("Please wait, updating haxelib " + library)

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")

        out, err = runcmd([haxelib_path, "update", library])
        sublime.status_message(str(out))
        show_quick_panel(self.window, out.splitlines(), None)
    def do_update(self,library):

        sublime.status_message("Please wait, updating haxelib " + library);

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path","haxelib")

        out,err = runcmd([haxelib_path , "update", library]);
        sublime.status_message(str(out))
        show_quick_panel(self.window, out.splitlines(), None)
    def on_input(self, value):
        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path","haxelib")

        if(value != ""):
            out,err = runcmd([haxelib_path , "install", value]);
            outlines = out.splitlines()
            sublime.status_message(str(outlines));
            self.window.show_quick_panel(outlines, None, sublime.MONOSPACE_FONT)
        else:
            self.window.show_quick_panel( [["Invalid library name","Hit return to try again, escape to cancel"]], self.on_invalid )
    def on_input(self, value):
        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")

        if (value != ""):
            out, err = runcmd([haxelib_path, "install", value])
            outlines = out.splitlines()
            sublime.status_message(str(outlines))
            self.window.show_quick_panel(outlines, None,
                                         sublime.MONOSPACE_FONT)
        else:
            self.window.show_quick_panel([[
                "Invalid library name",
                "Hit return to try again, escape to cancel"
            ]], self.on_invalid)
    def do_action(self, action, library):

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")

        out, err = runcmd([haxelib_path, action, self.selected])
        lines = out.splitlines()

        # the description can be rather long,
        # so we just split it up some
        if action == "install":

            show_quick_panel(self.window, lines, None)
            return

        if action == "info":
            max_length = 60

            #store the desc
            desc = lines[2]
            #remove it from the list
            del lines[2]

            #wrap it neatly
            descsplit = textwrap.wrap(desc, max_length)

            #now replace the Desc: into it's own line
            descsplit[0] = descsplit[0].replace('Desc: ', '')
            descsplit.append('')
            descsplit.reverse()

            #reinsert
            for d in descsplit:
                lines.insert(2, "\t\t" + d)

            #and the desc header
            lines.insert(2, 'Desc: ')

        for index, line in enumerate(lines):
            length = len(line)
            if (length > max_length):
                split_lines = textwrap.wrap(line, max_length)
                lines[index] = split_lines[0] + ' ...'

        show_quick_panel(self.window, lines, None)
    def do_action(self,action,library):

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path","haxelib")

        out,err = runcmd([ haxelib_path , action, self.selected]);
        lines = out.splitlines()

        # the description can be rather long,
        # so we just split it up some
        if action == "install":

            show_quick_panel(self.window,lines,None)
            return

        if action == "info":
            max_length = 60

            #store the desc
            desc = lines[2]
            #remove it from the list
            del lines[2]

            #wrap it neatly
            descsplit = textwrap.wrap(desc,max_length)

            #now replace the Desc: into it's own line
            descsplit[0] = descsplit[0].replace('Desc: ','')
            descsplit.append('')
            descsplit.reverse()

            #reinsert
            for d in descsplit:
                lines.insert(2,"\t\t"+d)

            #and the desc header
            lines.insert(2, 'Desc: ')

        for index, line in enumerate(lines):
            length = len(line)
            if(length > max_length):
                split_lines = textwrap.wrap(line,max_length)
                lines[index] = split_lines[0] + ' ...'

        show_quick_panel(self.window,lines,None)
    def run(self, paths = [] , t = "list"):

        self.action = t

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path","haxelib")

        out,err = runcmd([haxelib_path , "list"]);

        libs = out.splitlines()

        self.libs = []
        menu = []
        for _lib in libs :
            libname,libcurrent,libversions = self.haxelib_parse_libversions(_lib)
            menu.append([ libname + "   " + libcurrent , libversions ])
            self.libs.append(libname)

        self.window.show_quick_panel( menu, self.on_select )
    def run(self):

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")

        out, err = runcmd([haxelib_path, "search"], " \n \n \n")
        lines = out.splitlines()

        if len(lines) > 0:
            #remove the initial prompt
            lines[0] = lines[0].replace("Search word : ", "")

        #sort alphabetically
        lines = sorted(lines, key=str.lower)

        #store for later
        self.libs = lines

        #show list
        show_quick_panel(self.window, lines, self.on_lib_select)
Exemple #13
0
    def run(self, paths=[], t="list"):

        self.action = t

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path", "haxelib")

        out, err = runcmd([haxelib_path, "list"])

        libs = out.splitlines()

        self.libs = []
        menu = []
        for _lib in libs:
            libname, libcurrent, libversions = self.haxelib_parse_libversions(
                _lib)
            menu.append([libname + "   " + libcurrent, libversions])
            self.libs.append(libname)

        self.window.show_quick_panel(menu, self.on_select)
    def run(self):

        settings = self.window.active_view().settings()
        haxelib_path = settings.get("haxelib_path","haxelib")

        out,err = runcmd([ haxelib_path , "search"], " \n \n \n");
        lines = out.splitlines()

        if len(lines) > 0 :
            #remove the initial prompt
            lines[0] = lines[0].replace("Search word : ","")

        #sort alphabetically
        lines = sorted( lines , key = str.lower )

        #store for later
        self.libs = lines

        #show list
        show_quick_panel(self.window,lines,self.on_lib_select)
    def run(self):
        out,err = runcmd(["haxelib" , "upgrade"]);

        self.window.show_quick_panel(out.splitlines(), None)
    def run(self):
        out, err = runcmd(["haxelib", "upgrade"])

        self.window.show_quick_panel(out.splitlines(), None)