focus after operation
This commit is contained in:
parent
2de5cf6bc4
commit
896eafe62b
@ -1024,6 +1024,10 @@ public class MainWindow extends JFrame {
|
||||
performFileOperation((callback) -> {
|
||||
FileOperations.copy(selectedItems, targetDir, callback);
|
||||
}, "Copy completed", true, targetPanel);
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1052,6 +1056,10 @@ public class MainWindow extends JFrame {
|
||||
performFileOperation((callback) -> {
|
||||
FileOperations.move(selectedItems, targetDir, callback);
|
||||
}, "Move completed", false, activePanel, targetPanel);
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1104,8 +1112,13 @@ public class MainWindow extends JFrame {
|
||||
if (targetRow >= rowCount) targetRow = rowCount - 1; // move up if needed
|
||||
t.setRowSelectionInterval(targetRow, targetRow);
|
||||
t.scrollRectToVisible(t.getCellRect(targetRow, 0, true));
|
||||
t.requestFocusInWindow();
|
||||
} catch (Exception ignore) {}
|
||||
});
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1142,6 +1155,9 @@ public class MainWindow extends JFrame {
|
||||
|
||||
String zipName = JOptionPane.showInputDialog(this, "Enter zip filename:", defaultName);
|
||||
if (zipName == null || zipName.trim().isEmpty()) {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1157,6 +1173,9 @@ public class MainWindow extends JFrame {
|
||||
int confirm = JOptionPane.showConfirmDialog(this,
|
||||
"File already exists. Overwrite?", "Zip", JOptionPane.YES_NO_OPTION);
|
||||
if (confirm != JOptionPane.YES_OPTION) {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1201,6 +1220,10 @@ public class MainWindow extends JFrame {
|
||||
performFileOperation((callback) -> {
|
||||
FileOperations.unzip(zipFile, targetDir, callback);
|
||||
}, "Unzipped into " + targetDir.getName(), false, targetPanel);
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1230,6 +1253,10 @@ public class MainWindow extends JFrame {
|
||||
performFileOperation((callback) -> {
|
||||
FileOperations.rename(item.getFile(), newName.trim());
|
||||
}, "Rename completed", false, activePanel);
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1247,6 +1274,10 @@ public class MainWindow extends JFrame {
|
||||
performFileOperation((callback) -> {
|
||||
FileOperations.createDirectory(activePanel.getCurrentDirectory(), dirName.trim());
|
||||
}, "Directory created", false, activePanel);
|
||||
} else {
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1703,8 +1734,14 @@ public class MainWindow extends JFrame {
|
||||
panel.loadDirectory(panel.getCurrentDirectory());
|
||||
}
|
||||
}
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
if (callback.isCancelled()) {
|
||||
JOptionPane.showMessageDialog(MainWindow.this, "Operation was cancelled by user.");
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@ -1714,6 +1751,9 @@ public class MainWindow extends JFrame {
|
||||
"Error: " + e.getMessage(),
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
||||
activePanel.getFileTable().requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user