/** * @return The semantic highlightings, the order defines the precedence of matches, the first match wins. */ public static SemanticHighlighting[] getSemanticHighlightings() { if (fgSemanticHighlightings == null) fgSemanticHighlightings= new SemanticHighlighting[] { new DeprecatedMemberHighlighting(), new AutoboxHighlighting(), new StaticFinalFieldHighlighting(), new StaticFieldHighlighting(), new FieldHighlighting(), new MethodDeclarationHighlighting(), new StaticMethodInvocationHighlighting(), new AbstractMethodInvocationHighlighting(), new AnnotationElementReferenceHighlighting(), new InheritedMethodInvocationHighlighting(), new ParameterVariableHighlighting(), new LocalVariableDeclarationHighlighting(), new LocalVariableHighlighting(), new TypeVariableHighlighting(), // before type arguments! new MethodHighlighting(), // before types to get ctors new TypeArgumentHighlighting(), // before other types new ClassHighlighting(), new EnumHighlighting(), new AnnotationHighlighting(), // before interfaces new InterfaceHighlighting(), }; return fgSemanticHighlightings; }
public boolean consumes(SemanticToken token) { IBinding binding= getMethodBinding(token); return binding != null && binding.getKind() == IBinding.METHOD; }
/** * Extracts the method binding from the token's simple name. The method * binding is either the token's binding (if the parent of token is a * method call or declaration) or the constructor binding of a class * instance creation if the node is the type name of a class instance * creation. * * @param token the token to extract the method binding from * @return the corresponding method binding, or <code>null</code> */ private IBinding getMethodBinding(SemanticToken token) { IBinding binding= null; // work around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=62605 ASTNode node= token.getNode(); ASTNode parent= node.getParent(); while (isTypePath(node, parent)) { node= parent; parent= parent.getParent(); } if (parent != null && node.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) binding= ((ClassInstanceCreation) parent).resolveConstructorBinding(); else binding= token.getBinding(); return binding; }
new LocalVariableHighlighting(), new TypeVariableHighlighting(), // before type arguments! new MethodHighlighting(), // before types to get ctors new TypeArgumentHighlighting(), // before other types new AbstractClassHighlighting(), // before classes
new LocalVariableHighlighting(), new TypeVariableHighlighting(), // before type arguments! new MethodHighlighting(), // before types to get ctors new TypeArgumentHighlighting(), // before other types new AbstractClassHighlighting(), // before classes