Package org.fife.ui.autocomplete
Class CompletionXMLParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.fife.ui.autocomplete.CompletionXMLParser
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
Parser for an XML file describing a procedural language such as C. XML
files will be validated against the
CompletionXml.dtd
DTD
found in this package.- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassLoader
The completion provider to use when loading classes, such as customFunctionCompletion
s.private List
<Completion> The completions found after parsing the XML.private static ClassLoader
The class loader to use to load custom completion classes, such as the one defined byfuncCompletionType
.private String
private StringBuilder
private boolean
private boolean
private String
If specified in the XML, this class will be used instead ofFunctionCompletion
when appropriate.private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private String
private StringBuilder
private char
private String
private List
<ParameterizedCompletion.Parameter> private String
private char
private String
private CompletionProvider
The provider we're getting completions for.private String
private StringBuilder
private String
-
Constructor Summary
ConstructorsConstructorDescriptionCompletionXMLParser
(CompletionProvider provider) Constructor.CompletionXMLParser
(CompletionProvider provider, ClassLoader cl) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) Called when character data inside an element is found.private FunctionCompletion
private MarkupTagCompletion
private BasicCompletion
private VariableCompletion
void
endElement
(String uri, String localName, String qName) Called when an element is closed.void
Returns the completions found after parsing the XML.char
Returns the parameter end character specified.Returns the parameter end string specified.char
Returns the parameter start character specified.private static char
getSingleChar
(String str) void
reset
(CompletionProvider provider) Resets this parser to grab more completions.resolveEntity
(String publicID, String systemID) static void
Sets the class loader to use when loading custom classes to use for variousCompletion
types, such asFunctionCompletion
s, from XML.void
startElement
(String uri, String localName, String qName, Attributes attrs) Called when an element starts.void
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
completions
The completions found after parsing the XML. -
provider
The provider we're getting completions for. -
completionCL
The completion provider to use when loading classes, such as customFunctionCompletion
s. -
name
-
type
-
returnType
-
returnValDesc
-
desc
-
paramName
-
paramType
-
endParam
private boolean endParam -
paramDesc
-
params
-
definedIn
-
doingKeywords
private boolean doingKeywords -
inKeyword
private boolean inKeyword -
gettingReturnValDesc
private boolean gettingReturnValDesc -
gettingDesc
private boolean gettingDesc -
gettingParams
private boolean gettingParams -
inParam
private boolean inParam -
gettingParamDesc
private boolean gettingParamDesc -
inCompletionTypes
private boolean inCompletionTypes -
paramStartChar
private char paramStartChar -
paramEndChar
private char paramEndChar -
paramSeparator
-
funcCompletionType
If specified in the XML, this class will be used instead ofFunctionCompletion
when appropriate. This class should extendFunctionCompletion
, or stuff will break. -
defaultCompletionClassLoader
The class loader to use to load custom completion classes, such as the one defined byfuncCompletionType
. If this isnull
, then a default class loader is used. This field will usually benull
.
-
-
Constructor Details
-
CompletionXMLParser
Constructor.- Parameters:
provider
- The provider to get completions for.- See Also:
-
CompletionXMLParser
Constructor.- Parameters:
provider
- The provider to get completions for.cl
- The class loader to use, if necessary, when loading classes from the XML (customFunctionCompletion
s, for example). This may benull
if the default is to be used, or if the XML does not define specific classes for completion types.- See Also:
-
-
Method Details
-
characters
public void characters(char[] ch, int start, int length) Called when character data inside an element is found.- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
-
createFunctionCompletion
-
createOtherCompletion
-
createMarkupTagCompletion
-
createVariableCompletion
-
endElement
Called when an element is closed.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
-
error
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
getCompletions
Returns the completions found after parsing the XML.- Returns:
- The completions.
-
getParamEndChar
public char getParamEndChar()Returns the parameter end character specified.- Returns:
- The character, or 0 if none was specified.
-
getParamSeparator
Returns the parameter end string specified.- Returns:
- The string, or
null
if none was specified.
-
getParamStartChar
public char getParamStartChar()Returns the parameter start character specified.- Returns:
- The character, or 0 if none was specified.
-
getSingleChar
-
reset
Resets this parser to grab more completions.- Parameters:
provider
- The new provider to get completions for.
-
resolveEntity
- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
-
setDefaultCompletionClassLoader
Sets the class loader to use when loading custom classes to use for variousCompletion
types, such asFunctionCompletion
s, from XML.Users should very rarely have a need to use this method.
- Parameters:
cl
- The class loader to use. If this isnull
, then a default is used.
-
startElement
Called when an element starts.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
-
warning
- Specified by:
warning
in interfaceErrorHandler
- Overrides:
warning
in classDefaultHandler
- Throws:
SAXException
-