站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

JavaSourceTaskFactory (Java Source) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.java.source 0.13.0 1

org.netbeans.api.java.source
Class JavaSourceTaskFactory

java.lang.Object
  extended by org.netbeans.api.java.source.JavaSourceTaskFactory
Direct Known Subclasses:
CaretAwareJavaSourceTaskFactory, EditorAwareJavaSourceTaskFactory, LookupBasedJavaSourceTaskFactory

public abstract class JavaSourceTaskFactory
extends Object

A factory for tasks that will be run in the 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 by listing its fully qualified name in file META-INF/services/org.netbeans.api.java.source.JavaSourceTaskFactory.

See Also:
EditorAwareJavaSourceTaskFactory, CaretAwareJavaSourceTaskFactory, LookupBasedJavaSourceTaskFactory

Constructor Summary
protected JavaSourceTaskFactory(JavaSource.Phase phase, JavaSource.Priority priority)
          Construct the JavaSourceTaskFactory with given JavaSource.Phase and JavaSource.Priority.
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSourceTaskFactory

protected JavaSourceTaskFactory(JavaSource.Phase phase,
                                JavaSource.Priority priority)
Construct the JavaSourceTaskFactory with given JavaSource.Phase and JavaSource.Priority.

Parameters:
phase - phase to use for tasks created by createTask(org.openide.filesystems.FileObject)
priority - priority to use for tasks created by createTask(org.openide.filesystems.FileObject)
Method Detail

createTask

protected abstract CancellableTask<CompilationInfo> createTask(FileObject file)
Create task for a given file. This task will be registered into the JavaSource parsing harness with a given priority and phase. Please note that this method should run as quickly as possible.

Parameters:
file - for which file the task should be created.
Returns:
created CancellableTask for a given file.

getFileObjects

protected abstract Collection<FileObject> getFileObjects()
Specifies on which files should be registered tasks created by this factory. On JavaSource's corresponding to FileObjects returned from this method will be registered tasks created by the createTask(org.openide.filesystems.FileObject) method of this factory. If this list changes, a change event should be fired to all registered ChangeListeners.

Returns:
list of FileObject on which tasks from this factory should be registered.
See Also:
createTask(org.openide.filesystems.FileObject), #addChangeListener, EditorAwareJavaSourceTaskFactory, CaretAwareJavaSourceTaskFactory

fileObjectsChanged

protected final void fileObjectsChanged()
Notify the infrastructure that the collection of fileobjects has been changed. The infrastructure calls getFileObjects() to get a new collection files.


reschedule

protected final void reschedule(FileObject file)
                         throws IllegalArgumentException
Re-run task created by this factory for given file. If the task has not yet been run, does nothing.

Parameters:
file - task created by this factory for this file is re-run.
Throws:
IllegalArgumentException

org.netbeans.modules.java.source 0.13.0 1

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.