mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
Refactor
This commit is contained in:
parent
b69e2fadd5
commit
30b79710e3
@ -75,14 +75,14 @@ class RenameAction extends AbstractAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
if (model.names().isEmpty() || model.files().isEmpty()) {
|
||||||
|
log.info("Nothing to rename. New Names is empty. Please <Fetch Data> first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Window window = getWindow(evt.getSource());
|
Window window = getWindow(evt.getSource());
|
||||||
withWaitCursor(window, () -> {
|
withWaitCursor(window, () -> {
|
||||||
if (model.files().isEmpty() || model.values().isEmpty()) {
|
|
||||||
log.info("Nothing to rename. New Names is empty.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<File, File> renameMap = checkRenamePlan(validate(model.getRenameMap(), window), window);
|
Map<File, File> renameMap = checkRenamePlan(validate(model.getRenameMap(), window), window);
|
||||||
if (renameMap.isEmpty()) {
|
if (renameMap.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -16,8 +16,6 @@ import java.awt.Insets;
|
|||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@ -252,25 +250,21 @@ public class RenamePanel extends JComponent {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// reveal file location on double click
|
// reveal file location on double click
|
||||||
filesList.getListComponent().addMouseListener(new MouseAdapter() {
|
filesList.getListComponent().addMouseListener(mouseClicked(evt -> {
|
||||||
|
if (evt.getClickCount() == 2) {
|
||||||
@Override
|
getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
public void mouseClicked(MouseEvent evt) {
|
try {
|
||||||
if (evt.getClickCount() == 2) {
|
JList list = (JList) evt.getSource();
|
||||||
getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
if (list.getSelectedIndex() >= 0) {
|
||||||
try {
|
UserFiles.revealFiles(list.getSelectedValuesList());
|
||||||
JList list = (JList) evt.getSource();
|
|
||||||
if (list.getSelectedIndex() >= 0) {
|
|
||||||
UserFiles.revealFiles(list.getSelectedValuesList());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
debug.log(Level.WARNING, e.getMessage(), e);
|
|
||||||
} finally {
|
|
||||||
getWindow(evt.getSource()).setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
debug.log(Level.WARNING, e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
getWindow(evt.getSource()).setCursor(Cursor.getDefaultCursor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
// reveal file location on double click
|
// reveal file location on double click
|
||||||
namesList.getListComponent().addMouseListener(mouseClicked(evt -> {
|
namesList.getListComponent().addMouseListener(mouseClicked(evt -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user