drag and drop fixed
This commit is contained in:
parent
a2dc165944
commit
a7a86059a8
@ -459,8 +459,9 @@ public class FilePanelTab extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
// If CTRL is NOT pressed and SHIFT is NOT pressed, unselect all other items before selecting this one
|
||||
if (!e.isControlDown() && !e.isShiftDown()) {
|
||||
// If CTRL is NOT pressed and SHIFT is NOT pressed, unselect all other items before selecting this one,
|
||||
// but only if the clicked item is not already marked (to allow dragging a multiple selection).
|
||||
if (!e.isControlDown() && !e.isShiftDown() && !item.isMarked()) {
|
||||
unselectAll();
|
||||
}
|
||||
// Toggle marked state if CTRL is pressed
|
||||
@ -508,8 +509,9 @@ public class FilePanelTab extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
// If CTRL is NOT pressed and SHIFT is NOT pressed, unselect all other items before selecting this one
|
||||
if (!e.isControlDown() && !e.isShiftDown()) {
|
||||
// If CTRL is NOT pressed and SHIFT is NOT pressed, unselect all other items before selecting this one,
|
||||
// but only if the clicked item is not already marked (to allow dragging a multiple selection).
|
||||
if (!e.isControlDown() && !e.isShiftDown() && !item.isMarked()) {
|
||||
unselectAll();
|
||||
}
|
||||
if (e.isControlDown() && !item.getName().equals("..")) {
|
||||
@ -607,6 +609,13 @@ public class FilePanelTab extends JPanel {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void exportDone(JComponent source, Transferable data, int action) {
|
||||
if (action == COPY || action == MOVE) {
|
||||
unselectAll();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fileTable.setFocusTraversalKeysEnabled(false);
|
||||
|
||||
@ -458,7 +458,23 @@ public class MainWindow extends JFrame {
|
||||
try {
|
||||
List<File> files = (List<File>) support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
|
||||
if (files != null && !files.isEmpty()) {
|
||||
showAddToolbarShortcutDialog(files.getFirst());
|
||||
if (files.size() == 1) {
|
||||
showAddToolbarShortcutDialog(files.get(0));
|
||||
} else {
|
||||
// Add all as shortcuts with default names/icons
|
||||
List<AppConfig.ToolbarShortcut> shortcuts = config.getToolbarShortcuts();
|
||||
for (File f : files) {
|
||||
String label = f.getName();
|
||||
String command = f.getAbsolutePath();
|
||||
String workDir = f.isDirectory() ? f.getAbsolutePath() : f.getParent();
|
||||
shortcuts.add(new AppConfig.ToolbarShortcut(command, label, "", workDir));
|
||||
}
|
||||
config.saveToolbarShortcuts(shortcuts);
|
||||
createToolBar(); // refresh
|
||||
JOptionPane.showMessageDialog(MainWindow.this,
|
||||
files.size() + " shortcuts added to toolbar.",
|
||||
"Shortcuts Added", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user