Class EditServer
- All Implemented Interfaces:
Runnable
The edit server protocol is very simple.
jEditSettingsDir/server
is an ASCII file containing two lines, the first being the port number,
the second being the authorization key.
You connect to that port on the local machine, sending the authorization key as four bytes in network byte order, followed by the length of the BeanShell script as two bytes in network byte order, followed by the script in UTF8 encoding. After the socked is closed, the BeanShell script will be executed by jEdit.
The snippet is executed in the AWT thread. None of the usual BeanShell variables (view, buffer, textArea, editPane) are set so the script has to figure things out by itself.
In most cases, the script will call the static
handleClient(boolean,String,String[]) method, but of course more
complicated stuff can be done too.
- Version:
- $Id: EditServer.java 23981 2015-08-10 14:56:24Z daleanson $
- Author:
- Slava Pestov
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionintgetPort()static BufferhandleClient(boolean restore, boolean newView, boolean newPlainView, String parent, String[] args) static voidhandleClient(boolean restore, String parent, String[] args) voidrun()Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Method Details
-
run
-
handleClient
-
handleClient
public static Buffer handleClient(boolean restore, boolean newView, boolean newPlainView, String parent, String[] args) - Parameters:
restore- Ignored unless no views are opennewView- Open a new view?newPlainView- Open a new plain view?parent- The client's parent directoryargs- A list of files. Null entries are ignored, for convenience- Returns:
- the buffer
- Since:
- jEdit 4.2pre1
-
getPort
public int getPort()
-