public void run()

in duplicates/ide/impl/src/org/netbeans/modules/jackpot30/impl/duplicates/indexing/DeferredCustomIndexer.java [341:420]


        public void run(CompilationInfo parameter) throws Exception {
            cancel.set(false);

            for (Iterator<Entry<String, TODO>> it = todo.entrySet().iterator(); it.hasNext();) {
                if (cancel.get()) return;

                final Entry<String, TODO> e = it.next();

                if (DISABLED_INDEXERS.contains(e.getKey())) {
                    it.remove();
                    continue;
                }
                
                if (currentFactory != e.getValue().factory) {
                    if (progressForCurrentFactory != null) {
                        progressForCurrentFactory.finish();
                    }

                    currentFactory = e.getValue().factory;
                    progressForCurrentFactory = ProgressHandleFactory.createSystemHandle("Background indexing for: " + currentFactory.getIndexerName(), new Cancellable() {
                        public boolean cancel() {
                            assert SwingUtilities.isEventDispatchThread();

                            JButton disableInThisSession = new JButton("Disable in This Session");
                            JButton disablePermanently = new JButton("Disable Permanently");

                            disablePermanently.setEnabled(false);

                            Object[] buttons = new Object[]{disableInThisSession, disablePermanently, DialogDescriptor.CANCEL_OPTION};
                            DialogDescriptor dd = new DialogDescriptor("Disable background indexing for: " + e.getValue().factory.getIndexerName(), "Disable Background Indexing", true, buttons, disableInThisSession, DialogDescriptor.DEFAULT_ALIGN, null, null);

                            dd.setClosingOptions(buttons);

                            Object result = DialogDisplayer.getDefault().notify(dd);

                            if (result == disableInThisSession) {
                                DISABLED_INDEXERS.add(e.getKey());
                                return true;
                            } else if (result == disablePermanently) {
                                throw new UnsupportedOperationException();
                            } else {
                                return false;
                            }
                        }
                    });

                    progressForCurrentFactory.start();
                }

                for (Iterator<URL> factIt = e.getValue().roots.iterator(); factIt.hasNext();) {
                    if (cancel.get()) return;

                    URL root = factIt.next();
                    FileObject rootFO = URLMapper.findFileObject(root);

                    if (rootFO == null) {
                        //already deleted
                        it.remove();
                        continue;
                    }

                    if (updateRoot(e.getValue().factory, root, rootFO, cancel)) {
                        factIt.remove();
                    } else {
                        if (!cancel.get()) {
                            LOG.log(Level.WARNING, "indexer: {0} did not update all files even if the process was not cancelled", currentFactory.getIndexerName());
                        }
                    }
                }

                if (e.getValue().roots.isEmpty())
                    it.remove();

                progressForCurrentFactory.finish();
                progressForCurrentFactory = null;
                currentFactory = null;
            }

            if (todo.isEmpty()) RunAsNeededFactory.fileChanged();
        }