org.netbeans.modules.java.source 0.104.0 23

org.netbeans.api.java.source.support
Class SelectionAwareJavaSourceTaskFactory

java.lang.Object
  extended by org.netbeans.api.java.source.JavaSourceTaskFactory
      extended by org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory

public abstract class SelectionAwareJavaSourceTaskFactory
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 selection in opened and visible JTextComponents and reschedules the tasks as necessary. The tasks may access current selection span using getLastSelection(org.openide.filesystems.FileObject) method.

Since:
0.15

Constructor Summary
SelectionAwareJavaSourceTaskFactory(JavaSource.Phase phase, JavaSource.Priority priority)
          Construct the SelectionAwareJavaSourceTaskFactory with given JavaSource.Phase and JavaSource.Priority.
SelectionAwareJavaSourceTaskFactory(JavaSource.Phase phase, JavaSource.Priority priority, String... supportedMimeTypes)
          Construct the SelectionAwareJavaSourceTaskFactory with given JavaSource.Phase and JavaSource.Priority.
SelectionAwareJavaSourceTaskFactory(JavaSource.Phase phase, JavaSource.Priority priority, TaskIndexingMode taskIndexingMode, String... supportedMimeTypes)
          Construct the SelectionAwareJavaSourceTaskFactory with given JavaSource.Phase and JavaSource.Priority.
 
Method Summary
 List<FileObject> getFileObjects()
          Specifies on which files should be registered tasks created by this factory.
static int[] getLastSelection(FileObject file)
          Returns current selection span in current JTextComponent for a given file.
 
Methods inherited from class org.netbeans.api.java.source.JavaSourceTaskFactory
createTask, fileObjectsChanged, reschedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionAwareJavaSourceTaskFactory

public SelectionAwareJavaSourceTaskFactory(JavaSource.Phase phase,
                                           JavaSource.Priority priority)
Construct the SelectionAwareJavaSourceTaskFactory 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)

SelectionAwareJavaSourceTaskFactory

public SelectionAwareJavaSourceTaskFactory(JavaSource.Phase phase,
                                           JavaSource.Priority priority,
                                           String... supportedMimeTypes)
Construct the SelectionAwareJavaSourceTaskFactory 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)
supportedMimeTypes - a list of mime types on which the tasks created by this factory should be run
Since:
0.22

SelectionAwareJavaSourceTaskFactory

public SelectionAwareJavaSourceTaskFactory(@NonNull
                                           JavaSource.Phase phase,
                                           @NonNull
                                           JavaSource.Priority priority,
                                           @NonNull
                                           TaskIndexingMode taskIndexingMode,
                                           @NonNull
                                           String... supportedMimeTypes)
Construct the SelectionAwareJavaSourceTaskFactory 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)
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.
Since:
0.94
Method Detail

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 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.

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

getLastSelection

public static int[] getLastSelection(FileObject file)
Returns current selection span in current JTextComponent for a given file.

Parameters:
file - file from which the position should be found
Returns:
selection span in the current JTextComponent for a given file. null if no selection available so far.

org.netbeans.modules.java.source 0.104.0 23

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.