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

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


    Object target,
    IJavaProject[] projects) {
    for (int i= 0, projectCount= projects.length; i < projectCount; i++) {
      try {
        JavaProject javaProject= (JavaProject)projects[i];
        IClasspathEntry classpathEnty = javaProject.getClasspathEntryFor(jarPath);
        if (classpathEnty != null) {
          if (target instanceof IFile) {
            // internal jar
            return javaProject.getPackageFragmentRoot((IFile)target);
          } else {
View Full Code Here


   */
  private int classpathContains(IClasspathEntry[] list, IClasspathEntry entry) {
    IPath[] exclusionPatterns = entry.getExclusionPatterns();
    IPath[] inclusionPatterns = entry.getInclusionPatterns();
    nextEntry: for (int i = 0; i < list.length; i++) {
      IClasspathEntry other = list[i];
      if (other.getContentKind() == entry.getContentKind()
        && other.getEntryKind() == entry.getEntryKind()
        && other.isExported() == entry.isExported()
        && other.getPath().equals(entry.getPath())) {
          // check custom outputs
          IPath entryOutput = entry.getOutputLocation();
          IPath otherOutput = other.getOutputLocation();
          if (entryOutput == null) {
            if (otherOutput != null)
              continue;
          } else {
            if (!entryOutput.equals(otherOutput))
              continue;
          }
         
          // check inclusion patterns
          IPath[] otherIncludes = other.getInclusionPatterns();
          if (inclusionPatterns != otherIncludes) {
              if (inclusionPatterns == null) continue;
            int includeLength = inclusionPatterns.length;
            if (otherIncludes == null || otherIncludes.length != includeLength)
              continue;
            for (int j = 0; j < includeLength; j++) {
              // compare toStrings instead of IPaths
              // since IPath.equals is specified to ignore trailing separators
              if (!inclusionPatterns[j].toString().equals(otherIncludes[j].toString()))
                continue nextEntry;
            }
          }
          // check exclusion patterns
          IPath[] otherExcludes = other.getExclusionPatterns();
          if (exclusionPatterns != otherExcludes) {
              if (exclusionPatterns == null) continue;
            int excludeLength = exclusionPatterns.length;
            if (otherExcludes == null || otherExcludes.length != excludeLength)
              continue;
View Full Code Here

    if (resource != null && resource.getType() == IResource.FOLDER) {
      IFolder folder = (IFolder) resource;
      // only changes if it actually existed
      IClasspathEntry[] classpath = this.project.getExpandedClasspath();
      for (int i = 0; i < classpath.length; i++) {
        IClasspathEntry entry = classpath[i];
        IPath path = classpath[i].getPath();
        if (entry.getEntryKind() != IClasspathEntry.CPE_PROJECT && path.isPrefixOf(location) && !path.equals(location)) {
          IPackageFragmentRoot[] roots = this.project.computePackageFragmentRoots(classpath[i]);
          PackageFragmentRoot root = (PackageFragmentRoot) roots[0];
          // now the output location becomes a package fragment - along with any subfolders
          ArrayList folders = new ArrayList();
          folders.add(folder);
View Full Code Here

          continue;
        }

        // Remove the .java files from the index for a source folder
        // For a lib folder or a .jar file, remove the corresponding index if not shared.
        IClasspathEntry oldEntry = this.oldResolvedClasspath[i];
        final IPath path = oldEntry.getPath();
        int changeKind = this.oldResolvedClasspath[i].getEntryKind();
        switch (changeKind) {
          case IClasspathEntry.CPE_SOURCE:
            char[][] inclusionPatterns = ((ClasspathEntry)oldEntry).fullInclusionPatternChars();
            char[][] exclusionPatterns = ((ClasspathEntry)oldEntry).fullExclusionPatternChars();
            indexManager.removeSourceFolderFromIndex(this.project, path, inclusionPatterns, exclusionPatterns);
            break;
          case IClasspathEntry.CPE_LIBRARY:
            if (state.otherRoots.get(path) == null) { // if root was not shared
              indexManager.discardJobs(path.toString());
              indexManager.removeIndex(path);
              // TODO (kent) we could just remove the in-memory index and have the indexing check for timestamps
            }
            break;
        }
      }
    }

    for (int i = 0; i < newLength; i++) {
      int index = classpathContains(this.oldResolvedClasspath, newResolvedClasspath[i]);
      if (index == -1) {
        // remote projects are not indexed in this project
        if (newResolvedClasspath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT){
          continue;
        }
       
        // Request indexing
        int entryKind = newResolvedClasspath[i].getEntryKind();
        switch (entryKind) {
          case IClasspathEntry.CPE_LIBRARY:
            boolean pathHasChanged = true;
            IPath newPath = newResolvedClasspath[i].getPath();
            for (int j = 0; j < oldLength; j++) {
              IClasspathEntry oldEntry = this.oldResolvedClasspath[j];
              if (oldEntry.getPath().equals(newPath)) {
                pathHasChanged = false;
                break;
              }
            }
            if (pathHasChanged) {
              indexManager.indexLibrary(newPath, this.project.getProject());
            }
            break;
          case IClasspathEntry.CPE_SOURCE:
            IClasspathEntry entry = newResolvedClasspath[i];
            IPath path = entry.getPath();
            char[][] inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars();
            char[][] exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars();
            indexManager.indexSourceFolder(this.project, path, inclusionPatterns, exclusionPatterns);
            break;
        }
View Full Code Here

    buffer.append("SetClasspathOperation\n"); //$NON-NLS-1$
    buffer.append(" - classpath : "); //$NON-NLS-1$
    buffer.append("{"); //$NON-NLS-1$
    for (int i = 0; i < this.newRawClasspath.length; i++) {
      if (i > 0) buffer.append(","); //$NON-NLS-1$
      IClasspathEntry element = this.newRawClasspath[i];
      buffer.append(" ").append(element.toString()); //$NON-NLS-1$
    }
    buffer.append("\n - output location : ")//$NON-NLS-1$
    buffer.append(this.newOutputLocation.toString());
    return buffer.toString();
  }
View Full Code Here

  IClasspathEntry[] entries = javaProject.getResolvedClasspath();
  IJavaModel model = javaProject.getJavaModel();
  JavaModelManager.PerProjectInfo perProjectInfo = javaProject.getPerProjectInfo();
  for (int i = 0, length = entries.length; i < length; i++) {
    IClasspathEntry entry = entries[i];
    AccessRuleSet access = null;
    ClasspathEntry cpEntry = (ClasspathEntry) entry;
    if (referringEntry != null) {
      // Add only exported entries.
      // Source folder are implicitly exported.
      if (!entry.isExported() && entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) continue;
      cpEntry = cpEntry.combineWith((ClasspathEntry)referringEntry);
//        cpEntry = ((ClasspathEntry)referringEntry).combineWith(cpEntry);
    }
    access = cpEntry.getAccessRuleSet();
    switch (entry.getEntryKind()) {
      case IClasspathEntry.CPE_LIBRARY:
        IClasspathEntry rawEntry = null;
        Map rootPathToRawEntries = perProjectInfo.rootPathToRawEntries;
        if (rootPathToRawEntries != null) {
          rawEntry = (IClasspathEntry) rootPathToRawEntries.get(entry.getPath());
        }
        if (rawEntry == null) break;
        switch (rawEntry.getEntryKind()) {
          case IClasspathEntry.CPE_LIBRARY:
          case IClasspathEntry.CPE_VARIABLE:
            if ((includeMask & APPLICATION_LIBRARIES) != 0) {
              IPath path = entry.getPath();
              if (pathToAdd == null || pathToAdd.equals(path)) {
                String pathToString = path.getDevice() == null ? path.toString() : path.toOSString();
                add(projectPath.toString(), "", pathToString, false/*not a package*/, access); //$NON-NLS-1$
                addEnclosingProjectOrJar(path);
              }
            }
            break;
          case IClasspathEntry.CPE_CONTAINER:
            IClasspathContainer container = JavaCore.getClasspathContainer(rawEntry.getPath(), javaProject);
            if (container == null) break;
            if ((container.getKind() == IClasspathContainer.K_APPLICATION && (includeMask & APPLICATION_LIBRARIES) != 0)
                || (includeMask & SYSTEM_LIBRARIES) != 0) {
              IPath path = entry.getPath();
              if (pathToAdd == null || pathToAdd.equals(path)) {
View Full Code Here

    // projectOrJarPath is a jar
    // it can see the focus only if it is on the classpath of a project that can see the focus
    IJavaProject[] allProjects = model.getJavaProjects();
    for (int i = 0, length = allProjects.length; i < length; i++) {
      JavaProject otherProject = (JavaProject) allProjects[i];
      IClasspathEntry entry = otherProject.getClasspathEntryFor(projectOrJarPath);
      if (entry != null
          && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY
          && canSeeFocus(focus, otherProject, focusEntries))
        return true;
    }
    return false;
  } catch (JavaModelException e) {
View Full Code Here

    if (focusEntriesForPolymorphicSearch != null) {
      // look for refering project
      IPath projectPath = javaProject.getProject().getFullPath();
      for (int i = 0, length = focusEntriesForPolymorphicSearch.length; i < length; i++) {
        IClasspathEntry entry = focusEntriesForPolymorphicSearch[i];
        if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.getPath().equals(projectPath))
          return true;
      }
    }
    if (focus instanceof JarPackageFragmentRoot) {
      // focus is part of a jar
      IPath focusPath = focus.getPath();
      IClasspathEntry[] entries = javaProject.getExpandedClasspath();
      for (int i = 0, length = entries.length; i < length; i++) {
        IClasspathEntry entry = entries[i];
        if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath().equals(focusPath))
          return true;
      }
      return false;
    }
    // look for dependent projects
    IPath focusPath = ((JavaProject) focus).getProject().getFullPath();
    IClasspathEntry[] entries = javaProject.getExpandedClasspath();
    for (int i = 0, length = entries.length; i < length; i++) {
      IClasspathEntry entry = entries[i];
      if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.getPath().equals(focusPath))
        return true;
    }
    return false;
  } catch (JavaModelException e) {
    return false;
View Full Code Here

        }
      }
      for (int i = 0; i < projectIndex && jarsToCheck.elementSize > 0; i++) {
        IClasspathEntry[] entries = projectsCanSeeFocus[i].getResolvedClasspath();
        for (int j = entries.length; --j >= 0;) {
          IClasspathEntry entry = entries[j];
          if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            IPath path = entry.getPath();
            if (jarsToCheck.includes(path)) {
              locations.add(manager.computeIndexLocation(entry.getPath()));
              jarsToCheck.remove(path);
            }
          }
        }
      }
      // jar files can be included in the search scope without including one of the projects that references them, so scan all projects that have not been visited
      if (jarsToCheck.elementSize > 0) {
        IJavaProject[] allProjects = model.getJavaProjects();
        for (int i = 0, l = allProjects.length; i < l && jarsToCheck.elementSize > 0; i++) {
          JavaProject project = (JavaProject) allProjects[i];
          if (!visitedProjects.includes(project)) {
            IClasspathEntry[] entries = project.getResolvedClasspath();
            for (int j = entries.length; --j >= 0;) {
              IClasspathEntry entry = entries[j];
              if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
                IPath path = entry.getPath();
                if (jarsToCheck.includes(path)) {
                  locations.add(manager.computeIndexLocation(entry.getPath()));
                  jarsToCheck.remove(path);
                }
              }
            }
          }
View Full Code Here

          return (IPackageFragment) fromFactory;
        case IJavaElement.JAVA_PROJECT:
          // default package in a default root
          JavaProject project = (JavaProject) fromFactory;
          try {
            IClasspathEntry entry = project.getClasspathEntryFor(path);
            if (entry != null) {
              IPackageFragmentRoot root =
                project.getPackageFragmentRoot(project.getResource());
              Object defaultPkgRoot = this.packageFragments.get(CharOperation.NO_STRINGS);
              if (defaultPkgRoot == null) {
View Full Code Here

TOP

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

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.