This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 100075
Collapse All | Expand All

(-)apichanges.xml (-16 / +1 lines)
Lines 82-103 Link Here
82
    <!-- ACTUAL CHANGES BEGIN HERE: -->
82
    <!-- ACTUAL CHANGES BEGIN HERE: -->
83
83
84
    <changes>
84
    <changes>
85
85
        
86
        <change id="ClassIndexListener">
87
            <api name="general"/>
88
            <summary>Added a listener for listening on changes in the <code>ClassIndex</code>.</summary>
89
            <version major="0" minor="8"/>
90
            <date day="4" month="4" year="2007"/>
91
            <author login="tzezula"/>
92
            <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
93
            <description>
94
                The listener for listening on changes in the <code>ClassIndex</code> was added. The listener fires
95
                events when a declared type was removed, added, changed in the <code>ClassIndex</code> oe when the underlaying
96
                <code>ClassPath</code> was changed.
97
            </description>
98
            <issue number="91763"/>
99
        </change>
100
101
        <change id="package-property">
86
        <change id="package-property">
102
            <api name="general"/>
87
            <api name="general"/>
103
            <summary>Adding template attribute <code>package</code></summary>
88
            <summary>Adding template attribute <code>package</code></summary>
(-)nbproject/project.properties (-1 / +1 lines)
Lines 23-27 Link Here
23
javadoc.title=Java Source
23
javadoc.title=Java Source
24
javadoc.arch=${basedir}/arch.xml
24
javadoc.arch=${basedir}/arch.xml
25
javadoc.apichanges=${basedir}/apichanges.xml
25
javadoc.apichanges=${basedir}/apichanges.xml
26
spec.version.base=0.8.0
26
spec.version.base=0.7.0
27
test.unit.run.cp.extra=${core.dir}/core/core.jar:${core.dir}/lib/boot.jar:../../junit/external/insanelib.jar
27
test.unit.run.cp.extra=${core.dir}/core/core.jar:${core.dir}/lib/boot.jar:../../junit/external/insanelib.jar
(-)src/org/netbeans/api/java/source/ClassIndex.java (-30 lines)
Lines 168-203 Link Here
168
        this.bootPath = bootPath;
158
        this.bootPath = bootPath;
169
        this.classPath = classPath;
159
        this.classPath = classPath;
170
        this.sourcePath = sourcePath;
160
        this.sourcePath = sourcePath;
171
        final ClassIndexManager manager = ClassIndexManager.getDefault();
172
        manager.addClassIndexManagerListener(WeakListeners.create(ClassIndexManagerListener.class, (ClassIndexManagerListener) this.spiListener, manager));
173
        this.sourceIndeces = new HashSet<ClassIndexImpl>();        
174
        this.oldSources = new HashSet<URL>();
175
        createQueriesForRoots (this.sourcePath, true, this.sourceIndeces, oldSources);
176
        this.depsIndeces = new HashSet<ClassIndexImpl>();
177
        this.oldDeps = new HashSet<URL>();
178
        createQueriesForRoots (this.bootPath, false, this.depsIndeces, oldDeps);                
179
        createQueriesForRoots (this.classPath, false, this.depsIndeces, oldDeps);	    
180
    }
181
    
182
    
183
    /**
184
     * Adds an {@link ClassIndexListener}. The listener is notified about the
185
     * changes of declared types in this {@link ClassIndex}
186
     * @param listener to be added
187
     */
188
    public void addClassIndexListener (final ClassIndexListener listener) {
189
        assert listener != null;
190
        listeners.add (listener);
191
    }
192
    
193
    /**
194
     * Removes an {@link ClassIndexListener}. The listener is notified about the
195
     * changes of declared types in this {@link ClassIndex}
196
     * @param listener to be removed
197
     */
198
    public void removeClassIndexListener (final ClassIndexListener listener) {
199
        assert listener != null;
200
        listeners.remove(listener);
201
    }
161
    }
202
    
162
    
203
    
163
    
