This commit is contained in:
Reinhard Pointner 2016-04-26 16:09:34 +08:00
parent b69e2fadd5
commit 30b79710e3
2 changed files with 17 additions and 23 deletions

View File

@ -75,14 +75,14 @@ class RenameAction extends AbstractAction {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
try { if (model.names().isEmpty() || model.files().isEmpty()) {
Window window = getWindow(evt.getSource()); log.info("Nothing to rename. New Names is empty. Please <Fetch Data> first.");
withWaitCursor(window, () -> {
if (model.files().isEmpty() || model.values().isEmpty()) {
log.info("Nothing to rename. New Names is empty.");
return; return;
} }
try {
Window window = getWindow(evt.getSource());
withWaitCursor(window, () -> {
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;

View File

@ -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,10 +250,7 @@ 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 -> {
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2) { if (evt.getClickCount() == 2) {
getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); getWindow(evt.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
@ -269,8 +264,7 @@ public class RenamePanel extends JComponent {
getWindow(evt.getSource()).setCursor(Cursor.getDefaultCursor()); 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 -> {