Examples of IResource


Examples of org.eclipse.core.resources.IResource

        } else {
          // create binary type from file
          if (classFile.getPackageFragmentRoot().isArchive()) {
            binaryType = this.builder.createInfoFromClassFileInJar(classFile);
          } else {
            IResource file = classFile.getResource();
            binaryType = this.builder.createInfoFromClassFile(classFile, file);
          }
        }
        if (binaryType != null) {
          try {
View Full Code Here

Examples of org.eclipse.core.resources.IResource

  protected String getMainTaskName() {
    return Messages.operation_deleteElementProgress;
  }
  protected ISchedulingRule getSchedulingRule() {
    if (this.elementsToProcess != null && this.elementsToProcess.length == 1) {
      IResource resource = this.elementsToProcess[0].getResource();
      if (resource != null)
        return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(resource);
    }
    return super.getSchedulingRule();
  }
View Full Code Here

Examples of org.eclipse.core.resources.IResource

    if (length > 0) {
      IJavaProject project = getJavaProject();
      String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
      String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
      for (int i = 0; i < length; i++) {
        IResource child = members[i];
        if (child.getType() != IResource.FOLDER
            && !Util.isExcluded(child, inclusionPatterns, exclusionPatterns)) {
          IJavaElement childElement;
          if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName(), sourceLevel, complianceLevel)) {
            childElement = new CompilationUnit(this, child.getName(), DefaultWorkingCopyOwner.PRIMARY);
            vChildren.add(childElement);
          } else if (kind == IPackageFragmentRoot.K_BINARY && Util.isValidClassFileName(child.getName(), sourceLevel, complianceLevel)) {
            childElement = getClassFile(child.getName());
            vChildren.add(childElement);
          }
        }
      }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IResource

}
/**
* @see IJavaElement#getUnderlyingResource()
*/
public IResource getUnderlyingResource() throws JavaModelException {
  IResource rootResource = this.parent.getUnderlyingResource();
  if (rootResource == null) {
    //jar package fragment root that has no associated resource
    return null;
  }
  // the underlying resource may be a folder or a project (in the case that the project folder
  // is atually the package fragment root)
  if (rootResource.getType() == IResource.FOLDER || rootResource.getType() == IResource.PROJECT) {
    IContainer folder = (IContainer) rootResource;
    String[] segs = this.names;
    for (int i = 0; i < segs.length; ++i) {
      IResource child = folder.findMember(segs[i]);
      if (child == null || child.getType() != IResource.FOLDER) {
        throw newNotPresentException();
      }
      folder = (IFolder) child;
    }
    return folder;
View Full Code Here

Examples of org.eclipse.core.resources.IResource

      if (length > 0) {
        String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
        String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
        IClasspathEntry[] classpath = project.getResolvedClasspath();
        for (int i = 0; i < length; i++) {
          IResource res = members[i];
          switch (res.getType()) {
            case IResource.FILE :
              IPath resFullPath = res.getFullPath();
              String resName = res.getName();
           
              // ignore a jar file on the classpath
              if (isClasspathResolved && org.aspectj.org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(resName) && this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) {
                break;
              }
              // ignore .java file if src == project
              if (srcIsProject
                  && Util.isValidCompilationUnitName(resName, sourceLevel, complianceLevel)
                  && !Util.isExcluded(res, inclusionPatterns, exclusionPatterns)) {
                break;
              }
              // ignore .class file if bin == project
              if (binIsProject && Util.isValidClassFileName(resName, sourceLevel, complianceLevel)) {
                break;
              }
              // else add non java resource
              if (resources.length == resourcesCounter) {
                // resize
                System.arraycopy(
                    resources,
                    0,
                    (resources = new IResource[resourcesCounter * 2]),
                    0,
                    resourcesCounter);
              }
              resources[resourcesCounter++] = res;
              break;
            case IResource.FOLDER :
              resFullPath = res.getFullPath();
           
              // ignore non-excluded folders on the classpath or that correspond to an output location
              if ((srcIsProject && !Util.isExcluded(res, inclusionPatterns, exclusionPatterns) && Util.isValidFolderNameForPackage(res.getName(), sourceLevel, complianceLevel))
                  || (isClasspathResolved && this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput))) {
                break;
              }
              // else add non java resource
              if (resources.length == resourcesCounter) {
View Full Code Here

Examples of org.eclipse.core.resources.IResource

   */
  protected CompilationUnit getCompilationUnit() {
    return (CompilationUnit)getElementToProcess();
  }
  protected ISchedulingRule getSchedulingRule() {
    IResource resource = getElementToProcess().getResource();
    if (resource == null) return null;
    IWorkspace workspace = resource.getWorkspace();
    if (resource.exists()) {
      return workspace.getRuleFactory().modifyRule(resource);
    } else {
      return workspace.getRuleFactory().createRule(resource);
    }
  }
View Full Code Here

Examples of org.eclipse.core.resources.IResource

      IWorkspaceRoot root = this.project.getWorkspace().getRoot();
      for (int i = 0; i < sourceEntriesNumber; i++) {
        if (this.isCancelled) return false;

        IClasspathEntry entry = sourceEntries[i];
        IResource sourceFolder = root.findMember(entry.getPath());
        if (sourceFolder != null) {
         
          // collect output locations if source is project (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32041)
          final HashSet outputs = new HashSet();
          if (sourceFolder.getType() == IResource.PROJECT) {
            // Do not create marker while getting output location (see bug 41859)
            outputs.add(javaProject.getOutputLocation());
            for (int j = 0; j < sourceEntriesNumber; j++) {
              IPath output = sourceEntries[j].getOutputLocation();
              if (output != null) {
                outputs.add(output);
              }
            }
          }
          final boolean hasOutputs = !outputs.isEmpty();
         
          final char[][] inclusionPatterns = ((ClasspathEntry) entry).fullInclusionPatternChars();
          final char[][] exclusionPatterns = ((ClasspathEntry) entry).fullExclusionPatternChars();
          if (max == 0) {
            sourceFolder.accept(
              new IResourceProxyVisitor() {
                public boolean visit(IResourceProxy proxy) {
                  if (isCancelled) return false;
                  switch(proxy.getType()) {
                    case IResource.FILE :
                      if (org.aspectj.org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName())) {
                        IFile file = (IFile) proxy.requestResource();
                        if (exclusionPatterns != null || inclusionPatterns != null)
                          if (Util.isExcluded(file, inclusionPatterns, exclusionPatterns))
                            return false;
                        indexedFileNames.put(Util.relativePath(file.getFullPath(), 1/*remove project segment*/), file);
                      }
                      return false;
                    case IResource.FOLDER :
                      if (exclusionPatterns != null && inclusionPatterns == null) {
                        // if there are inclusion patterns then we must walk the children
                        if (Util.isExcluded(proxy.requestFullPath(), inclusionPatterns, exclusionPatterns, true))
                            return false;
                      }
                      if (hasOutputs && outputs.contains(proxy.requestFullPath()))
                        return false;
                  }
                  return true;
                }
              },
              IResource.NONE
            );
          } else {
            sourceFolder.accept(
              new IResourceProxyVisitor() {
                public boolean visit(IResourceProxy proxy) throws CoreException {
                  if (isCancelled) return false;
                  switch(proxy.getType()) {
                    case IResource.FILE :
View Full Code Here

Examples of org.eclipse.core.resources.IResource

  char[] bindingName = fieldBinding.name;
  IField field = type.getField(new String(bindingName));
  if (knownFields.addIfNotIncluded(field) == null) return;

  IResource resource = type.getResource();
  boolean isBinary = type.isBinary();
  IBinaryType info = null;
  if (isBinary) {
    if (resource == null)
      resource = type.getJavaProject().getProject();
View Full Code Here

Examples of org.eclipse.core.resources.IResource

}
protected void reportDeclaration(ReferenceBinding typeBinding, int maxType, MatchLocator locator, SimpleSet knownTypes) throws CoreException {
  IType type = locator.lookupType(typeBinding);
  if (type == null) return; // case of a secondary type

  IResource resource = type.getResource();
  boolean isBinary = type.isBinary();
  IBinaryType info = null;
  if (isBinary) {
    if (resource == null)
      resource = type.getJavaProject().getProject();
View Full Code Here

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
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.