Small browser fixes

This commit is contained in:
crschnick 2023-08-16 16:48:15 +00:00
parent 7f85b4b535
commit 378e9bff6f
2 changed files with 8 additions and 1 deletions

View file

@ -268,7 +268,7 @@ public class BrowserComp extends SimpleComp {
PlatformThread.sync(model.getBusy())));
tab.setGraphic(label);
new FancyTooltipAugment<>(new SimpleStringProperty(model.getName())).augment(label);
new FancyTooltipAugment<>(new SimpleStringProperty(model.getId() != null ? model.getId().toString() : null)).augment(label);
GrowAugment.create(true, false).augment(new SimpleCompStructure<>(label));
tab.setContent(new OpenFileSystemComp(model).createSimple());
tab.setText(model.getName());

View file

@ -9,6 +9,7 @@ import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.impl.FileNames;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.ShellDialects;
import io.xpipe.core.source.DataStoreId;
import io.xpipe.core.store.*;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
@ -39,12 +40,14 @@ public final class OpenFileSystemModel {
private final Property<ModalOverlayComp.OverlayContent> overlay = new SimpleObjectProperty<>();
private final BooleanProperty inOverview = new SimpleBooleanProperty();
private final String name;
private final DataStoreId id;
private boolean local;
public OpenFileSystemModel(String name, BrowserModel browserModel, FileSystemStore store) {
this.browserModel = browserModel;
this.store = store;
this.name = name != null ? name : DataStorage.get().getStoreEntry(store).getName();
this.id = name != null ? null : DataStorage.get().getId(DataStorage.get().getStoreEntry(store));
this.inOverview.bind(Bindings.createBooleanBinding(
() -> {
return currentPath.get() == null;
@ -124,6 +127,10 @@ public final class OpenFileSystemModel {
return Optional.empty();
}
if (fileSystem == null) {
return Optional.empty();
}
// Fix common issues with paths
var adjustedPath = FileSystemHelper.adjustPath(this, path);
if (!Objects.equals(path, adjustedPath)) {