private CachingFileManager(final CachingArchiveProvider provider, final ClassPath cp, final JavaFileFilterImplementation filter, boolean allowOutput, boolean cacheFile, boolean ignoreExcludes) { assert provider != null; assert cp != null; this.provider = provider; this.cp = cp; if (CacheClassPath.KEEP_JARS) { cp.addPropertyChangeListener(WeakListeners.propertyChange(this, cp)); } this.filter = filter; this.allowOutput = allowOutput; this.cacheFile = cacheFile; this.ignoreExcludes = ignoreExcludes; }
public void run(CompilationController controller) throws Exception { ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); PropertyChangeListener wcl = WeakListeners.propertyChange(PaletteMap.this, cp); cp.addPropertyChangeListener(wcl); } }
public void run(CompilationController cc) throws Exception { ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); PropertyChangeListener wcl = WeakListeners.propertyChange(MidpJavaSupport.this, cp); cp.addPropertyChangeListener(wcl); } };
private void initListeners() { // listen to any change on source path classpath: sourcePath.addPropertyChangeListener(WeakListeners.propertyChange(ModelUnit.this, sourcePath)); // listen to any change on compilation classpath: compilePath.addPropertyChangeListener(WeakListeners.propertyChange(ModelUnit.this, compilePath)); // The time-consuming listener registration is moved to a background thread since it can block project's // actions also in case of non-JSF project which is pain. It can miss initial JSF configuration changes. RP.submit(new Runnable() { @Override public void run() { // listen to any relevant configuration file change: long start = System.currentTimeMillis(); Project project = projectRef.get(); if (project != null) { project.getProjectDirectory().addRecursiveListener(FileUtil.weakFileChangeListener(ModelUnit.this, project.getProjectDirectory())); } LOGGER.log(Level.FINE, "JSF''s ModelUnit ResursiveListener registration took {0}ms.", new Object[]{(System.currentTimeMillis() - start)}); } }); }
@SuppressWarnings("LeakingThisInConstructor") private AptSourcePath( @NonNull final ClassPath delegate, @NonNull final Function<List<ClassPath.Entry>,List<PathResourceImplementation>> fnc) { assert delegate != null; this.delegate = delegate; this.fnc = fnc; this.pcSupport = new PropertyChangeSupport(this); delegate.addPropertyChangeListener(WeakListeners.propertyChange(this, delegate)); }
@SuppressWarnings("LeakingThisInConstructor") public FR (final ClassPath.Entry entry) { assert entry != null; this.support = new PropertyChangeSupport(this); this.entry = entry; this.classPath = entry.getDefiningClassPath(); this.classPath.addPropertyChangeListener(WeakListeners.propertyChange(this, classPath)); this.cache = new URL[] {entry.getURL()}; }
ClassIndex( final @NonNull ClassPath bootPath, final @NonNull ClassPath classPath, final @NonNull ClassPath sourcePath, final boolean supportsChanges ) { assert bootPath != null; assert classPath != null; assert sourcePath != null; this.bootPath = bootPath; this.classPath = classPath; this.sourcePath = sourcePath; this.oldBoot = new HashSet<URL>(); this.oldCompile = new HashSet<URL>(); this.oldSources = new HashSet<URL>(); this.depsIndeces = new HashSet<ClassIndexImpl>(); this.sourceIndeces = new HashSet<ClassIndexImpl>(); if (supportsChanges) { this.bootPath.addPropertyChangeListener(WeakListeners.propertyChange(spiListener, this.bootPath)); this.classPath.addPropertyChangeListener(WeakListeners.propertyChange(spiListener, this.classPath)); this.sourcePath.addPropertyChangeListener(WeakListeners.propertyChange(spiListener, this.sourcePath)); } reset (true, true); }
/** Creates a new instance of CacheClassPath */ @SuppressWarnings("LeakingThisInConstructor") private CacheClassPath (ClassPath cp, boolean translate, boolean scan) { this.listeners = new PropertyChangeSupport (this); this.cp = cp; this.translate = translate; this.scan = scan; if (!scan) { this.cp.addPropertyChangeListener (WeakListeners.propertyChange(this,cp)); final ClassIndexManager cim = ClassIndexManager.getDefault(); cim.addClassIndexManagerListener(WeakListeners.create(ClassIndexManagerListener.class, this, cim)); } }
private static void listenOnProcessorPath( @NullAllowed final ClassPath cp, @NonNull final APTUtils target) { if (cp != null) { cp.addPropertyChangeListener(WeakListeners.propertyChange(target, cp)); cp.getRoots();//so that the ClassPath starts listening on the filesystem } }
compileCP.addPropertyChangeListener(listener); projectListenerCache.put(webModule, listener); projectVersionCache.put(webModule, get(webModule, true));
if (cp != null) { cp.removePropertyChangeListener(myClassPathListener); cp.addPropertyChangeListener(myClassPathListener);
@Override public void run() { WebModule webModule = getWebModule(getDataObject().getPrimaryFile()); if (webModule != null) { FileObject wmRoot = webModule.getDocumentBase(); // register class path listener ClassPath cp = ClassPath.getClassPath(wmRoot, ClassPath.EXECUTE); if (cp != null) { cp.addPropertyChangeListener(WeakListeners.propertyChange(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { // the classpath was changed, need to reparsed restartParserTask(); } }, cp)); } } }
private void registerChangeListeners() { compile.addPropertyChangeListener(new PropertyChangeListener() {
private SourceLevelQuery.Result listenenOnProjectMetadata() { synchronized (listenersInitLock) { if (slRes == null) { assert classPath == null; final JavaPlatformManager jpm = JavaPlatformManager.getDefault(); jpm.addPropertyChangeListener(WeakListeners.propertyChange(this, jpm)); slRes = SourceLevelQuery.getSourceLevel2(antProjectHelper.getProjectDirectory()); slRes.addChangeListener(this); final File baseFolder = FileUtil.toFile(antProjectHelper.getProjectDirectory()); if (baseFolder != null) { final ClassPath cp = ClassPathFactory.createClassPath(ProjectClassPathSupport.createPropertyBasedClassPathImplementation( baseFolder, evaluator, classPathProperties.toArray(new String[classPathProperties.size()]))); cp.addPropertyChangeListener(this); cp.getRoots(); classPath = cp; } } return slRes; } }
classPath.addPropertyChangeListener(classPathListener);
this.cachedCompileClassPath = CacheClassPath.forClassPath(this.compileClassPath,backgroundCompilation); if (!backgroundCompilation) { this.cachedBootClassPath.addPropertyChangeListener(WeakListeners.propertyChange(this.cpListener,this.cachedBootClassPath)); this.cachedCompileClassPath.addPropertyChangeListener(WeakListeners.propertyChange(this.cpListener,this.cachedCompileClassPath)); this.outputClassPath = CacheClassPath.forSourcePath (ClassPathFactory.createClassPath(noApt),backgroundCompilation); if (!backgroundCompilation) { this.cachedSrcClassPath.addPropertyChangeListener(WeakListeners.propertyChange(this.cpListener,this.cachedSrcClassPath));