Lines 46-51
Link Here
|
46 |
|
46 |
|
47 |
import java.util.Set; |
47 |
import java.util.Set; |
48 |
import javax.lang.model.element.TypeElement; |
48 |
import javax.lang.model.element.TypeElement; |
|
|
49 |
import org.netbeans.api.annotations.common.CheckForNull; |
50 |
import org.netbeans.api.annotations.common.NullAllowed; |
49 |
import org.netbeans.api.java.source.ClassIndex; |
51 |
import org.netbeans.api.java.source.ClassIndex; |
50 |
import org.netbeans.api.java.source.ClasspathInfo; |
52 |
import org.netbeans.api.java.source.ClasspathInfo; |
51 |
import org.netbeans.api.java.source.ElementHandle; |
53 |
import org.netbeans.api.java.source.ElementHandle; |
Lines 67-80
Link Here
|
67 |
|
69 |
|
68 |
/** |
70 |
/** |
69 |
* Searches for classes on given classpath using defined restrictions. |
71 |
* Searches for classes on given classpath using defined restrictions. |
|
|
72 |
* |
73 |
* @param cpInfo classpath used for search; optional, can be null, |
74 |
* everything available will be searched |
75 |
* @param customizer possibility to add restrictions to search result; |
76 |
* optional, can be null, no restriction will be applied |
77 |
* @return found type or null if dialog was canceled |
78 |
*/ |
79 |
public static @CheckForNull ElementHandle<TypeElement> find(@NullAllowed ClasspathInfo cpInfo, @NullAllowed final Customizer customizer) { |
80 |
return find(cpInfo, null, customizer); |
81 |
} |
82 |
|
83 |
/** |
84 |
* Searches for classes on given classpath using defined restrictions. |
70 |
* |
85 |
* |
71 |
* @param cpInfo classpath used for search; optional, can be null, |
86 |
* @param cpInfo classpath used for search; optional, can be null, |
72 |
* everything available will be searched |
87 |
* everything available will be searched |
|
|
88 |
* @param initialText text that should be prefilled in the type name text field, or null to prefill text automatically from the context |
73 |
* @param customizer possibility to add restrictions to search result; |
89 |
* @param customizer possibility to add restrictions to search result; |
74 |
* optional, can be null, no restriction will be applied |
90 |
* optional, can be null, no restriction will be applied |
75 |
* @return found type or null if dialog was canceled |
91 |
* @return found type or null if dialog was canceled |
|
|
92 |
* @since 1.24 |
76 |
*/ |
93 |
*/ |
77 |
public static ElementHandle<TypeElement> find(ClasspathInfo cpInfo, final Customizer customizer) { |
94 |
public static @CheckForNull ElementHandle<TypeElement> find(@NullAllowed ClasspathInfo cpInfo, @NullAllowed String initialText, @NullAllowed final Customizer customizer) { |
78 |
|
95 |
|
79 |
// create filter only if client wants to customize the result |
96 |
// create filter only if client wants to customize the result |
80 |
TypeBrowser.Filter typeBrowserFilter = null; |
97 |
TypeBrowser.Filter typeBrowserFilter = null; |
Lines 91-97
Link Here
|
91 |
} |
108 |
} |
92 |
|
109 |
|
93 |
TypeDescriptor typeDescriptor = TypeBrowser.browse( |
110 |
TypeDescriptor typeDescriptor = TypeBrowser.browse( |
94 |
NbBundle.getMessage(TypeElementFinder.class, "DLG_FindType"), |
111 |
NbBundle.getMessage(TypeElementFinder.class, "DLG_FindType"), |
|
|
112 |
initialText, |
95 |
typeBrowserFilter, |
113 |
typeBrowserFilter, |
96 |
new JavaTypeProvider(cpInfo, customizer == null ? null : customizer) |
114 |
new JavaTypeProvider(cpInfo, customizer == null ? null : customizer) |
97 |
); |
115 |
); |