public void Execute(Tuple <TreeViewEntryItemModel, TreeViewEntryItemModel> param)
        {
            var movedItem       = param.Item1;
            var destinationItem = param.Item2;

            if (movedItem == destinationItem || movedItem == null || destinationItem == null || (movedItem.NodeType != NodeType.Directory && movedItem.NodeType != NodeType.File) ||
                (destinationItem.NodeType != NodeType.Directory && destinationItem.NodeType != NodeType.File))
            {
                return;
            }
            if (!this.unsavedFileChecker.EnsureCurrentlyOpenedFileIsSaved())
            {
                return;
            }
            string rootDirectory = this.workspaceDirectoryModel.CurrentWorkspaceDirectory;
            string destPath      = destinationItem != null ? destinationItem.Path : rootDirectory;

            if (!this.messageBoxHelper.ShowConfirmMessage(String.Format("Please confirm you want to move '{0}' to '{1}'.", movedItem.Path, destPath)))
            {
                return;
            }
            try
            {
                string newPath;
                // moved to the empty place, i.e. to the workspace directory
                if (destinationItem == null)
                {
                    newPath = this.GenerateNewPathForDir(rootDirectory, movedItem.Name);
                }
                else if (destinationItem.NodeType == NodeType.File)
                {
                    newPath = this.GenerateNewPath(destinationItem.Path, movedItem.Name);
                }
                else if (destinationItem.NodeType == NodeType.Directory)
                {
                    newPath = this.GenerateNewPathForDir(destinationItem.Path, movedItem.Name);
                }
                else
                {
                    return;
                }
                this.filesPatternProvider.RemoveAdditionalPath(movedItem.Path);
                this.filesPatternProvider.AddAdditionalPath(newPath);
                bool closed = this.iseIntegrator.CloseFile(movedItem.Path);
                fileSystemOperationsService.RenameFileOrDirectory(movedItem.Path, newPath);
                if (closed)
                {
                    this.iseIntegrator.GoToFile(newPath);
                }
                if (destinationItem != null)
                {
                    destinationItem.IsExpanded = true;
                }
            }
            catch (Exception e)
            {
                this.treeViewModel.PathOfItemToSelectOnRefresh = null;
                this.messageBoxHelper.ShowError("Failed to move: " + e.Message);
            }
        }
        public void MoveTreeItem(TreeViewEntryItemModel movedItem, TreeViewEntryItemModel destinationItem, string rootDirectory)
        {
            if (movedItem == destinationItem || movedItem == null)
            {
                return;
            }
            if (!this.HandleUnsavedFileManipulation(movedItem))
            {
                return;
            }
            string destPath = destinationItem != null ? destinationItem.Path : rootDirectory;

            if (!MessageBoxHelper.ShowConfirmMessage(String.Format("Please confirm you want to move '{0}' to '{1}'.", movedItem.Path, destPath)))
            {
                return;
            }
            try
            {
                string newPath;
                // moved to the empty place, i.e. to the workspace directory
                if (destinationItem == null)
                {
                    newPath = this.GenerateNewPathForDir(rootDirectory, movedItem.Name);
                }
                else if (destinationItem.NodeType == NodeType.File)
                {
                    newPath = this.GenerateNewPath(destinationItem.Path, movedItem.Name);
                }
                else if (destinationItem.NodeType == NodeType.Directory)
                {
                    newPath = this.GenerateNewPathForDir(destinationItem.Path, movedItem.Name);
                }
                else
                {
                    return;
                }
                this.FilesPatternProvider.RemoveAdditionalPath(movedItem.Path);
                this.FilesPatternProvider.AddAdditionalPath(newPath);
                bool closed = this.IseIntegrator.CloseFile(movedItem.Path);
                FileSystemOperationsService.RenameFileOrDirectory(movedItem.Path, newPath);
                if (closed)
                {
                    this.IseIntegrator.GoToFile(newPath);
                }
                if (destinationItem != null)
                {
                    destinationItem.IsExpanded = true;
                }
            }
            catch (Exception e)
            {
                this.PathOfItemToSelectOnRefresh = null;
                MessageBoxHelper.ShowError("Failed to move: " + e.Message);
            }
        }
        private void EndRenamingTreeItem(string newValue, bool save, TreeViewEntryItemModel selectedItem)
        {
            if (!save || String.IsNullOrEmpty(newValue) || selectedItem == null)
            {
                return;
            }

            try
            {
                string oldPath = selectedItem.Path;
                string newPath = this.GenerateNewPath(selectedItem.Path, newValue);
                bool   closed  = this.iseIntegrator.CloseFile(oldPath);
                fileSystemOperationsService.RenameFileOrDirectory(oldPath, newPath);
                if (closed)
                {
                    this.iseIntegrator.GoToFile(newPath);
                }
            }
            catch (Exception e)
            {
                this.treeViewModel.PathOfItemToSelectOnRefresh = null;
                this.messageBoxHelper.ShowError("Failed to rename: " + e.Message);
            }
        }