mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Small file browser fixes [release]
This commit is contained in:
parent
94a6b8d5cc
commit
ea24d3e46e
7 changed files with 31 additions and 18 deletions
|
@ -27,7 +27,6 @@ import javafx.scene.control.skin.TableViewSkin;
|
|||
import javafx.scene.control.skin.VirtualFlow;
|
||||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
import java.time.Instant;
|
||||
|
@ -172,14 +171,8 @@ final class FileListComp extends AnchorPane {
|
|||
table.pseudoClassStateChanged(DRAG_INTO_CURRENT, newValue);
|
||||
});
|
||||
|
||||
row.addEventHandler(MouseEvent.MOUSE_CLICKED, t -> {
|
||||
listEntry.get().onMouseClick(t);
|
||||
});
|
||||
|
||||
row.setOnMouseClicked(e -> {
|
||||
if (e.getClickCount() == 2 && !row.isEmpty()) {
|
||||
fileList.onDoubleClick(row.getItem());
|
||||
}
|
||||
listEntry.get().onMouseClick(e);
|
||||
});
|
||||
|
||||
row.setOnDragEntered(event -> {
|
||||
|
|
|
@ -5,6 +5,7 @@ import javafx.geometry.Point2D;
|
|||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.SnapshotParameters;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.image.WritableImage;
|
||||
import javafx.scene.input.*;
|
||||
import lombok.Getter;
|
||||
|
@ -32,21 +33,41 @@ public class FileListCompEntry {
|
|||
this.model = model;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onMouseClick(MouseEvent t) {
|
||||
t.consume();
|
||||
if (item == null || isSynthetic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.getClickCount() == 2 && t.getButton() == MouseButton.PRIMARY) {
|
||||
model.onDoubleClick(item);
|
||||
t.consume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.getButton() == MouseButton.PRIMARY && t.isShiftDown()) {
|
||||
var tv = ((TableView<FileSystem.FileEntry>) row.getParent().getParent().getParent().getParent());
|
||||
var all = tv.getItems();
|
||||
var start = tv.getSelectionModel().getSelectedItems().stream().mapToInt(entry -> all.indexOf(entry)).min().orElse(1);
|
||||
var end = all.indexOf(item);
|
||||
model.getSelected().setAll(all.subList(start, end + 1));
|
||||
t.consume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentContextMenu != null) {
|
||||
currentContextMenu.hide();
|
||||
currentContextMenu = null;
|
||||
t.consume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.getButton() == MouseButton.SECONDARY) {
|
||||
var cm = new FileContextMenu(model.getFileSystemModel(), item, model.getEditing());
|
||||
cm.show(row, t.getScreenX(), t.getScreenY());
|
||||
currentContextMenu = cm;
|
||||
t.consume();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface FileIconFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
return Arrays.stream(endings).anyMatch(ending -> entry.getPath().endsWith(ending)) ? getIcon() : null;
|
||||
return Arrays.stream(endings).anyMatch(ending -> entry.getPath().toLowerCase().endsWith(ending.toLowerCase())) ? getIcon() : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ import javafx.beans.property.SimpleStringProperty;
|
|||
public class FileIcons {
|
||||
|
||||
public static PrettyImageComp createIcon(FileSystem.FileEntry entry) {
|
||||
return new PrettyImageComp(new SimpleStringProperty(getIcon(entry)), 22, 22);
|
||||
}
|
||||
|
||||
public static String getIcon(FileSystem.FileEntry entry) {
|
||||
return FileIconManager.getFileIcon(entry, false);
|
||||
return new PrettyImageComp(new SimpleStringProperty(FileIconManager.getFileIcon(entry, false)), 22, 22);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ lime | include.xml | file_type_lime.svg
|
|||
lintstagedrc | .lintstagedrc, .lintstagedrc.json, .lintstagedrc.yaml, .lintstagedrc.yml, .lintstagedrc.mjs, .lintstagedrc.js, .lintstagedrc.cjs, lint-staged.config.mjs, lint-staged.config.js, lint-staged.config.cjs | file_type_lintstagedrc.svg
|
||||
liquid | liquid | file_type_liquid.svg
|
||||
livescript | ls | file_type_livescript.svg
|
||||
lnk | lnk | file_type_lnk.svg
|
||||
lnk | url, lnk | file_type_lnk.svg
|
||||
locale | <sub></sub> | file_type_locale.svg
|
||||
log | log, tlg | file_type_log.svg
|
||||
log | log, tlg, log | file_type_log.svg
|
||||
|
@ -604,7 +604,7 @@ sas | SAS | file_type_sas.svg
|
|||
sass | sass | file_type_sass.svg
|
||||
sbt | sbt | file_type_sbt.svg
|
||||
scala | scala | file_type_scala.svg
|
||||
script | vbscript | file_type_script.svg
|
||||
script | vbs, vbscript | file_type_script.svg
|
||||
scss | scssm, scss | file_type_scss.svg
|
||||
scilab | scilab | file_type_scilab.svg
|
||||
sdlang | sdl | file_type_sdlang.svg
|
||||
|
|
3
dist/changelogs/0.5.31.md
vendored
Normal file
3
dist/changelogs/0.5.31.md
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
- Add file type icons to file browser
|
||||
- Add shift-select ability to select range of files to file browser
|
||||
- Fix some bugs
|
2
version
2
version
|
@ -1 +1 @@
|
|||
0.5.30
|
||||
0.5.31
|
Loading…
Reference in a new issue