APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.editor.external

public Class ExternalEditor

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.ClosedWatchServiceException, .FileSystems, .FileVisitResult, .Files, .Path, .SimpleFileVisitor, .WatchKey, .WatchService, java.nio.file.attribute.BasicFileAttributes, java.util.Arrays, .Scanner, java.util.function.Consumer, java.util.stream.Collectors, .Stream

Wrapper for controlling an external editor.

Field Summary

Modifier and TypeField and Description
private Path
private final Consumer<String>
private final Runnable
private final Runnable
private final Consumer<String>
private final Runnable
private Path
private final boolean
private Thread
private WatchService

Constructor Summary

AccessConstructor and Description
pack-priv
ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler, Runnable suspendInteractiveInput, Runnable resumeInteractiveInput, boolean wait, Runnable promptForNewLineToEndWait)

Method Summary

Modifier and TypeMethod and Description
private void
public static void
edit(String[]
the command to launch (with parameters)
cmd
,
String
initial text in the editor buffer
initialText
,
Consumer<String>
handler for error messages
errorHandler
,
Consumer<String>
handler sent the buffer contents on save
saveHandler
,
Runnable
a callback to suspend caller (shell) input
suspendInteractiveInput
,
Runnable
a callback to resume caller input
resumeInteractiveInput
,
boolean
true, if editor process termination cannot be used to determine when done
wait
,
Runnable
a callback to prompt for newline if wait==true
promptForNewLineToEndWait
)

Launch an external editor.

private void
edit(String[] cmd, String initialText)

private void
launch(String[] cmd)

private void
private void
setupWatch(String initialText)

Creates a WatchService and registers the given directory

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dirback to summary
private Path dir
errorHandlerback to summary
private final Consumer<String> errorHandler
promptForNewLineToEndWaitback to summary
private final Runnable promptForNewLineToEndWait
resumeInteractiveInputback to summary
private final Runnable resumeInteractiveInput
saveHandlerback to summary
private final Consumer<String> saveHandler
suspendInteractiveInputback to summary
private final Runnable suspendInteractiveInput
tmpfileback to summary
private Path tmpfile
waitback to summary
private final boolean wait
watchedThreadback to summary
private Thread watchedThread
watcherback to summary
private WatchService watcher

Constructor Detail

ExternalEditorback to summary
pack-priv ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler, Runnable suspendInteractiveInput, Runnable resumeInteractiveInput, boolean wait, Runnable promptForNewLineToEndWait)

Method Detail

deleteDirectoryback to summary
private void deleteDirectory()
editback to summary
public static void edit(String[] cmd, String initialText, Consumer<String> errorHandler, Consumer<String> saveHandler, Runnable suspendInteractiveInput, Runnable resumeInteractiveInput, boolean wait, Runnable promptForNewLineToEndWait)

Launch an external editor.

Parameters
cmd:String[]

the command to launch (with parameters)

initialText:String

initial text in the editor buffer

errorHandler:Consumer<String>

handler for error messages

saveHandler:Consumer<String>

handler sent the buffer contents on save

suspendInteractiveInput:Runnable

a callback to suspend caller (shell) input

resumeInteractiveInput:Runnable

a callback to resume caller input

wait:boolean

true, if editor process termination cannot be used to determine when done

promptForNewLineToEndWait:Runnable

a callback to prompt for newline if wait==true

editback to summary
private void edit(String[] cmd, String initialText)
launchback to summary
private void launch(String[] cmd) throws IOException
saveFileback to summary
private void saveFile()
setupWatchback to summary
private void setupWatch(String initialText) throws IOException

Creates a WatchService and registers the given directory