Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResource


    IResourceDelta delta,
    int elementType,
    RootInfo rootInfo,
    OutputsInfo outputsInfo) {
     
    IResource res = delta.getResource();
 
    // set stack of elements
    if (this.currentElement == null && rootInfo != null) {
      this.currentElement = rootInfo.project;
    }
   
    // process current delta
    boolean processChildren = true;
    if (res instanceof IProject) {
      // reset source element parser cache
      this.sourceElementParserCache = null;
     
      processChildren =
        this.updateCurrentDeltaAndIndex(
          delta,
          elementType == IJavaElement.PACKAGE_FRAGMENT_ROOT ?
            IJavaElement.JAVA_PROJECT : // case of prj=src
            elementType,
          rootInfo);
    } else if (rootInfo != null) {
      processChildren = this.updateCurrentDeltaAndIndex(delta, elementType, rootInfo);
    } else {
      // not yet inside a package fragment root
      processChildren = true;
    }
   
    // get the project's output locations and traverse mode
    if (outputsInfo == null) outputsInfo = this.outputsInfo(rootInfo, res);
 
    // process children if needed
    if (processChildren) {
      IResourceDelta[] children = delta.getAffectedChildren();
      boolean oneChildOnClasspath = false;
      int length = children.length;
      IResourceDelta[] orphanChildren = null;
      Openable parent = null;
      boolean isValidParent = true;
      for (int i = 0; i < length; i++) {
        IResourceDelta child = children[i];
        IResource childRes = child.getResource();
 
        // check source attachment change
        this.checkSourceAttachmentChange(child, childRes);
       
        // find out whether the child is a package fragment root of the current project
        IPath childPath = childRes.getFullPath();
        int childKind = child.getKind();
        RootInfo childRootInfo = this.rootInfo(childPath, childKind);
        if (childRootInfo != null && !childRootInfo.isRootOfProject(childPath)) {
          // package fragment root of another project (dealt with later)
          childRootInfo = null;
View Full Code Here


      } // else resource delta will be added by parent
    } // else resource delta will be added by parent
  }

  private void validateClasspaths(IResourceDelta delta, HashSet affectedProjects) {
    IResource resource = delta.getResource();
    boolean processChildren = false;
    switch (resource.getType()) {
      case IResource.ROOT :
        if (delta.getKind() == IResourceDelta.CHANGED) {
          processChildren = true;
        }
        break;
View Full Code Here

   */
  public boolean updateCurrentDeltaAndIndex(IResourceDelta delta, int elementType, RootInfo rootInfo) {
    Openable element;
    switch (delta.getKind()) {
      case IResourceDelta.ADDED :
        IResource deltaRes = delta.getResource();
        element = createElement(deltaRes, elementType, rootInfo);
        if (element == null) {
          // resource might be containing shared roots (see bug 19058)
          this.state.updateRoots(deltaRes.getFullPath(), delta, this);
          return rootInfo != null && rootInfo.inclusionPatterns != null;
        }
        updateIndex(element, delta);
        elementAdded(element, delta, rootInfo);
        if (elementType == IJavaElement.PACKAGE_FRAGMENT_ROOT)
          this.state.addClasspathValidation(rootInfo.project);
        return elementType == IJavaElement.PACKAGE_FRAGMENT;
      case IResourceDelta.REMOVED :
        deltaRes = delta.getResource();
        element = createElement(deltaRes, elementType, rootInfo);
        if (element == null) {
          // resource might be containing shared roots (see bug 19058)
          this.state.updateRoots(deltaRes.getFullPath(), delta, this);
          return rootInfo != null && rootInfo.inclusionPatterns != null;
        }
        updateIndex(element, delta);
        elementRemoved(element, delta, rootInfo);
        if (elementType == IJavaElement.PACKAGE_FRAGMENT_ROOT)
          this.state.addClasspathValidation(rootInfo.project);
 
        if (deltaRes.getType() == IResource.PROJECT){     
          // reset the corresponding project built state, since cannot reuse if added back
          if (JavaBuilder.DEBUG)
            System.out.println("Clearing last state for removed project : " + deltaRes); //$NON-NLS-1$
          this.manager.setLastBuiltState((IProject)deltaRes, null /*no state*/);
         
 
View Full Code Here

              rootInfo == null // if null, defaults to source
              || rootInfo.entryKind == IClasspathEntry.CPE_SOURCE;
            IResourceDelta[] children = delta.getAffectedChildren();
            for (int i = 0, length = children.length; i < length; i++) {
              IResourceDelta child = children[i];
              IResource resource = child.getResource();
              // TODO (philippe) Why do this? Every child is added anyway as the delta is walked
              if (resource instanceof IFile) {
                String name = resource.getName();
                if (isSource) {
                  if (org.aspectj.org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(name)) {
                    Openable cu = (Openable)pkg.getCompilationUnit(name);
                    this.updateIndex(cu, child);
                  }
View Full Code Here

    Openable pkg = root.getPackageFragment(pkgName);
    this.updateIndex(pkg, delta);
    IResourceDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
      IResourceDelta child = children[i];
      IResource resource = child.getResource();
      if (resource instanceof IFolder) {
        String[] subpkgName = Util.arrayConcat(pkgName, resource.getName());
        this.updateRootIndex(root, subpkgName, child);
      }
    }
  }
View Full Code Here

    int length = members.length;
    if (length > 0) {
      String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
      String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
      nextResource: for (int i = 0; i < length; i++) {
        IResource member = members[i];
        switch (member.getType()) {
          case IResource.FILE :
            String fileName = member.getName();
         
            // ignore .java files that are not excluded
            if (Util.isValidCompilationUnitName(fileName, sourceLevel, complianceLevel) && !Util.isExcluded(member, inclusionPatterns, exclusionPatterns))
              continue nextResource;
            // ignore .class files
            if (Util.isValidClassFileName(fileName, sourceLevel, complianceLevel))
              continue nextResource;
            // ignore .zip or .jar file on classpath
            if (org.aspectj.org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(fileName) && isClasspathEntry(member.getFullPath(), classpath))
              continue nextResource;
            break;

          case IResource.FOLDER :
            // ignore valid packages or excluded folders that correspond to a nested pkg fragment root
            if (Util.isValidFolderNameForPackage(member.getName(), sourceLevel, complianceLevel)
                && (!Util.isExcluded(member, inclusionPatterns, exclusionPatterns)
                    || isClasspathEntry(member.getFullPath(), classpath)))
              continue nextResource;
            break;
        }
        if (nonJavaResources.length == nonJavaResourcesCounter) {
          // resize
View Full Code Here

    // the launched process will fail
   
    StringBuilder cmdline = new StringBuilder();
    cmdline.append(RemoteLauncher.DESCRIPTOR_PARAM + " ");
    String descriptorPath = configuration.getAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME, "");
    IResource descriptor = ResourcesPlugin.getWorkspace().getRoot().findMember(descriptorPath);
    ensureResourceExists(descriptor, "Analysis Engine Descritpor");
    cmdline.append(descriptor.getLocation().toOSString() + " ");
    cmdline.append(RemoteLauncher.INPUT_RESOURCE_PARAM + " ");
   
    String inputResourcePath = configuration.getAttribute(LauncherConstants.ATTR_INPUT_NAME, "");
    IResource inputResource = ResourcesPlugin.getWorkspace().getRoot().findMember(inputResourcePath);
    ensureResourceExists(inputResource, "Input Resource");
    cmdline.append(inputResource.getLocation().toOSString() + " ");
   
    String formatName = configuration.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME, " ");
    cmdline.append(RemoteLauncher.INPUT_FORMAT_PARAM + " ");
    cmdline.append(formatName + " ");
   
    // if format equals PLAIN_TEXT
    if (InputFormat.PLAIN_TEXT.toString().equals(formatName)) {
      cmdline.append(RemoteLauncher.INPUT_ENCODING_PARAM + " ");
      cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME, "")
              + " ");
     
      cmdline.append(RemoteLauncher.INPUT_LANGUAGE_PARAM + " ");
      cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME, "") + " ");
     
    }
   
    cmdline.append(RemoteLauncher.INPUT_RECURSIVE_PARAM + " ");
    cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME, false) + " ");
   
    String outputFolderPath = configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "");
    // zero length string means that is is not set
    if (outputFolderPath.length() != 0) {
      IResource outputFolder = ResourcesPlugin.getWorkspace().getRoot().findMember(outputFolderPath);
     
      ensureResourceExists(outputFolder, "Output Folder");
     
      cmdline.append(RemoteLauncher.OUTPUT_FOLDER_PARAM + " ");
      cmdline.append(outputFolder.getLocation().toOSString() + " ");
     
      // Do not delete the output folder if it is the Workspace Root or a Project
      // It should not be possible to set it to one of both, but in case something goes wrong
      // it should be double checked
      if (!(outputFolder instanceof IWorkspaceRoot || outputFolder instanceof IProject)) {
View Full Code Here

   
    String outputFolderPath = configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "");
    // zero length string means that is is not set
    if (outputFolderPath.length() != 0) {
      // If the output directory is set and inside the workspace it will be refreshed
      IResource result = ResourcesPlugin.getWorkspace().getRoot().findMember(outputFolderPath);
     
      if (result != null)
          result.refreshLocal(IResource.DEPTH_INFINITE, null);
    }
  }
View Full Code Here

import aQute.bnd.build.Project;

public abstract class AbstractBuildErrorDetailsHandler implements BuildErrorDetailsHandler {

    public static final IResource getDefaultResource(IProject project) {
        IResource resource;
        IFile bndFile = project.getFile(Project.BNDFILE);
        if (bndFile == null || !bndFile.exists())
            resource = project;
        else
            resource = bndFile;
View Full Code Here

            IAdaptable adaptable = (IAdaptable) selected;
            IJavaElement javaElement = (IJavaElement) adaptable.getAdapter(IJavaElement.class);
            if (javaElement != null) {
                launchJavaElement(javaElement, mode);
            } else {
                IResource resource = (IResource) adaptable.getAdapter(IResource.class);
                if (resource != null && resource != selected)
                    launchSelectedObject(resource, mode);
            }
        }
    }
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.