Java Code Examples for org.netbeans.api.java.classpath.ClassPath#removePropertyChangeListener()

The following examples show how to use org.netbeans.api.java.classpath.ClassPath#removePropertyChangeListener() . 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: JavadocRegistry.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private synchronized void throwCache () {
    //Unregister itself from classpaths, not interested in events
    if (classpaths != null) {
        for (ClassPath cp : classpaths) {
            cp.removePropertyChangeListener(this);
        }
        classpaths.clear();
    }
    //Unregister itself from results, not interested in events
    if (results != null) {
        for (JavadocForBinaryQuery.Result result : results) {
            result.removeChangeListener(this);
        }
        results.clear();
    }
    //Unregister listener from docRoots
    if (docRoots != null) {
        docRoots.removePropertyChangeListener(this);
        docRoots = null;
    }
}
 
Example 2
Source File: SourcePathImplementationTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testSourcePathImplementation () throws Exception {
    ClassPathProviderImpl cpProvider = pp.getClassPathProvider();
    ClassPath[] cps = cpProvider.getProjectClassPaths(ClassPath.SOURCE);
    ClassPath cp = cps[0];
    FileObject[] roots = cp.getRoots();
    assertNotNull ("Roots can not be null",roots);
    assertEquals("There must be one source root", 1, roots.length);
    assertEquals("There must be src root",roots[0],sources);
    TestListener tl = new TestListener();
    cp.addPropertyChangeListener (tl);
    FileObject newRoot = SourceRootsTest.addSourceRoot(helper, projdir,"src.other.dir","other");
    assertTrue("Classpath must fire PROP_ENTRIES and PROP_ROOTS", tl.getEvents().containsAll(Arrays.asList(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS)));
    roots = cp.getRoots();
    assertNotNull ("Roots can not be null",roots);
    assertEquals("There must be two source roots", 2, roots.length);
    assertEquals("There must be src root",roots[0],sources);
    assertEquals("There must be other root",roots[1],newRoot);
    cp.removePropertyChangeListener(tl);
}
 
Example 3
Source File: MultiModuleNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void removeNotify() {
    super.removeNotify();
    ClassPath cp = srcPath.get();
    if (cp != null && srcPath.compareAndSet(cp, null)) {
        cp.removePropertyChangeListener(this);
    }
    cp = testPath.get();
    if (cp != null && testPath.compareAndSet(cp, null)) {
        cp.removePropertyChangeListener(this);
    }
    this.procGenSrc.removePropertyChangeListener(this);
    setKeys(Collections.emptySet());
}
 
Example 4
Source File: BootCPNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void removeNotify() {
    pp.removeChangeListener(this);
    for (ClassPath cp : endorsed) {
        cp.removePropertyChangeListener(this);
    }
    endorsed = null;
}
 
Example 5
Source File: BootCPNodeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override protected void removeNotify() {
    for (ClassPath cp : endorsed) {
        cp.removePropertyChangeListener(this);
    }
    endorsed = null;
}