mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-25 18:05:39 +00:00
Fix null pointer in case no external program to launch has been set
This commit is contained in:
@@ -35,6 +35,12 @@ public class EditFileAction implements LeafAction {
|
||||
return entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
var e = AppPrefs.get().externalEditor().getValue();
|
||||
return e != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return "Edit with " + AppPrefs.get().externalEditor().getValue().toTranslatedString();
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.xpipe.ext.base.browser;
|
||||
import io.xpipe.app.browser.BrowserEntry;
|
||||
import io.xpipe.app.browser.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.TerminalHelper;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
import javafx.scene.Node;
|
||||
@@ -53,6 +54,12 @@ public class OpenTerminalAction implements LeafAction {
|
||||
return entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.DIRECTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
var t = AppPrefs.get().terminalType().getValue();
|
||||
return t != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyCombination getShortcut() {
|
||||
return new KeyCodeCombination(KeyCode.T, KeyCombination.SHORTCUT_DOWN);
|
||||
|
||||
Reference in New Issue
Block a user