Lines 49-54
Link Here
|
49 |
import java.net.URL; |
49 |
import java.net.URL; |
50 |
import java.util.*; |
50 |
import java.util.*; |
51 |
|
51 |
|
|
|
52 |
import javax.annotation.processing.Completion; |
53 |
import javax.annotation.processing.Processor; |
52 |
import javax.lang.model.element.*; |
54 |
import javax.lang.model.element.*; |
53 |
import javax.lang.model.element.VariableElement; |
55 |
import javax.lang.model.element.VariableElement; |
54 |
import javax.lang.model.type.ArrayType; |
56 |
import javax.lang.model.type.ArrayType; |
Lines 94-99
Link Here
|
94 |
import org.netbeans.api.lexer.TokenHierarchy; |
96 |
import org.netbeans.api.lexer.TokenHierarchy; |
95 |
import org.netbeans.api.lexer.TokenSequence; |
97 |
import org.netbeans.api.lexer.TokenSequence; |
96 |
import org.netbeans.modules.java.JavaDataLoader; |
98 |
import org.netbeans.modules.java.JavaDataLoader; |
|
|
99 |
import org.netbeans.modules.java.source.indexing.APTUtils; |
97 |
import org.netbeans.modules.java.source.indexing.JavaCustomIndexer; |
100 |
import org.netbeans.modules.java.source.indexing.JavaCustomIndexer; |
98 |
import org.netbeans.modules.java.source.indexing.JavaIndex; |
101 |
import org.netbeans.modules.java.source.indexing.JavaIndex; |
99 |
import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider; |
102 |
import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider; |
Lines 167-173
Link Here
|
167 |
Type.TypeVar bound = ((Type.WildcardType)wildcardType).bound; |
170 |
Type.TypeVar bound = ((Type.WildcardType)wildcardType).bound; |
168 |
return bound != null ? bound.bound : null; |
171 |
return bound != null ? bound.bound : null; |
169 |
} |
172 |
} |
170 |
|
173 |
|
|
|
174 |
/** |
175 |
* Returns a list of completions for an annotation attribute value suggested by |
176 |
* annotation processors. |
177 |
* |
178 |
* @param info the CompilationInfo used to resolve annotation processors |
179 |
* @param element the element being annotated |
180 |
* @param annotation the (perhaps partial) annotation being applied to the element |
181 |
* @param member the annotation member to return possible completions for |
182 |
* @param userText source code text to be completed |
183 |
* @return suggested completions to the annotation member |
184 |
* |
185 |
* @since 0.56 |
186 |
*/ |
187 |
public static List<? extends Completion> getAttributeValueCompletions(CompilationInfo info, Element element, AnnotationMirror annotation, ExecutableElement member, String userText) { |
188 |
List<Completion> completions = new LinkedList<Completion>(); |
189 |
if (info.getPhase().compareTo(Phase.ELEMENTS_RESOLVED) >= 0) { |
190 |
String fqn = ((TypeElement) annotation.getAnnotationType().asElement()).getQualifiedName().toString(); |
191 |
Iterable<? extends Processor> processors = info.impl.getJavacTask().getProcessors(); |
192 |
if (processors != null) { |
193 |
for (Processor processor : processors) { |
194 |
boolean match = false; |
195 |
for (String sat : processor.getSupportedAnnotationTypes()) { |
196 |
if ("*".equals(sat)) { //NOI18N |
197 |
match = true; |
198 |
break; |
199 |
} else if (sat.endsWith(".*")) { //NOI18N |
200 |
sat = sat.substring(0, sat.length() - 1); |
201 |
if (fqn.startsWith(sat)) { |
202 |
match = true; |
203 |
break; |
204 |
} |
205 |
} else if (fqn.equals(sat)) { |
206 |
match = true; |
207 |
break; |
208 |
} |
209 |
} |
210 |
if (match) { |
211 |
for (Completion c : processor.getCompletions(element, annotation, member, userText)) { |
212 |
completions.add(c); |
213 |
} |
214 |
} |
215 |
} |
216 |
} |
217 |
} |
218 |
return completions; |
219 |
} |
220 |
|
171 |
/** |
221 |
/** |
172 |
* Returns the type element within which this member or constructor |
222 |
* Returns the type element within which this member or constructor |
173 |
* is declared. Does not accept packages |
223 |
* is declared. Does not accept packages |