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

Examples of org.aspectj.org.eclipse.jdt.core.dom.ImportDeclaration


    if (decls.isEmpty()) {
      return;
    }       
    PackageEntry currPackage= null;
     
    ImportDeclaration curr= (ImportDeclaration) decls.get(0);
    int currOffset= curr.getStartPosition();
    int currLength= curr.getLength();
    int currEndLine= root.getLineNumber(currOffset + currLength);
   
    for (int i= 1; i < decls.size(); i++) {
      boolean isStatic= curr.isStatic();
      String name= getFullName(curr);
      String packName= getQualifier(curr);
      if (currPackage == null || currPackage.compareTo(packName, isStatic) != 0) {
        currPackage= new PackageEntry(packName, null, isStatic);
        this.packageEntries.add(currPackage);
      }

      ImportDeclaration next= (ImportDeclaration) decls.get(i);
      int nextOffset= next.getStartPosition();
      int nextLength= next.getLength();
      int nextOffsetLine= root.getLineNumber(nextOffset);

      // if next import is on a different line, modify the end position to the next line begin offset
      if (currEndLine < nextOffsetLine) {
        currEndLine++;
View Full Code Here


  }
     
  private IRegion evaluateReplaceRange(CompilationUnit root) {
    List imports= root.imports();
    if (!imports.isEmpty()) {
      ImportDeclaration first= (ImportDeclaration) imports.get(0);
      ImportDeclaration last= (ImportDeclaration) imports.get(imports.size() - 1);
     
      int startPos= first.getStartPosition(); // no extended range for first: bug 121428
      int endPos= root.getExtendedStartPosition(last) + root.getExtendedLength(last);
      int endLine= root.getLineNumber(endPos);
      if (endLine > 0) {
View Full Code Here

  String importActualName = this.importName;
  if (onDemand) {
    importActualName = this.importName.substring(0, this.importName.length() - 2);
  }
  while (imports.hasNext()) {
    ImportDeclaration importDeclaration = (ImportDeclaration) imports.next();
    if (importActualName.equals(importDeclaration.getName().getFullyQualifiedName())
        && (onDemand == importDeclaration.isOnDemand())
        && (Flags.isStatic(this.flags) == importDeclaration.isStatic())) {
      this.creationOccurred = false;
      return null;
    }
  }
 
  AST ast = this.cuAST.getAST();
  ImportDeclaration importDeclaration = ast.newImportDeclaration();
  importDeclaration.setStatic(Flags.isStatic(this.flags));
  // split import name into individual fragments, checking for on demand imports
  char[][] charFragments = CharOperation.splitOn('.', importActualName.toCharArray(), 0, importActualName.length());
  int length = charFragments.length;
  String[] strFragments = new String[length];
  for (int i = 0; i < length; i++) {
    strFragments[i] = String.valueOf(charFragments[i]);
  }
  Name name = ast.newName(strFragments);
  importDeclaration.setName(name);
  if (onDemand) importDeclaration.setOnDemand(true);
  return importDeclaration;
}
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.dom.ImportDeclaration

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.