public final class ParserManager extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canBeParsed(String mimeType)
Determines if the MIME type can be parsed.
|
static boolean |
isParsing()
Determines if the current execution is already called from the parsing
system.
|
static void |
parse(Collection<Source> sources,
UserTask userTask)
Priority request for parsing of list of
Source s. |
static void |
parse(String mimeType,
UserTask userTask)
Runs given task in parser thread.
|
static Future<Void> |
parseWhenScanFinished(Collection<Source> sources,
UserTask userTask)
Performs the given task when the scan finished.
|
static Future<Void> |
parseWhenScanFinished(String mimeType,
UserTask userTask)
Performs the given task when the scan finished.
|
public static void parse(@NonNull Collection<Source> sources, @NonNull UserTask userTask) throws ParseException
Source
s. Implementator
of this task have full control over the process of parsing of embedded
languages. You can scan tree of embedded sources and start parsing for
all of them, or for some of them only.
This method is blocking. It means that only one parsing request per time
is allowed. But you can call another parsing request
from your Task. This secondary parsing request is called
immediately in the same thread (current thread).
This method is typically called as a response on some user request - during code completion for example.
sources
- A list of sources that should be parsed.userTask
- A task that will be started when parsing is done.ParseException
- encapsulating the user exception@NonNull public static Future<Void> parseWhenScanFinished(@NonNull Collection<Source> sources, @NonNull UserTask userTask) throws ParseException
UserTask
running this method waits until it's completed.sources
- A list of sources that should be parsed.userTask
- A task started when parsing is done.Future
which can be used to find out the state of the task Future.isDone()
or Future.isCancelled()
.
The caller may cancel the task using Future.cancel(boolean)
or wait until the task is performed Future.get()
.ParseException
- encapsulating the user exception.public static void parse(@NonNull String mimeType, @NonNull UserTask userTask) throws ParseException
mimetype
- specifying the parseruserTask
- a user taskParseException
- encapsulating the user exception@NonNull public static Future<Void> parseWhenScanFinished(@NonNull String mimeType, @NonNull UserTask userTask) throws ParseException
UserTask
running this method waits until it's completed.mimetype
- A mimetype specifying the parser.userTask
- A task started when parsing is done.Future
which can be used to find out the state of the task Future.isDone()
or Future.isCancelled()
.
The caller may cancel the task using Future.cancel(boolean)
or wait until the task is performed Future.get()
.ParseException
- encapsulating the user exception.public static boolean isParsing()
public static boolean canBeParsed(String mimeType)
#getAllMimeTypes
.
Then accepts only text/* MIME type and specific hardcoded application/ MIME types.mimeType
- the MIME type to check