Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResource


  }
  public boolean execute(IProgressMonitor progressMonitor) {

    if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) return true;
    if (!project.isAccessible()) return true; // nothing to do
    IResource folder = this.project.getParent().findMember(this.folderPath);
    if (folder == null || folder.getType() == IResource.FILE) return true; // nothing to do, source folder was removed

    /* ensure no concurrent write access to index */
    Index index = this.manager.getIndex(this.containerPath, true, /*reuse index file*/ true /*create if none*/);
    if (index == null) return true;
    ReadWriteMonitor monitor = index.monitor;
    if (monitor == null) return true; // index got deleted since acquired

    try {
      monitor.enterRead(); // ask permission to read

      final IPath container = this.containerPath;
      final IndexManager indexManager = this.manager;
      final SourceElementParser parser = indexManager.getSourceElementParser(JavaCore.create(this.project), null/*requestor will be set by indexer*/);
      if (this.exclusionPatterns == null && this.inclusionPatterns == null) {
        folder.accept(
          new IResourceProxyVisitor() {
            public boolean visit(IResourceProxy proxy) /* throws CoreException */{
              if (proxy.getType() == IResource.FILE) {
                if (org.aspectj.org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName()))
                  indexManager.addSource((IFile) proxy.requestResource(), container, parser);
                return false;
              }
              return true;
            }
          },
          IResource.NONE
        );
      } else {
        folder.accept(
          new IResourceProxyVisitor() {
            public boolean visit(IResourceProxy proxy) /* throws CoreException */{
              switch(proxy.getType()) {
                case IResource.FILE :
                  if (org.aspectj.org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName())) {
                    IResource resource = proxy.requestResource();
                    if (!Util.isExcluded(resource, inclusionPatterns, exclusionPatterns))
                      indexManager.addSource((IFile)resource, container, parser);
                  }
                  return false;
                case IResource.FOLDER :
View Full Code Here


   */
  private void collectAllSubfolders(IFolder folder, ArrayList collection) throws JavaModelException {
    try {
      IResource[] members= folder.members();
      for (int i = 0, max = members.length; i < max; i++) {
        IResource r= members[i];
        if (r.getType() == IResource.FOLDER) {
          collection.add(r);
          collectAllSubfolders((IFolder)r, collection);
        }
      } 
    } catch (CoreException e) {
View Full Code Here

  private ArrayList determineAffectedPackageFragments(IPath location) throws JavaModelException {
    ArrayList fragments = new ArrayList();
 
    // see if this will cause any package fragments to be affected
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IResource resource = null;
    if (location != null) {
      resource = workspace.getRoot().findMember(location);
    }
    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];
View Full Code Here

    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

      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

   * progress reporting.
   */
  public abstract String getMainTaskName();

  protected ISchedulingRule getSchedulingRule() {
    IResource resource = getCompilationUnit().getResource();
    IWorkspace workspace = resource.getWorkspace();
    return workspace.getRuleFactory().modifyRule(resource);
  }
View Full Code Here

        displayed++;
        continue; // match is outside classpath
      }

      // create new parser and lookup environment if this is a new project
      IResource resource = null;
      JavaProject javaProject = (JavaProject) openable.getJavaProject();
      resource = workingCopy != null ? workingCopy.getResource() : openable.getResource();
      if (resource == null)
        resource = javaProject.getProject(); // case of a file in an external jar
      if (!javaProject.equals(previousJavaProject)) {
View Full Code Here

      // Report matches avoiding duplicate names
      for (int p=0; p<pLength; p++) {
        IPackageFragment fragment = packageFragments[p];
        if (packages.addIfNotIncluded(fragment) == null) continue;
        if (encloses(fragment)) {
          IResource resource = fragment.getResource();
          if (resource == null) // case of a file in an external jar
            resource = javaProject.getProject();
          try {
            if (encloses(fragment)) {
              SearchMatch match = new PackageDeclarationMatch(fragment, SearchMatch.A_ACCURATE, -1, -1, participant, resource);
View Full Code Here

    Binding binding,
    int accuracy,
    int offset, 
    int length) {
  SearchParticipant participant = getParticipant();
  IResource resource = this.currentPossibleMatch.resource;
  return newDeclarationMatch(element, binding, accuracy, offset, length, participant, resource);
}
View Full Code Here

  boolean isCoupoundAssigned = (bits & ASTNode.IsCompoundAssigned) != 0;
  boolean isReadAccess = isCoupoundAssigned || (bits & ASTNode.IsStrictlyAssigned) == 0;
  boolean isWriteAccess = isCoupoundAssigned || (bits & ASTNode.IsStrictlyAssigned) != 0;
  boolean insideDocComment = (bits & ASTNode.InsideJavadoc) != 0;
  SearchParticipant participant = getParticipant();
  IResource resource = this.currentPossibleMatch.resource;
  if (enclosingBinding != null)
    enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
  return new FieldReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
}
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IResource

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.