fixed background reload with inline rename
This commit is contained in:
parent
a132d33480
commit
0a67ead084
@ -91,6 +91,8 @@ public class FilePanelTab extends JPanel {
|
||||
private File archiveReturnDirectory = null;
|
||||
private Point archiveReturnViewPosition = null;
|
||||
private boolean inlineRenameActive = false;
|
||||
private boolean refreshDeferredWhileInlineRename = false;
|
||||
private boolean deferredRefreshRequestFocus = false;
|
||||
private boolean active = false;
|
||||
private final Map<String, Long> changeTimestamps = new HashMap<>();
|
||||
private static final long CHANGE_HIGHLIGHT_DURATION = 500; // 0.5 seconds per item
|
||||
@ -237,6 +239,24 @@ public class FilePanelTab extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInlineRenameInProgress() {
|
||||
return inlineRenameActive || (fileTable != null && fileTable.isEditing());
|
||||
}
|
||||
|
||||
private void flushDeferredRefreshAfterInlineRename() {
|
||||
if (!refreshDeferredWhileInlineRename) return;
|
||||
|
||||
final boolean requestFocus = deferredRefreshRequestFocus;
|
||||
refreshDeferredWhileInlineRename = false;
|
||||
deferredRefreshRequestFocus = false;
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (!isInlineRenameInProgress()) {
|
||||
refresh(requestFocus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that column renderers are attached. Useful when the tab was just added to a container
|
||||
* and the ColumnModel may not yet be in its final state.
|
||||
@ -494,12 +514,14 @@ public class FilePanelTab extends JPanel {
|
||||
public void editingStopped(javax.swing.event.ChangeEvent e) {
|
||||
super.editingStopped(e);
|
||||
inlineRenameActive = false;
|
||||
flushDeferredRefreshAfterInlineRename();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editingCanceled(javax.swing.event.ChangeEvent e) {
|
||||
super.editingCanceled(e);
|
||||
inlineRenameActive = false;
|
||||
flushDeferredRefreshAfterInlineRename();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1717,6 +1739,12 @@ public class FilePanelTab extends JPanel {
|
||||
* Refresh the current directory while attempting to preserve selection and focus.
|
||||
*/
|
||||
public void refresh(boolean requestFocus) {
|
||||
if (isInlineRenameInProgress()) {
|
||||
refreshDeferredWhileInlineRename = true;
|
||||
deferredRefreshRequestFocus |= requestFocus;
|
||||
return;
|
||||
}
|
||||
|
||||
if (searchModeActive) {
|
||||
// In search results mode, refresh means checking if items still exist
|
||||
List<FileItem> itemsToRemove = new ArrayList<>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user