public abstract class CaretAwareJavaSourceTaskFactory extends JavaSourceTaskFactory
JavaSourceTaskFactorySupport that registers tasks to all files that are
opened in the editor and are visible. This factory also listens on the caret on
opened and visible JTextComponents and reschedules the tasks as necessary.
The tasks may access current caret position using getLastPosition(org.openide.filesystems.FileObject) method.| Constructor and Description |
|---|
CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority)
Construct the CaretAwareJavaSourceTaskFactory with given
JavaSource.Phase and JavaSource.Priority. |
CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority,
String... supportedMimeTypes)
Construct the CaretAwareJavaSourceTaskFactory with given
JavaSource.Phase and JavaSource.Priority. |
CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority,
TaskIndexingMode taskIndexingMode,
String... supportedMimeTypes)
Construct the CaretAwareJavaSourceTaskFactory.
|
| Modifier and Type | Method and Description |
|---|---|
List<FileObject> |
getFileObjects()
Specifies on which files should be registered tasks created by this factory.
|
static int |
getLastPosition(FileObject file)
Returns current caret position in current
JTextComponent for a given file. |
createTask, fileObjectsChanged, reschedulepublic CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase, 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)public CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase, JavaSource.Priority priority, String... supportedMimeTypes)
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)supportedMimeTypes - a list of mime types on which the tasks created by this factory should be runpublic CaretAwareJavaSourceTaskFactory(@NonNull JavaSource.Phase phase, @NonNull JavaSource.Priority priority, @NonNull TaskIndexingMode taskIndexingMode, @NonNull String... supportedMimeTypes)
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.supportedMimeTypes - a list of mime types on which the tasks created by this factory should be run,
empty array falls back to default text/x-java.public List<FileObject> getFileObjects()
JavaSourceTaskFactoryJavaSource's corresponding to FileObjects 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
ChangeListeners.getFileObjects in class JavaSourceTaskFactoryFileObject on which tasks from this factory should be
registered.JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject),
#addChangeListener,
EditorAwareJavaSourceTaskFactory,
CaretAwareJavaSourceTaskFactorypublic static int getLastPosition(FileObject file)
JTextComponent for a given file.file - file from which the position should be foundJTextComponent for a given file.Built on May 16 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.