in remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/SemanticHighlighter.java [418:483]
private void handlePossibleIdentifier(TreePath expr, Collection<UseTypes> type, Element decl, boolean providesDecl, boolean nct) {
if (isKeyword(expr.getLeaf())) {
//ignore keywords:
return ;
}
if (expr.getLeaf().getKind() == Kind.PRIMITIVE_TYPE) {
//ignore primitive types:
return ;
}
if (LITERALS.contains(expr.getLeaf().getKind())) {
//ignore literals:
return ;
}
decl = !providesDecl ? info.getTrees().getElement(expr) : decl;
Collection<ColoringAttributes> c = null;
//causes NPE later, as decl is put into list of declarations to handle:
// if (decl == null) {
// c = Collections.singletonList(ColoringAttributes.UNDEFINED);
// }
if (decl != null && (decl.getKind().isField() || isLocalVariableClosure(decl))) {
c = getVariableColoring(decl);
}
if (decl != null && decl instanceof ExecutableElement) {
c = getMethodColoring((ExecutableElement) decl, nct);
}
if (decl != null && (decl.getKind().isClass() || decl.getKind().isInterface())) {
//class use make look like read variable access:
if (type.contains(UseTypes.READ)) {
type = EnumSet.copyOf(type);
type.remove(UseTypes.READ);
type.add(UseTypes.CLASS_USE);
}
c = new ArrayList<ColoringAttributes>();
addModifiers(decl, c);
switch (decl.getKind()) {
case CLASS: c.add(ColoringAttributes.CLASS); break;
case INTERFACE: c.add(ColoringAttributes.INTERFACE); break;
case ANNOTATION_TYPE: c.add(ColoringAttributes.ANNOTATION_TYPE); break;
case ENUM: c.add(ColoringAttributes.ENUM); break;
}
}
if (decl != null && type.contains(UseTypes.DECLARATION)) {
if (c == null) {
c = new ArrayList<ColoringAttributes>();
}
c.add(ColoringAttributes.DECLARATION);
}
if (c != null) {
addUse(decl, type, expr, c);
}
}