--- a/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java +++ a/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java @@ -170,8 +170,7 @@ LOG.log(Level.WARNING, "Going to recompute root={0}, files in error={1}.", new Object[] {FileUtil.getFileDisplayName(root), ErrorsCache.getAllFilesInError(root.getURL())}); -// XXX: Todo Create API! - RepositoryUpdater.getDefault().addIndexingJob(root.getURL(), null, false, true, false, true, true); + IndexingManager.getDefault().refreshIndex(root.getURL(), null, true, true); } catch (IOException ex) { LOG.log(Level.FINE, null, ex); } --- a/parsing.api/apichanges.xml +++ a/parsing.api/apichanges.xml @@ -110,6 +110,21 @@ + + + Adding refreshIndex method into the IndexingManager allowing to specify if indexers should use modified content of editors + + + + + +

+ Adding refreshIndex method into the IndexingManager allowing to specify if indexers should use modified content of editors. +

+
+ + +
Adding Parser.cancel method with parameters describing the reason of cancel --- a/parsing.api/nbproject/project.properties +++ a/parsing.api/nbproject/project.properties @@ -2,4 +2,4 @@ javac.source=1.6 javadoc.apichanges=${basedir}/apichanges.xml javadoc.arch=${basedir}/arch.xml -spec.version.base=1.36.0 +spec.version.base=1.37.0 --- a/parsing.api/src/org/netbeans/modules/parsing/api/indexing/IndexingManager.java +++ a/parsing.api/src/org/netbeans/modules/parsing/api/indexing/IndexingManager.java @@ -47,6 +47,8 @@ import java.util.Collection; import java.util.concurrent.Callable; import javax.swing.SwingUtilities; +import org.netbeans.api.annotations.common.NonNull; +import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.modules.parsing.impl.Utilities; import org.netbeans.modules.parsing.impl.event.EventSupport; import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; @@ -101,7 +103,7 @@ * be reindexed. */ public void refreshIndex(URL root, Collection files) { - refreshIndex(root, files, true); + refreshIndex(root, files, true, false); } /** @@ -131,7 +133,47 @@ * @since 1.16 */ public void refreshIndex(URL root, Collection files, boolean fullRescan) { - RepositoryUpdater.getDefault().addIndexingJob(root, files, false, false, false, fullRescan, true); + refreshIndex(root, files, fullRescan, false); + } + + /** + * Schedules new files for indexing. The set of files passed to this method + * will be scheduled for reindexing. That means that all the indexers appropriate + * for each file will have a chance to update their index. + * + *

If forceRefresh parameter is set to true + * no timestamp checks will be done for the files passed to this method. + * This means that even files that have not been changed since their last indexing + * will be reindexed again. On the other hand if forceRefresh is + * false the infrastructure will check timestamps and will reindex + * only files that have been changed since the last time they were indexed. + * + *

IMPORTANT: Please use this with extreme caution. Indexing is generally + * very expensive operation and the more files you ask to reindex the longer the + * job will take. + * + *

If checkEditor is true the indexers will use unsaved content + * of editor documents. Scan is using the file content rather than editor content, + * the editor content is needed only in special cases like error badge recovery. + * Simpler version {@link IndexingManager#refreshIndex(java.net.URL, java.util.Collection, boolean)} + * should be preferred. + * + * @param root The common parent folder of the files that should be reindexed. + * @param filesOrFolders The files to reindex. Can be null or an empty + * collection in which case all files under the root will + * be reindexed. + * @param fullRescan If true no timestamps check will be done + * on the files passed in and they all will be reindexed. If + * false only changed files will be reindexed. + * @param checkEditor when true the indexers will use content of modified editor + * documents rather than saved files. For scans the indexers should prefer + * content of files. the document content may be useful for example for error badge + * recovery. + * + * @since 1.37 + */ + public void refreshIndex(@NonNull URL root, @NullAllowed Collection files, boolean fullRescan, boolean checkEditor) { + RepositoryUpdater.getDefault().addIndexingJob(root, files, false, checkEditor, false, fullRescan, true); } /**