mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-01 09:40:35 +13:00
Prevent empty dragboards
This commit is contained in:
parent
0eaa928441
commit
07964f4bef
2 changed files with 10 additions and 1 deletions
|
@ -73,6 +73,10 @@ public class BrowserClipboard {
|
|||
|
||||
@SneakyThrows
|
||||
public static ClipboardContent startDrag(FileSystem.FileEntry base, List<FileSystem.FileEntry> selected) {
|
||||
if (selected.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var content = new ClipboardContent();
|
||||
var id = UUID.randomUUID();
|
||||
currentDragClipboard = new Instance(id, base, new ArrayList<>(selected));
|
||||
|
@ -82,6 +86,11 @@ public class BrowserClipboard {
|
|||
|
||||
@SneakyThrows
|
||||
public static void startCopy(FileSystem.FileEntry base, List<FileSystem.FileEntry> selected) {
|
||||
if (selected.isEmpty()) {
|
||||
currentCopyClipboard.setValue(null);
|
||||
return;
|
||||
}
|
||||
|
||||
var id = UUID.randomUUID();
|
||||
currentCopyClipboard.setValue(new Instance(id, base, new ArrayList<>(selected)));
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ public final class OpenFileSystemModel {
|
|||
|
||||
var abs = FileNames.join(getCurrentDirectory().getPath(), name);
|
||||
if (fileSystem.directoryExists(abs)) {
|
||||
throw new IllegalStateException(String.format("Directory %s already exists", abs));
|
||||
throw ErrorEvent.unreportable(new IllegalStateException(String.format("Directory %s already exists", abs)));
|
||||
}
|
||||
|
||||
fileSystem.mkdirs(abs);
|
||||
|
|
Loading…
Reference in a new issue