Examples of IJavaElement


Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

  public IJavaElement[] getChildren() {
    return this.children;
  }
  public void removeChild(IJavaElement child) {
    for (int i = 0, length = this.children.length; i < length; i++) {
      IJavaElement element = this.children[i];
      if (element.equals(child)) {
        if (length == 1) {
          this.children = JavaElement.NO_ELEMENTS;
        } else {
          IJavaElement[] newChildren = new IJavaElement[length-1];
          System.arraycopy(this.children, 0, newChildren , 0, i);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

 
  int size = fRootElements.size();
  ArrayList parents = getAncestors(element);
 
  for (int i = 0; i < size; i++) {
    IJavaElement aTop = (IJavaElement) fRootElements.get(i);
    if (aTop.equals(element)) {
      return true;
    }
    for (int j = 0, pSize = parents.size(); j < pSize; j++) {
      if (aTop.equals(parents.get(j))) {
        //an ancestor is already included
        return true;
      }
    }
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

* in bottom-up order.
*
*/
private ArrayList getAncestors(IJavaElement element) {
  ArrayList parents = new ArrayList();
  IJavaElement parent = element.getParent();
  while (parent != null) {
    parents.add(parent);
    parent = parent.getParent();
  }
  parents.trimToSize();
  return parents;
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

*/
protected void removeAllChildren(IJavaElement element) {
  if (element instanceof IParent) {
    ArrayList newRootElements = new ArrayList();
    for (int i = 0, size = fRootElements.size(); i < size; i++) {
      IJavaElement currentRoot = (IJavaElement)fRootElements.get(i);
      //walk the current root hierarchy
      IJavaElement parent = currentRoot.getParent();
      boolean isChild= false;
      while (parent != null) {
        if (parent.equals(element)) {
          isChild= true;
          break;
        }
        parent = parent.getParent();
      }
      if (!isChild) {
        newRootElements.add(currentRoot);
      }
    }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

      }
    }
  }
}
public void acceptLocalField(FieldBinding fieldBinding) {
  IJavaElement res;
  if(fieldBinding.declaringClass instanceof ParameterizedTypeBinding) {
    LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)fieldBinding.declaringClass).genericType();
    res = findLocalElement(localTypeBinding.sourceStart());
  } else {
    SourceTypeBinding typeBinding = (SourceTypeBinding)fieldBinding.declaringClass;
    res = findLocalElement(typeBinding.sourceStart());
  }
  if (res != null && res.getElementType() == IJavaElement.TYPE) {
    IType type = (IType) res;
    IField field= type.getField(new String(fieldBinding.name));
    if (field.exists()) {
      char[] uniqueKey = fieldBinding.computeUniqueKey();
      if(field.isBinary()) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

      }
    }
  }
}
public void acceptLocalMethod(MethodBinding methodBinding) {
  IJavaElement res = findLocalElement(methodBinding.sourceStart());
  if(res != null) {
    if(res.getElementType() == IJavaElement.METHOD) {
      IMethod method = (IMethod) res;

      char[] uniqueKey = methodBinding.computeUniqueKey();
      if(method.isBinary()) {
        ResolvedBinaryMethod resolvedRes = new ResolvedBinaryMethod(
            (JavaElement)res.getParent(),
            method.getElementName(),
            method.getParameterTypes(),
            new String(uniqueKey));
        resolvedRes.occurrenceCount = method.getOccurrenceCount();
        res = resolvedRes;
      } else {
        ResolvedSourceMethod resolvedRes = new ResolvedSourceMethod(
            (JavaElement)res.getParent(),
            method.getElementName(),
            method.getParameterTypes(),
            new String(uniqueKey));
        resolvedRes.occurrenceCount = method.getOccurrenceCount();
        res = resolvedRes;
      }
      addElement(res);
      if(SelectionEngine.DEBUG){
        System.out.print("SELECTION - accept method("); //$NON-NLS-1$
        System.out.print(res.toString());
        System.out.println(")"); //$NON-NLS-1$
      }
    } else if(methodBinding.selector == TypeConstants.INIT && res.getElementType() == IJavaElement.TYPE) {
      // it's a default constructor
      res = ((JavaElement)res).resolved(methodBinding.declaringClass);
      addElement(res);
      if(SelectionEngine.DEBUG){
        System.out.print("SELECTION - accept type("); //$NON-NLS-1$
        System.out.print(res.toString());
        System.out.println(")"); //$NON-NLS-1$
      }
    }
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

      }
    }
  }
}
public void acceptLocalType(TypeBinding typeBinding) {
  IJavaElement res =  null;
  if(typeBinding instanceof ParameterizedTypeBinding) {
    LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeBinding).genericType();
    res = findLocalElement(localTypeBinding.sourceStart());
  } else if(typeBinding instanceof SourceTypeBinding) {
    res = findLocalElement(((SourceTypeBinding)typeBinding).sourceStart());
  }
  if(res != null && res.getElementType() == IJavaElement.TYPE) {
    res = ((JavaElement)res).resolved(typeBinding);
    addElement(res);
    if(SelectionEngine.DEBUG){
      System.out.print("SELECTION - accept type("); //$NON-NLS-1$
      System.out.print(res.toString());
      System.out.println(")"); //$NON-NLS-1$
    }
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

      System.out.println(")"); //$NON-NLS-1$
    }
  }
}
public void acceptLocalTypeParameter(TypeVariableBinding typeVariableBinding) {
  IJavaElement res;
  if(typeVariableBinding.declaringElement instanceof ParameterizedTypeBinding) {
    LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeVariableBinding.declaringElement).genericType();
    res = findLocalElement(localTypeBinding.sourceStart());
  } else {
    SourceTypeBinding typeBinding = (SourceTypeBinding)typeVariableBinding.declaringElement;
    res = findLocalElement(typeBinding.sourceStart());
  }
  if (res != null && res.getElementType() == IJavaElement.TYPE) {
    IType type = (IType) res;
    ITypeParameter typeParameter = type.getTypeParameter(new String(typeVariableBinding.sourceName));
    if (typeParameter.exists()) {
      addElement(typeParameter);
      if(SelectionEngine.DEBUG){
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

    }
  }
}
public void acceptLocalMethodTypeParameter(TypeVariableBinding typeVariableBinding) {
  MethodBinding methodBinding = (MethodBinding)typeVariableBinding.declaringElement;
  IJavaElement res = findLocalElement(methodBinding.sourceStart());
  if(res != null && res.getElementType() == IJavaElement.METHOD) {
    IMethod method = (IMethod) res;

    ITypeParameter typeParameter = method.getTypeParameter(new String(typeVariableBinding.sourceName));
    if (typeParameter.exists()) {
      addElement(typeParameter);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IJavaElement

    }
  }
}
public void acceptLocalVariable(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  IJavaElement parent = findLocalElement(local.sourceStart); // findLocalElement() cannot find local variable
  IJavaElement localVar = null;
  if(parent != null) {
    localVar = new LocalVariable(
        (JavaElement)parent,
        new String(local.name),
        local.declarationSourceStart,
        local.declarationSourceEnd,
        local.sourceStart,
        local.sourceEnd,
        Util.typeSignature(local.type));
  }
  if (localVar != null) {
    addElement(localVar);
    if(SelectionEngine.DEBUG){
      System.out.print("SELECTION - accept local variable("); //$NON-NLS-1$
      System.out.print(localVar.toString());
      System.out.println(")"); //$NON-NLS-1$
    }
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.