Java Code Examples for org.netbeans.modules.maven.api.NbMavenProject#addWatchedPath()

The following examples show how to use org.netbeans.modules.maven.api.NbMavenProject#addWatchedPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenPersistenceProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance of MavenPersistenceProvider
 */
public MavenPersistenceProvider(Project proj, Lookup lkp)
{
    NbMavenProject watcher = lkp.lookup(NbMavenProject.class);
    locProvider    = new PersistenceLocationProviderImpl(proj, watcher);
    scopeProvider  = new PersistenceScopeProviderImpl(locProvider, proj);
    scopesProvider = new PersistenceScopesProviderImpl(scopeProvider);
    
    propChangeSupport.addPropertyChangeListener(locProvider);
    propChangeSupport.addPropertyChangeListener(scopesProvider);
            
    //TODO add FileChangeListener on persistence.xml
    watcher.addWatchedPath(PersistenceLocationProviderImpl.DEF_PERSISTENCE);
    watcher.addWatchedPath(PersistenceLocationProviderImpl.ALT_PERSISTENCE);
    watcher.addPropertyChangeListener(WeakListeners.propertyChange(res, watcher));
}
 
Example 2
Source File: OtherRootNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    NbMavenProject watch = project.getLookup().lookup(NbMavenProject.class);
    watch.addPropertyChangeListener(this);
    watch.addWatchedPath(MAIN); //NOI18N
    watch.addWatchedPath(TEST); //NOI18N    
    checkFileObject(MAIN);
    checkFileObject(TEST);
}
 
Example 3
Source File: MavenSourcesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * consult the SourceGroup cache, return true if anything changed..
 */
private boolean checkSourceGroupCache(@NullAllowed File rootF, String name, String displayName, Map<String, SourceGroup> groups, NbMavenProject watcher) {
    FileObject root;
    if (rootF != null) {
        watcher.addWatchedPath(Utilities.toURI(rootF));
        root = FileUtil.toFileObject(rootF);
    } else {
        root = null;
    }
    SourceGroup group = groups.get(name);
    if ((root == null || root.isData()) && group != null) {
        groups.remove(name);
        return true;
    }
    if (root == null || root.isData()) {
        return false;
    }
    boolean changed = false;
    if (group == null) {
        group = GenericSources.group(proj, root, name, displayName, null, null);
        groups.put(name, group);
        changed = true;
    } else {
        if (!group.getRootFolder().equals(root)) {
            group = GenericSources.group(proj, root, name, displayName, null, null);
            groups.put(name, group);
            changed = true;
        }
    }
    return changed;
}
 
Example 4
Source File: GroovySourcesNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    NbMavenProject watch = project.getLookup().lookup(NbMavenProject.class);
    watch.addPropertyChangeListener(this);
    watch.addWatchedPath(MAIN_GROOVY);
    watch.addWatchedPath(TEST_GROOVY);
    checkFileObject(MAIN_GROOVY);
    checkFileObject(TEST_GROOVY);
}