public override bool CanDropNode(object dataObject, DragOperation operation) { if (dataObject is SystemFile) { FilePath targetPath = ShowAllFilesBuilderExtension.GetFolderPath(CurrentNode.DataItem); return(((SystemFile)dataObject).Path.ParentDirectory != targetPath || operation == DragOperation.Copy); } return(false); }
public override void OnNodeDrop(object dataObject, DragOperation operation) { FilePath targetPath = ShowAllFilesBuilderExtension.GetFolderPath(CurrentNode.DataItem); Project targetProject = (Project)CurrentNode.GetParentDataItem(typeof(Project), true); FilePath source = ((SystemFile)dataObject).Path; targetPath = targetPath.Combine(source.FileName); if (targetPath == source) { targetPath = ProjectOperations.GetTargetCopyName(targetPath, false); } using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(GettextCatalog.GetString("Copying files..."), Stock.StatusWorking, true)) { bool move = operation == DragOperation.Move; IdeApp.ProjectOperations.TransferFiles(monitor, null, source, targetProject, targetPath, move, false); } }