UI fixes for deleting
This commit is contained in:
parent
16f7ad3840
commit
17cdea5857
@ -1485,20 +1485,36 @@ public class FilePanelTab extends JPanel {
|
|||||||
});
|
});
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
progressDialog.dispose();
|
progressDialog.dispose();
|
||||||
|
|
||||||
|
// Return focus to the application
|
||||||
|
Window win = SwingUtilities.getWindowAncestor(FilePanelTab.this);
|
||||||
|
if (win != null) {
|
||||||
|
win.toFront();
|
||||||
|
}
|
||||||
|
|
||||||
loadDirectory(getCurrentDirectory(), false);
|
loadDirectory(getCurrentDirectory(), false);
|
||||||
// Use another invokeLater to ensure BRIEF mode layout is updated
|
// Use another invokeLater to ensure BRIEF mode layout is updated
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
selectItemByIndex(rememberedIndex - 1);
|
selectItemByIndex(rememberedIndex);
|
||||||
|
fileTable.requestFocusInWindow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
progressDialog.dispose();
|
progressDialog.dispose();
|
||||||
|
// Return focus even on error
|
||||||
|
Window win = SwingUtilities.getWindowAncestor(FilePanelTab.this);
|
||||||
|
if (win != null) {
|
||||||
|
win.toFront();
|
||||||
|
}
|
||||||
JOptionPane.showMessageDialog(FilePanelTab.this, "Delete failed: " + ex.getMessage());
|
JOptionPane.showMessageDialog(FilePanelTab.this, "Delete failed: " + ex.getMessage());
|
||||||
|
fileTable.requestFocusInWindow();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
progressDialog.setVisible(true);
|
progressDialog.setVisible(true);
|
||||||
|
} else {
|
||||||
|
fileTable.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.add(deleteItem);
|
menu.add(deleteItem);
|
||||||
|
|||||||
@ -1432,6 +1432,11 @@ public class MainWindow extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
|
|
||||||
|
// Ensure focus returns to main window after dialog
|
||||||
|
this.toFront();
|
||||||
|
requestFocusInActivePanel();
|
||||||
|
|
||||||
Object selectedValue = pane.getValue();
|
Object selectedValue = pane.getValue();
|
||||||
if (selectedValue == null) return 2; // Cancel
|
if (selectedValue == null) return 2; // Cancel
|
||||||
if (selectedValue.equals(options[0])) return 0; // OK
|
if (selectedValue.equals(options[0])) return 0; // OK
|
||||||
@ -1483,7 +1488,7 @@ public class MainWindow extends JFrame {
|
|||||||
if (activePanel != null && activePanel.getCurrentTab() != null) {
|
if (activePanel != null && activePanel.getCurrentTab() != null) {
|
||||||
// Use another invokeLater to ensure BRIEF mode layout is updated
|
// Use another invokeLater to ensure BRIEF mode layout is updated
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
activePanel.getCurrentTab().selectItemByIndex(rememberedIndex - 1);
|
activePanel.getCurrentTab().selectItemByIndex(rememberedIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception ignore) {}
|
} catch (Exception ignore) {}
|
||||||
@ -2202,6 +2207,10 @@ public class MainWindow extends JFrame {
|
|||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
progressDialog.dispose();
|
progressDialog.dispose();
|
||||||
|
|
||||||
|
// Force the window to front and request focus after modal dialog
|
||||||
|
MainWindow.this.toFront();
|
||||||
|
|
||||||
for (FilePanel panel : panelsToRefresh) {
|
for (FilePanel panel : panelsToRefresh) {
|
||||||
if (panel.getCurrentDirectory() != null) {
|
if (panel.getCurrentDirectory() != null) {
|
||||||
panel.loadDirectory(panel.getCurrentDirectory(), false, false);
|
panel.loadDirectory(panel.getCurrentDirectory(), false, false);
|
||||||
@ -2212,9 +2221,7 @@ public class MainWindow extends JFrame {
|
|||||||
SwingUtilities.invokeLater(postTask);
|
SwingUtilities.invokeLater(postTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activePanel != null && activePanel.getFileTable() != null) {
|
requestFocusInActivePanel();
|
||||||
activePanel.getFileTable().requestFocusInWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callback.isCancelled()) {
|
if (callback.isCancelled()) {
|
||||||
JOptionPane.showMessageDialog(MainWindow.this, "Operation was cancelled by user.");
|
JOptionPane.showMessageDialog(MainWindow.this, "Operation was cancelled by user.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user