fixed background refresh blinking
This commit is contained in:
parent
7143c36ca3
commit
bc42c8986f
@ -875,16 +875,24 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadDirectory(File directory, boolean autoSelectFirst, boolean requestFocus) {
|
public void loadDirectory(File directory, boolean autoSelectFirst, boolean requestFocus) {
|
||||||
|
loadDirectory(directory, autoSelectFirst, requestFocus, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadDirectory(File directory, boolean autoSelectFirst, boolean requestFocus, final Runnable postLoadAction) {
|
||||||
// If we are switching directories, cleanup any previously extracted archive temp dirs
|
// If we are switching directories, cleanup any previously extracted archive temp dirs
|
||||||
cleanupArchiveTempDirIfNeeded(directory);
|
cleanupArchiveTempDirIfNeeded(directory);
|
||||||
if (directory == null || !directory.isDirectory()) {
|
if (directory == null || !directory.isDirectory()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean directoryChanged = this.currentDirectory == null || !this.currentDirectory.equals(directory);
|
||||||
this.currentDirectory = directory;
|
this.currentDirectory = directory;
|
||||||
briefCurrentColumn = 0;
|
|
||||||
lastValidRow = 0;
|
if (directoryChanged) {
|
||||||
lastValidBriefColumn = 0;
|
briefCurrentColumn = 0;
|
||||||
|
lastValidRow = 0;
|
||||||
|
lastValidBriefColumn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
List<FileItem> items = createFileItemList(directory);
|
List<FileItem> items = createFileItemList(directory);
|
||||||
tableModel.setItems(items);
|
tableModel.setItems(items);
|
||||||
@ -907,6 +915,11 @@ public class FilePanelTab extends JPanel {
|
|||||||
fileTable.setRowSelectionInterval(selRow, selRow);
|
fileTable.setRowSelectionInterval(selRow, selRow);
|
||||||
fileTable.scrollRectToVisible(fileTable.getCellRect(selRow, selCol, true));
|
fileTable.scrollRectToVisible(fileTable.getCellRect(selRow, selCol, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (postLoadAction != null) {
|
||||||
|
postLoadAction.run();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestFocus) {
|
if (requestFocus) {
|
||||||
fileTable.requestFocusInWindow();
|
fileTable.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
@ -920,6 +933,11 @@ public class FilePanelTab extends JPanel {
|
|||||||
fileTable.scrollRectToVisible(fileTable.getCellRect(0, 0, true));
|
fileTable.scrollRectToVisible(fileTable.getCellRect(0, 0, true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (postLoadAction != null) {
|
||||||
|
postLoadAction.run();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestFocus) {
|
if (requestFocus) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
try {
|
try {
|
||||||
@ -957,9 +975,7 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDirectory(currentDirectory, false, requestFocus);
|
loadDirectory(currentDirectory, false, requestFocus, () -> {
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
// Restore marks
|
// Restore marks
|
||||||
for (FileItem item : tableModel.items) {
|
for (FileItem item : tableModel.items) {
|
||||||
if (markedNames.contains(item.getName())) {
|
if (markedNames.contains(item.getName())) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user