Exemple #1
0
	def is_enabled(self, paths = []):
		return SideBarSelection(paths).len() > 0
Exemple #2
0
	def run(self, paths = []):
		project = SideBarProject()
		if project.hasOpenedProject():
			for item in SideBarSelection(paths).getSelectedDirectories():
				project.rootAdd(item.path())
Exemple #3
0
	def is_enabled(self, paths = []):
		return SideBarSelection(paths).hasDirectories()
Exemple #4
0
	def is_enabled(self, paths = []):
		return SideBarSelection(paths).len() > 0 and SideBarSelection(paths).hasProjectDirectories() == False
Exemple #5
0
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedItems():
			item.reveal()
Exemple #6
0
	def is_enabled(self, paths = []):
		return SideBarSelection(paths).hasFiles()
Exemple #7
0
	def remove_safe_dir(self, path):
		if not SideBarSelection().isNone(path):
			try:
				os.rmdir(path)
			except:
				print "Unable to remove folder:\n\n"+path
Exemple #8
0
 def is_enabled(self, paths=[]):
     return SideBarSelection(paths).hasFilesWithExtension(
         'js') and SideBarSelection(paths).hasItemsUnderProject()
Exemple #9
0
	def run(self, paths = []):
		for item in SideBarSelection(paths).getSelectedFiles():
			item.open()
Exemple #10
0
 def is_enabled(self, paths=[], in_parent=False):
     s = sublime.load_settings(
         "SideBarEnhancements/Clipboard.sublime-settings")
     return s.get('cut', '') + s.get('copy', '') != '' and len(
         SideBarSelection(paths).getSelectedDirectoriesOrDirnames()) == 1
Exemple #11
0
 def is_enabled(self, paths=[]):
     return SideBarSelection(paths).hasImages() and SideBarSelection(
         paths).hasItemsUnderProject()
Exemple #12
0
    def run(self, paths=[], in_parent='False', test='True', replace='False'):
        s = sublime.load_settings(
            "SideBarEnhancements/Clipboard.sublime-settings")

        cut = s.get('cut', '')
        copy = s.get('copy', '')

        already_exists_paths = []

        if SideBarSelection(paths).len() > 0:
            if in_parent == 'False':
                location = SideBarSelection(paths).getSelectedItems()[0].path()
            else:
                location = SideBarSelection(
                    paths).getSelectedDirectoriesOrDirnames()[0].dirname()

            if os.path.isdir(location) == False:
                location = SideBarItem(os.path.dirname(location), True)
            else:
                location = SideBarItem(location, True)

            if cut != '':
                cut = cut.split("\n")
                for path in cut:
                    path = SideBarItem(path, os.path.isdir(path))
                    new = os.path.join(location.path(), path.name())
                    if test == 'True' and os.path.exists(new):
                        already_exists_paths.append(new)
                    elif test == 'False':
                        if os.path.exists(new) and replace == 'False':
                            pass
                        else:
                            try:
                                if not path.move(new, replace == 'True'):
                                    sublime.error_message(
                                        "Unable to cut and paste, destination exists."
                                    )
                                    return
                            except:
                                sublime.error_message("Unable to move:\n\n" +
                                                      path.path() +
                                                      "\n\nto\n\n" + new)
                                return

            if copy != '':
                copy = copy.split("\n")
                for path in copy:
                    path = SideBarItem(path, os.path.isdir(path))
                    new = os.path.join(location.path(), path.name())
                    if test == 'True' and os.path.exists(new):
                        already_exists_paths.append(new)
                    elif test == 'False':
                        if os.path.exists(new) and replace == 'False':
                            pass
                        else:
                            try:
                                if not path.copy(new, replace == 'True'):
                                    sublime.error_message(
                                        "Unable to copy and paste, destination exists."
                                    )
                                    return
                            except:
                                sublime.error_message("Unable to copy:\n\n" +
                                                      path.path() +
                                                      "\n\nto\n\n" + new)
                                return

            if test == 'True' and len(already_exists_paths):
                self.confirm(paths, in_parent, already_exists_paths)
            elif test == 'True' and not len(already_exists_paths):
                self.run(paths, in_parent, 'False', 'False')
            elif test == 'False':
                cut = s.set('cut', '')
                SideBarProject().refresh()
Exemple #13
0
 def remove_safe_file(self, path):
     if not SideBarSelection().isNone(path):
         try:
             os.remove(path)
         except:
             print "Unable to remove file:\n\n" + path
Exemple #14
0
	def run(self, paths = [], new = False):
		import functools
		self.window.run_command('hide_panel');
		self.window.show_input_panel("Duplicate As:", new or SideBarSelection(paths).getSelectedItems()[0].path(), functools.partial(self.on_done, SideBarSelection(paths).getSelectedItems()[0].path()), None, None)
Exemple #15
0
	def run(self, paths = []):
		import subprocess
		for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
			subprocess.Popen(['open', item.nameSystem()], cwd=item.dirnameSystem())
Exemple #16
0
	def run(self, paths = [], newLeaf = False):
		import functools
		branch, leaf = os.path.split(SideBarSelection(paths).getSelectedItems()[0].path())
		self.window.run_command('hide_panel');
		self.window.show_input_panel("New Name:", newLeaf or leaf, functools.partial(self.on_done, SideBarSelection(paths).getSelectedItems()[0].path(), branch), None, None)