From b5509b72646d241e69de833fd10e7fb0c1f9bb62 Mon Sep 17 00:00:00 2001 From: subhra74 Date: Sun, 20 Oct 2019 15:31:04 +0200 Subject: [PATCH] misc --- .../common/local/files/LocalFileSystem.java | 4 +++- .../files/browser/local/LocalMenuHandler.java | 16 +++++++++------- .../files/browser/sftp/SftpMenuHandler.java | 6 ++---- .../files/browser/ssh/ArchiveOperation.java | 6 +++++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/snowflake/common/local/files/LocalFileSystem.java b/src/main/java/snowflake/common/local/files/LocalFileSystem.java index 45d572b5..bbd04472 100644 --- a/src/main/java/snowflake/common/local/files/LocalFileSystem.java +++ b/src/main/java/snowflake/common/local/files/LocalFileSystem.java @@ -7,6 +7,7 @@ import java.io.*; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.List; @@ -112,6 +113,7 @@ public synchronized void delete(FileInfo f) throws Exception { @Override public void mkdir(String path) throws Exception { + System.out.println("Creating folder: " + path); new File(path).mkdirs(); } @@ -203,7 +205,7 @@ public String getProtocol() { */ @Override public void createFile(String path) throws Exception { - + Files.createFile(Paths.get(path)); } public void createLink(String src, String dst, boolean hardLink) diff --git a/src/main/java/snowflake/components/files/browser/local/LocalMenuHandler.java b/src/main/java/snowflake/components/files/browser/local/LocalMenuHandler.java index 9e529588..9bf95d81 100644 --- a/src/main/java/snowflake/components/files/browser/local/LocalMenuHandler.java +++ b/src/main/java/snowflake/components/files/browser/local/LocalMenuHandler.java @@ -151,16 +151,18 @@ private void createBuitinItems1(int selectionCount, JPopupMenu popup, FileInfo[] || selectedFiles[0].getType() == FileType.FileLink) { popup.add(mOpen); } + if (selectedFiles[0].getType() == FileType.Directory + || selectedFiles[0].getType() == FileType.DirLink) { + popup.add(mOpenInNewTab); + } + popup.add(mRename); } - if (selectedFiles[0].getType() == FileType.Directory - || selectedFiles[0].getType() == FileType.DirLink) { - popup.add(mOpenInNewTab); - } - if (selectionCount == 1) { - popup.add(mRename); - } + +// if (selectionCount == 1) { +// popup.add(mRename); +// } // if (selectionCount > 0) { // popup.add(mCopy); diff --git a/src/main/java/snowflake/components/files/browser/sftp/SftpMenuHandler.java b/src/main/java/snowflake/components/files/browser/sftp/SftpMenuHandler.java index eb28cd12..7d74ce15 100644 --- a/src/main/java/snowflake/components/files/browser/sftp/SftpMenuHandler.java +++ b/src/main/java/snowflake/components/files/browser/sftp/SftpMenuHandler.java @@ -2,7 +2,6 @@ import snowflake.common.FileInfo; import snowflake.common.FileType; -import snowflake.common.local.files.LocalFileSystem; import snowflake.common.ssh.files.SshFileSystem; import snowflake.components.files.FileComponentHolder; import snowflake.components.files.browser.FileBrowser; @@ -148,8 +147,7 @@ private void createBuitinItems1(int selectionCount, JPopupMenu popup, FileInfo[] } // if (selectionCount > 0) { -// popup.add(mCopy); -// popup.add(mCut); +// popup.add(mDelete); // } } @@ -194,7 +192,7 @@ private void delete(FileInfo[] selectedFiles) { fileBrowser.disableUi(); for (FileInfo f : selectedFiles) { try { - new LocalFileSystem().delete(f); + fs.delete(f); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/snowflake/components/files/browser/ssh/ArchiveOperation.java b/src/main/java/snowflake/components/files/browser/ssh/ArchiveOperation.java index 8561944e..abc67364 100644 --- a/src/main/java/snowflake/components/files/browser/ssh/ArchiveOperation.java +++ b/src/main/java/snowflake/components/files/browser/ssh/ArchiveOperation.java @@ -67,7 +67,11 @@ private boolean isSingleArchive(String archivePath) { archivePath = archivePath.toLowerCase(Locale.ENGLISH); for (String key : extractCommands.keySet()) { if (archivePath.endsWith(key) && (key.equals(".xz") || key.equals(".gz") || key.equals(".bz2"))) { - return true; + if (!(archivePath.endsWith(".tar.xz") + || archivePath.endsWith(".tar.gz") + || archivePath.endsWith(".tar.bz2"))) { + return true; + } } } return false;