mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-27 02:45:36 +00:00
Rework pro context menu entries
This commit is contained in:
@@ -59,7 +59,8 @@ public interface LeafAction extends BrowserAction {
|
||||
}
|
||||
|
||||
default MenuItem toItem(OpenFileSystemModel model, List<BrowserEntry> selected, UnaryOperator<String> nameFunc) {
|
||||
var mi = new MenuItem(nameFunc.apply(getName(model, selected)));
|
||||
var name = nameFunc.apply(getName(model, selected));
|
||||
var mi = new MenuItem(name);
|
||||
mi.setOnAction(event -> {
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BooleanScope.execute(model.getBusy(), () -> {
|
||||
@@ -80,7 +81,7 @@ public interface LeafAction extends BrowserAction {
|
||||
|
||||
if (getProFeatureId() != null && !LicenseProvider.get().getFeature(getProFeatureId()).isSupported()) {
|
||||
mi.setDisable(true);
|
||||
mi.setGraphic(new FontIcon("mdi2p-professional-hexagon"));
|
||||
mi.setText(mi.getText() + " (Pro)");
|
||||
}
|
||||
|
||||
return mi;
|
||||
|
||||
@@ -268,27 +268,28 @@ public abstract class StoreEntryComp extends SimpleComp {
|
||||
!LicenseProvider.get().getFeature(p.getKey().getProFeatureId()).isSupported();
|
||||
if (proRequired) {
|
||||
item.setDisable(true);
|
||||
item.setGraphic(new FontIcon("mdi2p-professional-hexagon"));
|
||||
item.textProperty().bind(Bindings.createStringBinding(() -> name.getValue() + " (Pro)",name));
|
||||
} else {
|
||||
item.textProperty().bind(name);
|
||||
}
|
||||
|
||||
Menu menu = actionProvider.canLinkTo() ? (Menu) item : null;
|
||||
item.setOnAction(event -> {
|
||||
if (menu != null && !event.getTarget().equals(menu)) {
|
||||
return;
|
||||
}
|
||||
item.setOnAction(event -> {
|
||||
if (menu != null && !event.getTarget().equals(menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu != null && menu.isDisable()) {
|
||||
return;
|
||||
}
|
||||
if (menu != null && menu.isDisable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
contextMenu.hide();
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
var action = actionProvider.createAction(
|
||||
wrapper.getEntry().ref());
|
||||
action.execute();
|
||||
});
|
||||
contextMenu.hide();
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
var action = actionProvider.createAction(
|
||||
wrapper.getEntry().ref());
|
||||
action.execute();
|
||||
});
|
||||
item.textProperty().bind(name);
|
||||
});
|
||||
if (actionProvider.activeType() == ActionProvider.DataStoreCallSite.ActiveType.ONLY_SHOW_IF_ENABLED) {
|
||||
item.visibleProperty().bind(p.getValue());
|
||||
} else if (actionProvider.activeType() == ActionProvider.DataStoreCallSite.ActiveType.ALWAYS_SHOW) {
|
||||
|
||||
Reference in New Issue
Block a user