Exemple #1
0
    def analyze_modules(self):
        """Perform static object analysis on all project modules"""
        self._check_project()

        def _analyze_modules(handle):
            libutils.analyze_modules(self.project, task_handle=handle)

        refactor.runtask(self.env, _analyze_modules, 'Analyze project modules')
Exemple #2
0
    def analyze_modules(self):
        """Perform static object analysis on all project modules"""
        self._check_project()

        def _analyze_modules(handle):
            libutils.analyze_modules(self.project, task_handle=handle)

        refactor.runtask(self.env, _analyze_modules, "Analyze project modules")
Exemple #3
0
 def redo(self):
     self._check_project()
     change = self.project.history.tobe_redone
     if change is None:
         self.env.message('Nothing to redo!')
         return
     if self.env.y_or_n('Redo [%s]? ' % str(change)):
         def redo(handle):
             for changes in self.project.history.redo(task_handle=handle):
                 self._reload_buffers(changes)
         refactor.runtask(self.env, redo, 'Redo refactoring',
                          interrupts=False)
Exemple #4
0
    def generate_autoimport_cache(self):
        if not self._check_autoimport():
            return
        modules = self.env.get('autoimport_modules')
        modules = [ m if isinstance(m, basestring) else m.value() for m in modules ]

        def generate(handle):
            self.autoimport.generate_cache(task_handle=handle)
            self.autoimport.generate_modules_cache(modules, task_handle=handle)

        refactor.runtask(self.env, generate, 'Generate autoimport cache')
        self.write_project()
Exemple #5
0
 def redo(self):
     self._check_project()
     change = self.project.history.tobe_redone
     if change is None:
         self.env.message('Nothing to redo!')
         return
     if self.env.y_or_n('Redo [%s]? ' % str(change)):
         def redo(handle):
             for changes in self.project.history.redo(task_handle=handle):
                 self._reload_buffers(changes)
         refactor.runtask(self.env, redo, 'Redo refactoring',
                          interrupts=False)
Exemple #6
0
    def undo(self):
        self._check_project()
        change = self.project.history.tobe_undone
        if change is None:
            self.env.message("Nothing to undo!")
            return
        if self.env.y_or_n("Undo [%s]? " % str(change)):

            def undo(handle):
                for changes in self.project.history.undo(task_handle=handle):
                    self._reload_buffers(changes, undo=True)

            refactor.runtask(self.env, undo, "Undo refactoring", interrupts=False)
Exemple #7
0
    def generate_autoimport_cache(self):
        if not self._check_autoimport():
            return
        modules = self.env.get('autoimport_modules')
        modules = [
            m if isinstance(m, basestring) else m.value() for m in modules
        ]

        def generate(handle):
            self.autoimport.generate_cache(task_handle=handle)
            self.autoimport.generate_modules_cache(modules, task_handle=handle)

        refactor.runtask(self.env, generate, 'Generate autoimport cache')
        self.write_project()
 def generate_autoimport_cache(self):
     if not self._check_autoimport():
         return
     modules = self.env.get('autoimport_modules')
     modnames = []
     if modules:
         for i in range(len(modules)):
             modname = modules[i]
             if not isinstance(modname, basestring):
                 modname = modname.value()
             modnames.append(modname)
     def generate(handle):
         self.autoimport.generate_cache(task_handle=handle)
         self.autoimport.generate_modules_cache(modules, task_handle=handle)
     refactor.runtask(self.env, generate, 'Generate autoimport cache')
Exemple #9
0
 def generate_autoimport_cache(self):
     if not self._check_autoimport():
         return
     modules = self.env.get('autoimport_modules')
     modnames = []
     if modules:
         for i in range(len(modules)):
             modname = modules[i]
             if not isinstance(modname, basestring):
                 modname = modname.value()
             modnames.append(modname)
     def generate(handle):
         self.autoimport.generate_cache(task_handle=handle)
         self.autoimport.generate_modules_cache(modules, task_handle=handle)
     refactor.runtask(self.env, generate, 'Generate autoimport cache')
Exemple #10
0
    def _base_findit(self, do_find, optionals, get_kwds):
        self._check_project()
        self._save_buffers()
        resource, offset = self._get_location()

        action, values = dialog.show_dialog(self._askdata, ["search", "cancel"], optionals=optionals)
        if action == "search":
            kwds = get_kwds(values)

            def calculate(handle):
                resources = refactor._resources(self.project, values.get("resources"))
                return do_find(self.project, resource, offset, resources=resources, task_handle=handle, **kwds)

            result = refactor.runtask(self.env, calculate, "Find Occurrences")
            locations = [Location(location) for location in result]
            self.env.show_occurrences(locations)
Exemple #11
0
    def _base_findit(self, do_find, optionals, get_kwds):
        self._check_project()
        self._save_buffers()
        resource, offset = self._get_location()

        action, values = dialog.show_dialog(
            self._askdata, ['search', 'cancel'], optionals=optionals)
        if action == 'search':
            kwds = get_kwds(values)
            def calculate(handle):
                resources = refactor._resources(self.project,
                                                values.get('resources'))
                return do_find(self.project, resource, offset,
                               resources=resources, task_handle=handle, **kwds)
            result = refactor.runtask(self.env, calculate, 'Find Occurrences')
            locations = [Location(location) for location in result]
            self.env.show_occurrences(locations)