Examples of IPackageFragmentRoot


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

    if (rootIDs.contains(rootID)) return;

    IPath projectPath = this.project.getFullPath();
    IPath entryPath = resolvedEntry.getPath();
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IPackageFragmentRoot root = null;
   
    switch(resolvedEntry.getEntryKind()){
     
      // source folder
      case IClasspathEntry.CPE_SOURCE :
View Full Code Here

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

    IPackageFragmentRoot[] allRoots = this.getAllPackageFragmentRoots();
    if (!path.isAbsolute()) {
      throw new IllegalArgumentException(Messages.path_mustBeAbsolute);
    }
    for (int i= 0; i < allRoots.length; i++) {
      IPackageFragmentRoot classpathRoot= allRoots[i];
      if (classpathRoot.getPath().equals(path)) {
        return classpathRoot;
      }
    }
    return null;
  }
View Full Code Here

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

   */
  public IPackageFragment[] getPackageFragmentsInRoots(IPackageFragmentRoot[] roots) {

    ArrayList frags = new ArrayList();
    for (int i = 0; i < roots.length; i++) {
      IPackageFragmentRoot root = roots[i];
      try {
        IJavaElement[] rootFragments = root.getChildren();
        for (int j = 0; j < rootFragments.length; j++) {
          frags.add(rootFragments[j]);
        }
      } catch (JavaModelException e) {
        // do nothing
View Full Code Here

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

        ((JavaProject) project).getPackageFragmentRoots();
      if (devPathRoots == null) {
        return;
      }
      for (int j = 0; j < devPathRoots.length; j++) {
        IPackageFragmentRoot root = devPathRoots[j];
        injectAllOpenablesForPackageFragmentRoot(root, openables);
      }
    } catch (JavaModelException e) {
      // ignore
    }
View Full Code Here

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

  private void injectAllOpenablesForPackageFragment(
    IPackageFragment packFrag,
    ArrayList openables) {
     
    try {
      IPackageFragmentRoot root = (IPackageFragmentRoot) packFrag.getParent();
      int kind = root.getKind();
      if (kind != 0) {
        boolean isSourcePackageFragment = (kind == IPackageFragmentRoot.K_SOURCE);
        if (isSourcePackageFragment) {
          ICompilationUnit[] cus = packFrag.getCompilationUnits();
          for (int i = 0, length = cus.length; i < length; i++) {
View Full Code Here

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

  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  if (classFile.isOpen())
    return (ClassFileReader) manager.getInfo(type);

  PackageFragment pkg = (PackageFragment) type.getPackageFragment();
  IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent();
  try {
    if (!root.isArchive())
      return Util.newClassFileReader(type.getResource());

    ZipFile zipFile = null;
    try {
      IPath zipPath = root.getPath();
      if (JavaModelManager.ZIP_ACCESS_VERBOSE)
        System.out.println("(" + Thread.currentThread() + ") [MatchLocator.classFileReader()] Creating ZipFile on " + zipPath); //$NON-NLS-1$  //$NON-NLS-2$
      zipFile = manager.getZipFile(zipPath);
      String classFileName = classFile.getElementName();
      String path = Util.concatWith(pkg.names, classFileName, '/');
View Full Code Here

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

   * @see org.aspectj.org.eclipse.jdt.internal.compiler.env.IDependent#getFileName()
   */
  private IPackageFragment getPackageFragment(char[] fileName, int pkgEnd, int jarSeparator) {
    if (jarSeparator != -1) {
      String jarMemento = new String(fileName, 0, jarSeparator);
      IPackageFragmentRoot root = (IPackageFragmentRoot) JavaCore.create(jarMemento);
      if (pkgEnd == jarSeparator)
        return root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
      char[] pkgName = CharOperation.subarray(fileName, jarSeparator+1, pkgEnd);
      CharOperation.replace(pkgName, '/', '.');
      return root.getPackageFragment(new String(pkgName));
    } else {
      Path path = new Path(new String(fileName, 0, pkgEnd));
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
      IContainer folder = path.segmentCount() == 1 ? workspaceRoot.getProject(path.lastSegment()) : (IContainer) workspaceRoot.getFolder(path);
      IJavaElement element = JavaCore.create(folder);
      if (element == null) return null;
      switch (element.getElementType()) {
        case IJavaElement.PACKAGE_FRAGMENT:
          return (IPackageFragment) element;
        case IJavaElement.PACKAGE_FRAGMENT_ROOT:
          return ((IPackageFragmentRoot) element).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
        case IJavaElement.JAVA_PROJECT:
          IPackageFragmentRoot root = ((IJavaProject) element).getPackageFragmentRoot(folder);
          if (root == null) return null;
          return root.getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
      }
      return null;
    }
  }
View Full Code Here

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

  /*
   * Same than LocalVariablePattern.
   */
  public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor progressMonitor) {
      IPackageFragmentRoot root = (IPackageFragmentRoot) this.typeParameter.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
    String documentPath;
    String relativePath;
      if (root.isArchive()) {
         IType type = (IType) this.typeParameter.getAncestor(IJavaElement.TYPE);
          relativePath = (type.getFullyQualifiedName('/')).replace('.', '/') + SuffixConstants.SUFFIX_STRING_class;
          documentPath = root.getPath() + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + relativePath;
      } else {
      IPath path = this.typeParameter.getPath();
          documentPath = path.toString();
      relativePath = Util.relativePath(path, 1/*remove project segment*/);
      }
View Full Code Here

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

      int rootPathLength;
      if (this.lastPkgFragmentRootPath == null
          || (rootPathLength = this.lastPkgFragmentRootPath.length()) != resourcePath.length()
          || !resourcePath.regionMatches(0, this.lastPkgFragmentRootPath, 0, rootPathLength)) {
        String jarPath= resourcePath.substring(0, separatorIndex);
        IPackageFragmentRoot root= this.getJarPkgFragmentRoot(jarPath, scope);
        if (root == null)
          return null; // match is outside classpath
        this.lastPkgFragmentRootPath= jarPath;
        this.lastPkgFragmentRoot= root;
        this.packageHandles= new HashtableOfArrayToObject(5);
      }
      // create handle
      String classFilePath= resourcePath.substring(separatorIndex + 1);
      String[] simpleNames = new Path(classFilePath).segments();
      String[] pkgName;
      int length = simpleNames.length-1;
      if (length > 0) {
        pkgName = new String[length];
        System.arraycopy(simpleNames, 0, pkgName, 0, length);
      } else {
        pkgName = CharOperation.NO_STRINGS;
      }
      IPackageFragment pkgFragment= (IPackageFragment) this.packageHandles.get(pkgName);
      if (pkgFragment == null) {
        pkgFragment= ((PackageFragmentRoot) this.lastPkgFragmentRoot).getPackageFragment(pkgName);
        this.packageHandles.put(pkgName, pkgFragment);
      }
      IClassFile classFile= pkgFragment.getClassFile(simpleNames[length]);
      return (Openable) classFile;
    } else {
      // path to a file in a directory
      // Optimization: cache package fragment root handle and package handles
      int rootPathLength = -1;
      if (this.lastPkgFragmentRootPath == null
        || !(resourcePath.startsWith(this.lastPkgFragmentRootPath)
          && (rootPathLength = this.lastPkgFragmentRootPath.length()) > 0
          && resourcePath.charAt(rootPathLength) == '/')) {
        IPackageFragmentRoot root= this.getPkgFragmentRoot(resourcePath);
        if (root == null)
          return null; // match is outside classpath
        this.lastPkgFragmentRoot = root;
        this.lastPkgFragmentRootPath = this.lastPkgFragmentRoot.getPath().toString();
        this.packageHandles = new HashtableOfArrayToObject(5);
View Full Code Here

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

        }
      }
      if (index < length) {
        System.arraycopy(projects, 0, projects = new IJavaProject[index], 0, index);
      }
      IPackageFragmentRoot root = getJarPkgFragmentRoot(jarPath, target, projects);
      if (root != null) {
        return root;
      }
    }
   
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.