org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement()方法的一些代码示例,展示了Util.getUnresolvedJavaElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getUnresolvedJavaElement()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.core.util.Util
类名称:Util
方法名:getUnresolvedJavaElement

Util.getUnresolvedJavaElement介绍

[英]Returns the IInitializer that contains the given local variable in the given type
[中]返回在给定类型中包含给定局部变量的IIInitializer

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Return the java element corresponding to the given compiler binding.
 */
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) {
  if (binding.declaringClass == null) return null; // array length
  JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes);
  if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) {
    return null;
  }
  return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name));
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private JavaElement getUnresolvedJavaElement() {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (!(this.resolver instanceof DefaultBindingResolver)) return null;
  DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
  if (!defaultBindingResolver.fromJavaProject) return null;
  return Util.getUnresolvedJavaElement(
      this.binding,
      defaultBindingResolver.workingCopyOwner,
      defaultBindingResolver.getBindingsToNodesMap());
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private JavaElement getUnresolvedJavaElement(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding ) {
  if (JavaCore.getPlugin() == null) {
    return null;
  }
  if (this.resolver instanceof DefaultBindingResolver) {
    DefaultBindingResolver defaultBindingResolver = (DefaultBindingResolver) this.resolver;
    if (!defaultBindingResolver.fromJavaProject) return null;
    return org.eclipse.jdt.internal.core.util.Util.getUnresolvedJavaElement(
        typeBinding,
        defaultBindingResolver.workingCopyOwner,
        defaultBindingResolver.getBindingsToNodesMap());
  }
  return null;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

相关文章

Util类方法