(-)src/org/netbeans/api/java/source/ClassIndexListener.java (-72 lines)
Removed Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.api.java.source;
21
22
import java.util.EventListener;
23
24
/**
25
 * Listener for changes in {@link ClassIndex}.
26
* <P>
27
* When attached to a {ClassIndex} it listens for addition,
28
* removal and modification of declared types.
29
* <P>
30
*
31
* @see ClassIndex#addClassIndexListener
32
 * @author Tomas Zezula
33
 */
34
public interface ClassIndexListener extends EventListener {
35
    
36
    /**
37
     * Called when the new declared types are added
38
     * into the {@link ClassIndex}
39
     * @param event specifying the added types
40
     */
41
    public void typesAdded (TypesEvent event);
42
    
43
    /**
44
     * Called when declared types are removed
45
     * from the {@link ClassIndex}
46
     * @param event specifying the removed types
47
     */
48
    public void typesRemoved (TypesEvent event);
49
        
50
    /**
51
     * Called when some declared types are changed.
52
     * @param event specifying the changed types
53
     */
54
    public void typesChanged (TypesEvent event);
55
    
56
    /**
57
     * Called when new roots are added
58
     * into the {@link ClassPath} for which the {@link ClassIndex}
59
     * was created.
60
     * @param event specifying the added roots
61
     */
62
    public void rootsAdded (RootsEvent event);
63
    
64
    /**
65
     * Called when root are removed
66
     * from the {@link ClassPath} for which the {@link ClassIndex}
67
     * was created.
68
     * @param event specifying the removed roots
69
     */
70
    public void rootsRemoved (RootsEvent event);
71
    
72
}
(-)src/org/netbeans/api/java/source/RootsEvent.java (-55 lines)
Removed Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.api.java.source;
21
22
import java.net.URL;
23
import java.util.EventObject;
24
import org.netbeans.api.java.classpath.ClassPath;
25
26
/**
27
 * Event used to notify the {@link ClassIndexListener} about
28
 * a change in  the underlying {@link ClassPath}
29
 * @author Tomas Zezula
30
 */
31
public final class RootsEvent extends EventObject {
32
    
33
    private final Iterable <? extends URL> roots;
34
    
35
    
36
    RootsEvent(final Object source, final Iterable<? extends URL> roots) {
37
        super (source);
38
        assert roots != null;
39
        this.roots = roots;
40
    }
41
    
42
    /**
43
     * Returns the affected declared {@link ClassPath} roots.
44
     * @return an {@link Iterable} of {@link URL}
45
     */
46
    public Iterable<? extends URL> getRoots () {
47
        return this.roots;
48
    }
49
    
50
    @Override
51
    public String toString () {
52
        return String.format ("RootsEvent [%s]",this.roots.toString());
53
    }
54
    
55
}
(-)src/org/netbeans/api/java/source/TypesEvent.java (-54 lines)
Removed Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.api.java.source;
21
22
import java.util.EventObject;
23
import javax.lang.model.element.TypeElement;
24
import org.netbeans.api.java.source.ElementHandle;
25
26
/**
27
 * Event used to notify the {@link ClassIndexListener} about
28
 * a change of declared types in the {@link ClassIndex}
29
 * @author Tomas Zezula
30
 */
31
public final class TypesEvent extends EventObject {
32
    
33
    private final Iterable<? extends ElementHandle<TypeElement>> types;
34
    
35
    TypesEvent (final Object source, final Iterable<? extends ElementHandle<TypeElement>> types) {
36
        super (source);
37
        assert types != null;
38
        this.types = types;
39
    }
40
    
41
    /**
42
     * Returns the affected declared types.
43
     * @return an {@link Iterable} of {@link TypeElement} handles
44
     */
45
    public Iterable<? extends ElementHandle<TypeElement>> getTypes () {
46
        return this.types;
47
    }
48
    
49
    @Override
50
    public String toString () {
51
        return String.format("TypesEvent [%s]", this.types.toString());
52
    }
53
    
54
}

Return to bug 100075