Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResource


    case IJavaElement.PACKAGE_FRAGMENT_ROOT:
      IPackageFragmentRoot root = (IPackageFragmentRoot)element;
      IPath rootPath = root.getPath();
      containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : rootPath;
      containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString();
      IResource rootResource = root.getResource();
      String projectPath = root.getJavaProject().getPath().toString();
      if (rootResource != null && rootResource.isAccessible()) {
        String relativePath = Util.relativePath(rootResource.getFullPath(), containerPath.segmentCount());
        add(projectPath, relativePath, containerPathToString, false/*not a package*/, null);
      } else {
        add(projectPath, "", containerPathToString, false/*not a package*/, null); //$NON-NLS-1$
      }
      break;
    case IJavaElement.PACKAGE_FRAGMENT:
      root = (IPackageFragmentRoot)element.getParent();
      projectPath = root.getJavaProject().getPath().toString();
      if (root.isArchive()) {
        String relativePath = Util.concatWith(((PackageFragment) element).names, '/');
        containerPath = root.getPath();
        containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString();
        add(projectPath, relativePath, containerPathToString, true/*package*/, null);
      } else {
        IResource resource = element.getResource();
        if (resource != null) {
          if (resource.isAccessible()) {
            containerPath = root.getKind() == IPackageFragmentRoot.K_SOURCE ? root.getParent().getPath() : root.getPath();
          } else {
            // for working copies, get resource container full path
            containerPath = resource.getParent().getFullPath();
          }
          containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString();
          String relativePath = Util.relativePath(resource.getFullPath(), containerPath.segmentCount());
          add(projectPath, relativePath, containerPathToString, true/*package*/, null);
        }
      }
      break;
    default:
View Full Code Here


    }
    method = type.getMethod(new String(bindingSelector), parameterTypes);
  }
  if (method == null || knownMethods.addIfNotIncluded(method) == null) return;

  IResource resource = type.getResource();
  IBinaryType info = null;
  if (isBinary) {
    if (resource == null)
      resource = type.getJavaProject().getProject();
    info = locator.getBinaryInfo((org.aspectj.org.eclipse.jdt.internal.core.ClassFile)type.getClassFile(), resource);
View Full Code Here

 
  // lookup - inside the container
  if (path.getDevice() == null) { // container relative paths should not contain a device
                        // (see http://dev.eclipse.org/bugs/show_bug.cgi?id=18684)
                        // (case of a workspace rooted at d:\ )
    IResource resource = container.findMember(path);
    if (resource != null){
      if (!checkResourceExistence ||resource.exists()) return resource;
      return null;
    }
  }
 
  // if path is relative, it cannot be an external path
View Full Code Here

  SimpleLookupTable dirTable = (SimpleLookupTable) directoryCache.get(qualifiedPackageName);
  if (dirTable == missingPackageHolder) return null; // package exists in another classpath directory or jar
  if (dirTable != null) return dirTable;

  try {
    IResource container = sourceFolder.findMember(qualifiedPackageName); // this is a case-sensitive check
    if (container instanceof IContainer) {
      IResource[] members = ((IContainer) container).members();
      dirTable = new SimpleLookupTable();
      for (int i = 0, l = members.length; i < l; i++) {
        IResource m = members[i];
        String name;
        if (m.getType() == IResource.FILE) {
          int index = Util.indexOfJavaLikeExtension(name = m.getName());
          if (index >= 0) {
            String fullPath = m.getFullPath().toString();
            if (!org.aspectj.org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) {
              dirTable.put(name.substring(0, index), m);
            }
          }
        }
View Full Code Here

   * Note that projects being deleted are checked in deleting(IProject).
   * In all cases, add the project's dependents to the list of projects to update
   * so that the classpath related markers can be updated.
   */
  private void checkProjectsBeingAddedOrRemoved(IResourceDelta delta) {
    IResource resource = delta.getResource();
    IResourceDelta[] children = null;
 
    switch (resource.getType()) {
      case IResource.ROOT :
        // workaround for bug 15168 circular errors not reported
        this.state.getOldJavaProjecNames(); // force list to be computed
        children = delta.getAffectedChildren();
        break;
View Full Code Here

        // element is moved
        addToParentInfo(element);
        close(element);
     
        IPath movedFromPath = delta.getMovedFromPath();
        IResource res = delta.getResource();
        IResource movedFromRes;
        if (res instanceof IFile) {
          movedFromRes = res.getWorkspace().getRoot().getFile(movedFromPath);
        } else {
          movedFromRes = res.getWorkspace().getRoot().getFolder(movedFromPath);
        }
View Full Code Here

    } else {
      // element is moved
      close(element);
      removeFromParentInfo(element);
      IPath movedToPath = delta.getMovedToPath();
      IResource res = delta.getResource();
      IResource movedToRes;
      switch (res.getType()) {
        case IResource.PROJECT:
          movedToRes = res.getWorkspace().getRoot().getProject(movedToPath.lastSegment());
          break;
        case IResource.FOLDER:
View Full Code Here

    while (this.currentElement != null) {
      IPath currentElementPath = null;
      if (this.currentElement instanceof IPackageFragmentRoot) {
        currentElementPath = ((IPackageFragmentRoot)this.currentElement).getPath();
      } else {
        IResource currentElementResource = this.currentElement.getResource();
        if (currentElementResource != null) {
          currentElementPath = currentElementResource.getFullPath();
        }
      }
      if (currentElementPath != null) {
        if (this.currentElement instanceof IPackageFragment
          && ((IPackageFragment) this.currentElement).isDefaultPackage()
View Full Code Here

     
      // get the workspace delta, and start processing there.
      IResourceDelta[] deltas = changes.getAffectedChildren();
      for (int i = 0; i < deltas.length; i++) {
        IResourceDelta delta = deltas[i];
        IResource res = delta.getResource();
       
        // find out the element type
        RootInfo rootInfo = null;
        int elementType;
        IProject proj = (IProject)res;
        boolean wasJavaProject = this.state.findJavaProject(proj.getName()) != null;
        boolean isJavaProject = JavaProject.hasJavaNature(proj);
        if (!wasJavaProject && !isJavaProject) {
          elementType = NON_JAVA_RESOURCE;
        } else {
          rootInfo = this.enclosingRootInfo(res.getFullPath(), delta.getKind());
          if (rootInfo != null && rootInfo.isRootOfProject(res.getFullPath())) {
            elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT;
          } else {
            elementType = IJavaElement.JAVA_PROJECT;
          }
        }
View Full Code Here

   * @see IResource
   */
  public void resourceChanged(IResourceChangeEvent event) {

    int eventType = this.overridenEventType == -1 ? event.getType() : this.overridenEventType;
    IResource resource = event.getResource();
    IResourceDelta delta = event.getDelta();
   
    switch(eventType){
      case IResourceChangeEvent.PRE_DELETE :
        try {
          if(resource.getType() == IResource.PROJECT
            && ((IProject) resource).hasNature(JavaCore.NATURE_ID)) {
             
            deleting((IProject)resource);
          }
        } catch(CoreException e){
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.