当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
CaretAwareJavaSourceTaskFactory (Java Source) - NetBeans API Javadoc (Current Development Version)
org.netbeans.api.java.source.support
Class CaretAwareJavaSourceTaskFactory
java.lang.Object
org.netbeans.api.java.source.JavaSourceTaskFactory
org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory
public abstract class CaretAwareJavaSourceTaskFactory
- extends JavaSourceTaskFactory
A 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CaretAwareJavaSourceTaskFactory
public CaretAwareJavaSourceTaskFactory(JavaSource.Phase phase,
JavaSource.Priority priority)
- Construct the CaretAwareJavaSourceTaskFactory with given
JavaSource.Phase
and JavaSource.Priority
.
- Parameters:
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)
getFileObjects
public List<FileObject> getFileObjects()
- Description copied from class:
JavaSourceTaskFactory
- Specifies on which files should be registered tasks created by this factory.
On
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.
- Specified by:
getFileObjects
in class JavaSourceTaskFactory
- Returns:
- list of
FileObject
on which tasks from this factory should be
registered. - See Also:
JavaSourceTaskFactory.createTask(org.openide.filesystems.FileObject)
,
#addChangeListener
,
EditorAwareJavaSourceTaskFactory
,
CaretAwareJavaSourceTaskFactory
getLastPosition
public static int getLastPosition(FileObject file)
- Returns current caret position in current
JTextComponent
for a given file.
- Parameters:
file
- file from which the position should be found
- Returns:
- caret position in the current
JTextComponent
for a given file.