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 184168
Collapse All | Expand All

(-)a/java.source/apichanges.xml (+14 lines)
Lines 105-110 Link Here
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
    <changes>
107
    <changes>
108
        <change id="ElementUtilities.findSubtypes">
109
             <api name="general"/>
110
             <summary>Added ElementUtilities.findSubtypes</summary>
111
             <version major="0" minor="59"/>
112
             <date day="21" month="4" year="2010"/>
113
             <author login="jlahoda"/>
114
             <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
115
             <description>
116
                 Added <code>ElementUtilities.findSubtypes</code> method, which
117
                 returns a all subtypes of given types.
118
             </description>
119
             <class package="org.netbeans.api.java.source" name="ElementUtilities"/>
120
             <issue number="184168"/>
121
        </change>
108
        <change id="SourceUtils.getAttributeValueCompletions">
122
        <change id="SourceUtils.getAttributeValueCompletions">
109
             <api name="general"/>
123
             <api name="general"/>
110
             <summary>Added SourceUtils.getAttributeValueCompletions method.</summary>
124
             <summary>Added SourceUtils.getAttributeValueCompletions method.</summary>
(-)a/java.source/nbproject/project.properties (-1 / +1 lines)
Lines 43-49 Link Here
43
javadoc.title=Java Source
43
javadoc.title=Java Source
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
spec.version.base=0.58.0
46
spec.version.base=0.59.0
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
(-)a/java.source/src/org/netbeans/api/java/source/ElementUtilities.java (+37 lines)
Lines 70-77 Link Here
70
import com.sun.tools.javac.util.Context;
70
import com.sun.tools.javac.util.Context;
71
import com.sun.tools.javac.util.Names;
71
import com.sun.tools.javac.util.Names;
72
import com.sun.tools.javadoc.DocEnv;
72
import com.sun.tools.javadoc.DocEnv;
73
import java.io.IOException;
74
import java.net.URL;
73
75
74
import java.util.ArrayList;
76
import java.util.ArrayList;
77
import java.util.Collection;
75
import java.util.Collections;
78
import java.util.Collections;
76
import java.util.EnumSet;
79
import java.util.EnumSet;
77
import java.util.HashMap;
80
import java.util.HashMap;
Lines 80-85 Link Here
80
import java.util.LinkedList;
83
import java.util.LinkedList;
81
import java.util.List;
84
import java.util.List;
82
import java.util.ListIterator;
85
import java.util.ListIterator;
86
import java.util.Map;
87
import java.util.Set;
83
import javax.lang.model.element.Element;
88
import javax.lang.model.element.Element;
84
import javax.lang.model.element.ElementKind;
89
import javax.lang.model.element.ElementKind;
85
import javax.lang.model.element.ExecutableElement;
90
import javax.lang.model.element.ExecutableElement;
Lines 96-101 Link Here
96
101
97
import org.netbeans.modules.java.source.builder.ElementsService;
102
import org.netbeans.modules.java.source.builder.ElementsService;
98
import org.netbeans.modules.java.source.JavadocEnv;
103
import org.netbeans.modules.java.source.JavadocEnv;
104
import org.netbeans.modules.java.source.tasklist.TasklistSettings.DependencyTracking;
105
import org.netbeans.modules.java.source.util.FindUsagesUtils;
106
import org.openide.filesystems.FileObject;
107
import org.openide.util.Exceptions;
99
108
100
/**
109
/**
101
 *
110
 *
Lines 536-541 Link Here
536
        return findUnimplementedMethods(impl, impl);
545
        return findUnimplementedMethods(impl, impl);
537
    }
546
    }
538
547
548
    /**
549
     * Finds all subtypes of given types in all known source roots that depend on the current source root.
550
     *
551
     * @param handles types for which the subtypes should be found
552
     * @return all found subtypes for the given types, classified by source root and original type. <code>null</code> may be returned if current the task is canceled.
553
     * @since 0.59
554
     */
555
    public Map<URL, Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>>> findSubTypes(Collection<? extends ElementHandle<TypeElement>> handles) {
556
        FileObject owner = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE).findOwnerRoot(info.getFileObject());
557
558
        if (owner == null) {
559
            return Collections.emptyMap();//TODO: log?
560
        }
561
562
        Map<URL, Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>>> result = new HashMap<URL, Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>>>();
563
564
        try {
565
            if (FindUsagesUtils.findUsages(owner.getURL(), new LinkedList<ElementHandle<TypeElement>>(handles), result, false, true, false, DependencyTracking.ENABLED) == null) {
566
                return null;
567
            }
568
        } catch (IOException ex) {
569
            //should not normally happen:
570
            Exceptions.printStackTrace(ex);
571
        }
572
573
        return result;
574
    }
575
539
    // private implementation --------------------------------------------------
576
    // private implementation --------------------------------------------------
540
577
541
578

Return to bug 184168