Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 67270
Collapse All | Expand All

(-)java.source/src/org/netbeans/modules/java/source/classpath/GlobalSourcePath.java (-11 / +28 lines)
 Lines 56-61    Link Here 
56
import java.util.Set;
56
import java.util.Set;
57
import java.util.TooManyListenersException;
57
import java.util.TooManyListenersException;
58
import java.util.concurrent.CopyOnWriteArrayList;
58
import java.util.concurrent.CopyOnWriteArrayList;
59
import java.util.logging.Level;
60
import java.util.logging.Logger;
59
import javax.swing.event.ChangeEvent;
61
import javax.swing.event.ChangeEvent;
60
import javax.swing.event.ChangeListener;
62
import javax.swing.event.ChangeListener;
61
import org.netbeans.api.java.classpath.ClassPath;
63
import org.netbeans.api.java.classpath.ClassPath;
 Lines 63-68    Link Here 
63
import org.netbeans.api.java.classpath.GlobalPathRegistryEvent;
65
import org.netbeans.api.java.classpath.GlobalPathRegistryEvent;
64
import org.netbeans.api.java.classpath.GlobalPathRegistryListener;
66
import org.netbeans.api.java.classpath.GlobalPathRegistryListener;
65
import org.netbeans.api.java.queries.SourceForBinaryQuery;
67
import org.netbeans.api.java.queries.SourceForBinaryQuery;
68
import org.netbeans.api.project.Project;
69
import org.netbeans.api.project.ui.OpenProjects;
66
import org.netbeans.modules.java.source.usages.ClassIndexManager;
70
import org.netbeans.modules.java.source.usages.ClassIndexManager;
67
import org.netbeans.spi.java.classpath.ClassPathImplementation;
71
import org.netbeans.spi.java.classpath.ClassPathImplementation;
68
import org.netbeans.spi.java.classpath.PathResourceImplementation;
72
import org.netbeans.spi.java.classpath.PathResourceImplementation;
 Lines 78-91    Link Here 
78
 *
82
 *
79
 * @author Tomas Zezula
83
 * @author Tomas Zezula
80
 */
84
 */
81
public class GlobalSourcePath {
85
public class GlobalSourcePath implements Runnable {
82
    
86
    
83
    public static final String PROP_INCLUDES = ClassPath.PROP_INCLUDES;
87
    public static final String PROP_INCLUDES = ClassPath.PROP_INCLUDES;
84
88
85
    private static final RequestProcessor firer = new RequestProcessor ();
89
    private static final RequestProcessor firer = new RequestProcessor("GlobalSourcePath"); // NOI18N
86
    
90
    
87
    private static GlobalSourcePath instance;
91
    private static GlobalSourcePath instance;
88
    
92
93
    private final RequestProcessor.Task firerTask;
89
    private final GlobalPathRegistry gpr;
94
    private final GlobalPathRegistry gpr;
90
    private List<? extends PathResourceImplementation> resources;
95
    private List<? extends PathResourceImplementation> resources;
91
    private List<? extends PathResourceImplementation> unknownResources;
96
    private List<? extends PathResourceImplementation> unknownResources;
 Lines 105-110    Link Here 
105
    private final Listener listener;
110
    private final Listener listener;
106
    
111
    
107
    private volatile PropertyChangeListener excludesListener;
112
    private volatile PropertyChangeListener excludesListener;
113
    private static Logger LOG = Logger.getLogger(GlobalSourcePath.class.getName());
108
114
109
    /** Creates a new instance of GlobalSourcePath */
115
    /** Creates a new instance of GlobalSourcePath */
110
    private GlobalSourcePath() {
116
    private GlobalSourcePath() {
 Lines 112-117    Link Here 
112
        this.sourcePath = new SourcePathImplementation ();
118
        this.sourcePath = new SourcePathImplementation ();
113
        this.binaryPath = new BinaryPathImplementation ();
119
        this.binaryPath = new BinaryPathImplementation ();
114
        this.unknownSourcePath = new UnknownSourcePathImplementation ();
120
        this.unknownSourcePath = new UnknownSourcePathImplementation ();
121
        this.firerTask = firer.create(this);
115
        this.timeStamp = -1;
122
        this.timeStamp = -1;
116
        this.gpr = GlobalPathRegistry.getDefault();
123
        this.gpr = GlobalPathRegistry.getDefault();
117
        this.activeCps = Collections.emptySet();
124
        this.activeCps = Collections.emptySet();
 Lines 206-219    Link Here 
206
            this.unknownResources = null;
213
            this.unknownResources = null;
207
            this.timeStamp++;
214
            this.timeStamp++;
208
        }
215
        }
209
216
        LOG.log(Level.FINE, "resetCacheAndFire"); // NOI18N
210
        firer.post(new Runnable () {
217
        firerTask.schedule(0);
211
            public void run() {
218
    }
212
                sourcePath.firePropertyChange ();
219
    
213
                binaryPath.firePropertyChange ();
220
    public void run() {
214
                unknownSourcePath.firePropertyChange();
221
        assert firer.isRequestProcessorThread();
215
            }
222
        long now = System.currentTimeMillis();
216
        });        
223
        try {
224
            LOG.log(Level.FINE, "resetCacheAndFire waiting for projects"); // NOI18N
225
            Project[] list = OpenProjects.getDefault().openProjects().get();
226
            LOG.log(Level.FINE, "resetCacheAndFire blocked for {0} ms", System.currentTimeMillis() - now); // NOI18N
227
        } catch (Exception ex) {
228
            LOG.log(Level.FINE, "resetCacheAndFire timeout", ex); // NOI18N
229
        }
230
        sourcePath.firePropertyChange ();
231
        binaryPath.firePropertyChange ();
232
        unknownSourcePath.firePropertyChange();
233
        LOG.log(Level.FINE, "resetCacheAndFire, firing done"); // NOI18N
217
    }
234
    }
218
    
235
    
219
    private Result createResources (final Request r) {
236
    private Result createResources (final Request r) {

Return to bug 67270
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo