Package org.aspectj.org.eclipse.jdt.core

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


  if (VERBOSE) {
    System.out.println("-> Buffer cache filling ratio = " + NumberFormat.getInstance().format(this.openBuffers.fillingRatio()) + "%"); //$NON-NLS-1$//$NON-NLS-2$
  }
}
public static IBuffer createBuffer(IOpenable owner) {
  IJavaElement element = (IJavaElement)owner;
  IResource resource = element.getResource();
  return
    new Buffer(
      resource instanceof IFile ? (IFile)resource : null,
      owner,
      element.isReadOnly());
}
View Full Code Here


      resource instanceof IFile ? (IFile)resource : null,
      owner,
      element.isReadOnly());
}
public static IBuffer createNullBuffer(IOpenable owner) {
  IJavaElement element = (IJavaElement)owner;
  IResource resource = element.getResource();
  return
    new NullBuffer(
      resource instanceof IFile ? (IFile)resource : null,
      owner,
      element.isReadOnly());
}
View Full Code Here

  public IJavaModelStatus verify() {
    if (getParentElement() == null) {
      return new JavaModelStatus(IJavaModelStatusConstants.NO_ELEMENTS_TO_PROCESS);
    }
    if (this.anchorElement != null) {
      IJavaElement domPresentParent = this.anchorElement.getParent();
      if (domPresentParent.getElementType() == IJavaElement.IMPORT_CONTAINER) {
        domPresentParent = domPresentParent.getParent();
      }
      if (!domPresentParent.equals(getParentElement())) {
        return new JavaModelStatus(IJavaModelStatusConstants.INVALID_SIBLING, this.anchorElement);
      }
    }
    return JavaModelStatus.VERIFIED_OK;
  }
View Full Code Here

  if (searchPattern instanceof OrPattern) {
    SearchPattern[] patterns = ((OrPattern) searchPattern).patterns;
    for (int i = 0, length = patterns.length; i < length; i++)
      locatePackageDeclarations(patterns[i], participant);
  } else if (searchPattern instanceof PackageDeclarationPattern) {
    IJavaElement focus = ((InternalSearchPattern) searchPattern).focus;
    if (focus != null) {
      if (encloses(focus)) {
        SearchMatch match = new PackageDeclarationMatch(focus.getAncestor(IJavaElement.PACKAGE_FRAGMENT), SearchMatch.A_ACCURATE, -1, -1, participant, focus.getResource());
        report(match);
      }
      return;
    }
    PackageDeclarationPattern pkgPattern = (PackageDeclarationPattern) searchPattern;
View Full Code Here

* Visit the given method declaration and report the nodes that match exactly the
* search pattern (ie. the ones in the matching nodes set)
* Note that the method declaration has already been checked.
*/
protected void reportMatching(TypeDeclaration type, AbstractMethodDeclaration method, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException {
  IJavaElement enclosingElement = null;
  if (accuracy > -1) {
    enclosingElement = createHandle(method, parent);
    if (enclosingElement != null) { // skip if unable to find method
      // compute source positions of the selector
      Scanner scanner = parser.scanner;
View Full Code Here

    if (nodes != null) {
      if (!matchedUnitContainer) {
        for (int i = 0, l = nodes.length; i < l; i++)
          nodeSet.matchingNodes.removeKey(nodes[i]);
      } else {
        IJavaElement element = createPackageDeclarationHandle(unit);
        for (int i = 0, l = nodes.length; i < l; i++) {
          ASTNode node = nodes[i];
          Integer level = (Integer) nodeSet.matchingNodes.removeKey(node);
          if (encloses(element))
            this.patternLocator.matchReportReference(node, element, null/*no binding*/, level.intValue(), this);
        }
      }
    }
  }

  if (matchedUnitContainer) {
    ImportReference pkg = unit.currentPackage;
    if (pkg != null && pkg.annotations != null) {
      IJavaElement element = createPackageDeclarationHandle(unit);
      if (element != null) {
        reportMatching(pkg.annotations, element, null, nodeSet, true, encloses(element));
      }
    }

View Full Code Here

/**
* Visit the given field declaration and report the nodes that match exactly the
* search pattern (ie. the ones in the matching nodes set)
*/
protected void reportMatching(FieldDeclaration field, FieldDeclaration[] otherFields, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException {
  IJavaElement enclosingElement = null;
  if (accuracy > -1) {
    enclosingElement = createHandle(field, type, parent);
    if (encloses(enclosingElement)) {
      int offset = field.sourceStart;
      SearchMatch match = newDeclarationMatch(enclosingElement, field.binding, accuracy, offset, field.sourceEnd-offset+1);
View Full Code Here

* Visit the given type declaration and report the nodes that match exactly the
* search pattern (ie. the ones in the matching nodes set)
*/
protected void reportMatching(TypeDeclaration type, IJavaElement parent, int accuracy, MatchingNodeSet nodeSet, int occurrenceCount) throws CoreException {
  // create type handle
  IJavaElement enclosingElement = parent;
  if (enclosingElement == null) {
    enclosingElement = createTypeHandle(new String(type.name));
  } else if (enclosingElement instanceof IType) {
    enclosingElement = ((IType) parent).getType(new String(type.name));
  } else if (enclosingElement instanceof IMember) {
View Full Code Here

        }
      }
      if (typeParameter.type != null) {
        level = (Integer) nodeSet.matchingNodes.removeKey(typeParameter.type);
        if (level != null) {
          IJavaElement localElement = createHandle(typeParameter, enclosingElement);
          this.patternLocator.matchReportReference(typeParameter.type, enclosingElement, localElement, null, binding, level.intValue(), this);
        }
      }
      if (typeParameter.bounds != null) {
        for (int j=0, b=typeParameter.bounds.length; j<b; j++) {
          level = (Integer) nodeSet.matchingNodes.removeKey(typeParameter.bounds[j]);
          if (level != null) {
            IJavaElement localElement = createHandle(typeParameter, enclosingElement);
            this.patternLocator.matchReportReference(typeParameter.bounds[j], enclosingElement, localElement, null, binding, level.intValue(), this);
          }
        }
      }
    }
View Full Code Here

*      be provided to generate a type hierarchy.
*  <li>ELEMENT_NOT_PRESENT - the provided type or type's project does not exist
* </ul>
*/
public IJavaModelStatus verify() {
  IJavaElement elementToProcess= getElementToProcess();
  if (elementToProcess == null && !(this.typeHierarchy instanceof RegionBasedTypeHierarchy)) {
    return new JavaModelStatus(IJavaModelStatusConstants.NO_ELEMENTS_TO_PROCESS);
  }
  if (elementToProcess != null && !elementToProcess.exists()) {
    return new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, elementToProcess);
  }
  IJavaProject project = this.typeHierarchy.javaProject();
  if (project != null && !project.exists()) {
    return new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, project);
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.IJavaElement

Copyright © 2018 www.massapicom. 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.