public abstract class JavaSourceTaskFactory extends Object
JavaSource
Java parsing harness.
Please note that there is usually no need to implement this class directly,
as there are support classes for common JavaSourceTaskFactory
implementations.
This factory should be registered in the global lookup using ServiceProvider
.EditorAwareJavaSourceTaskFactory
,
CaretAwareJavaSourceTaskFactory
,
LookupBasedJavaSourceTaskFactory
Modifier | Constructor and Description |
---|---|
protected |
JavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority)
Construct the JavaSourceTaskFactory with given
JavaSource.Phase and JavaSource.Priority . |
protected |
JavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority,
TaskIndexingMode taskIndexingMode)
Construct the JavaSourceTaskFactory with given
JavaSource.Phase , JavaSource.Priority
and TaskIndexingMode . |
Modifier and Type | Method and Description |
---|---|
protected abstract CancellableTask<CompilationInfo> |
createTask(FileObject file)
Create task for a given file.
|
protected void |
fileObjectsChanged()
Notify the infrastructure that the collection of fileobjects has been changed.
|
protected abstract Collection<FileObject> |
getFileObjects()
Specifies on which files should be registered tasks created by this factory.
|
protected void |
reschedule(FileObject file)
Re-run task created by this factory for given file.
|
protected JavaSourceTaskFactory(@NonNull JavaSource.Phase phase, @NonNull JavaSource.Priority priority)
JavaSource.Phase
and JavaSource.Priority
.phase
- phase to use for tasks created by JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
priority
- priority to use for tasks created by JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
protected JavaSourceTaskFactory(@NonNull JavaSource.Phase phase, @NonNull JavaSource.Priority priority, @NonNull TaskIndexingMode taskIndexingMode)
JavaSource.Phase
, JavaSource.Priority
and TaskIndexingMode
.phase
- phase to use for tasks created by JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
priority
- priority to use for tasks created by JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
taskIndexingMode
- the awareness of indexing. For tasks which can run
during indexing use TaskIndexingMode.ALLOWED_DURING_SCAN
for tasks
which cannot run during indexing use TaskIndexingMode.DISALLOWED_DURING_SCAN
.@NonNull protected abstract CancellableTask<CompilationInfo> createTask(FileObject file)
JavaSource
parsing harness with a given priority
and phase
.
Please note that this method should run as quickly as possible.file
- for which file the task should be created.CancellableTask
for a given file.@NonNull protected abstract Collection<FileObject> getFileObjects()
JavaSource
's corresponding to FileObject
s returned from
this method will be registered tasks created by the JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
method
of this factory.
If this list changes, a change event should be fired to all registered
ChangeListener
s.FileObject
on which tasks from this factory should be
registered.JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
,
#addChangeListener
,
EditorAwareJavaSourceTaskFactory
,
CaretAwareJavaSourceTaskFactory
protected final void fileObjectsChanged()
JavaSourceTaskFactory.getFileObjects()
to get a new collection files.protected final void reschedule(FileObject file) throws IllegalArgumentException
file
- task created by this factory for this file is re-run.IllegalArgumentException