public abstract class SideKickParser
extends java.lang.Object
Plugins can provide SideKick parsers by defining entries in their
services.xml
files like so:
<SERVICE CLASS="sidekick.SideKickParser" NAME="name"> new MyParser(); </SERVICE>See
org.gjt.sp.jedit.ServiceManager
for details.
Note that each SideKickParser
subclass has a name which is
used to key a property sidekick.parser.name.label
.
To associate a parser with some edit modes, define properties like this:
mode.scheme.sidekick.parser=lisp mode.lisp.sidekick.parser=lisp
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
static java.lang.String |
SERVICE |
Constructor and Description |
---|
SideKickParser(java.lang.String serviceName)
The parser constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
activate(org.gjt.sp.jedit.EditPane editPane)
This method is called when a buffer using this parser is selected
in the specified view.
|
void |
activate(org.gjt.sp.jedit.View view)
Deprecated.
Use the form taking an
EditPane instead. |
boolean |
canCompleteAnywhere()
Returns if completion popups should be shown after any period of
inactivity.
|
boolean |
canHandleBackspace()
Returns true if the parser can handle
the backspace key being typed when
the completion popup is open,
else false if not.
|
SideKickCompletion |
complete(org.gjt.sp.jedit.EditPane editPane,
int caret)
Returns completions suitable for insertion at the specified position.
|
void |
deactivate(org.gjt.sp.jedit.EditPane editPane)
This method is called when a buffer using this parser is no longer
selected in the specified view.
|
void |
deactivate(org.gjt.sp.jedit.View view)
Deprecated.
Use the form taking an
EditPane instead. |
SideKickCompletionPopup |
getCompletionPopup(org.gjt.sp.jedit.View view,
int caretPosition,
SideKickCompletion complete,
boolean active) |
java.lang.String |
getInstantCompletionTriggers()
Returns a list of characters which trigger completion immediately.
|
java.lang.String |
getName()
Returns the parser's name.
|
javax.swing.JPanel |
getPanel()
Returns a parser-specific panel that will be shown in the SideKick dockable
window just below the SideKick toolbar.
|
java.lang.String |
getParseTriggers()
Returns a list of characters which trigger a buffer re-parse.
|
abstract SideKickParsedData |
parse(org.gjt.sp.jedit.Buffer buffer,
errorlist.DefaultErrorSource errorSource)
Parses the given text and returns a tree model.
|
void |
stop()
Stops the parse request currently in progress.
|
boolean |
supportsCompletion()
Returns if the parser supports code completion.
|
public static final java.lang.String SERVICE
protected java.lang.String name
public SideKickParser(java.lang.String serviceName)
public final java.lang.String getName()
public void stop()
public void activate(org.gjt.sp.jedit.View view)
EditPane
instead.view
- The viewpublic void deactivate(org.gjt.sp.jedit.View view)
EditPane
instead.view
- The viewpublic void activate(org.gjt.sp.jedit.EditPane editPane)
editPane
- The edit panepublic void deactivate(org.gjt.sp.jedit.EditPane editPane)
editPane
- The edit panepublic abstract SideKickParsedData parse(org.gjt.sp.jedit.Buffer buffer, errorlist.DefaultErrorSource errorSource)
buffer
- The buffer to parse.errorSource
- An error source to add errors to.SideKickParsedData
class.public boolean supportsCompletion()
public boolean canHandleBackspace()
Returns true if the parser can handle the backspace key being typed when the completion popup is open, else false if not.
If false, the completion popup is closed when backspace is typed.
If true, the
SideKickCompletion.handleKeystroke(int, char)
method must be overidden to handle receiving
the backspace character, '\b', as a value
for the keyChar parameter.
Returns false by default.
public boolean canCompleteAnywhere()
public java.lang.String getInstantCompletionTriggers()
public java.lang.String getParseTriggers()
public SideKickCompletion complete(org.gjt.sp.jedit.EditPane editPane, int caret)
editPane
- The edit pane involved.caret
- The caret position.public SideKickCompletionPopup getCompletionPopup(org.gjt.sp.jedit.View view, int caretPosition, SideKickCompletion complete, boolean active)
public javax.swing.JPanel getPanel()