Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Path


    char[][] patterns = CharOperation.splitOn('|', sequence.toCharArray());
    int patternCount;
    if ((patternCount  = patterns.length) > 0) {
      rules = new IPath[patternCount];
      for (int j = 0; j < patterns.length; j++){
        rules[j] = new Path(new String(patterns[j]));
      }
    }
    return rules;
  }
View Full Code Here


            rootPath += token;
          } else {
            break;
          }
        }
        JavaElement root = (JavaElement)getPackageFragmentRoot(new Path(rootPath));
        if (token != null && token.charAt(0) == JEM_PACKAGEFRAGMENT) {
          return root.getHandleFromMemento(token, memento, owner);
        } else {
          return root.getHandleFromMemento(memento, owner);
        }
View Full Code Here

  /**
   * @see IJavaProject
   */
  public IPackageFragmentRoot getPackageFragmentRoot(String jarPath) {

    return getPackageFragmentRoot0(JavaProject.canonicalizedPath(new Path(jarPath)));
  }
View Full Code Here

        else if (TAG_DISCOURAGED.equals(tagKind))
          kind = IAccessRule.K_DISCOURAGED;
        else
          continue;
        boolean ignoreIfBetter = "true".equals(elementAccessRule.getAttribute(TAG_IGNORE_IF_BETTER)); //$NON-NLS-1$
        result[index++] = new ClasspathAccessRule(new Path(pattern), ignoreIfBetter ? kind | IAccessRule.IGNORE_IF_BETTER : kind);
      }
    }
    if (index != length)
      System.arraycopy(result, 0, result = new IAccessRule[index], 0, index);
    return result;
View Full Code Here

        IPath[] paths = new IPath[patternCount];
        int index = 0;
        for (int j = 0; j < patternCount; j++) {
          char[] pattern = patterns[j];
          if (pattern.length == 0) continue; // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=105581
          paths[index++] = new Path(new String(pattern));
        }
        if (index < patternCount)
          System.arraycopy(paths, 0, paths = new IPath[index], 0, index);
        return paths;
      }
View Full Code Here

    boolean[] foundChildren = new boolean[children.getLength()];
    String kindAttr = removeAttribute(TAG_KIND, attributes);
    String pathAttr = removeAttribute(TAG_PATH, attributes);

    // ensure path is absolute
    IPath path = new Path(pathAttr);
    int kind = kindFromString(kindAttr);
    if (kind != IClasspathEntry.CPE_VARIABLE && kind != IClasspathEntry.CPE_CONTAINER && !path.isAbsolute()) {
      path = projectPath.append(path);
    }
    // source attachment info (optional)
    IPath sourceAttachmentPath =
      element.hasAttribute(TAG_SOURCEPATH)
      ? new Path(removeAttribute(TAG_SOURCEPATH, attributes))
      : null;
    if (kind != IClasspathEntry.CPE_VARIABLE && sourceAttachmentPath != null && !sourceAttachmentPath.isAbsolute()) {
      sourceAttachmentPath = projectPath.append(sourceAttachmentPath);
    }
    IPath sourceAttachmentRootPath =
      element.hasAttribute(TAG_ROOTPATH)
      ? new Path(removeAttribute(TAG_ROOTPATH, attributes))
      : null;

    // exported flag (optional)
    boolean isExported = removeAttribute(TAG_EXPORTED, attributes).equals("true"); //$NON-NLS-1$

    // inclusion patterns (optional)
    IPath[] inclusionPatterns = decodePatterns(attributes, TAG_INCLUDING);
    if (inclusionPatterns == null) inclusionPatterns = INCLUDE_ALL;

    // exclusion patterns (optional)
    IPath[] exclusionPatterns = decodePatterns(attributes, TAG_EXCLUDING);
    if (exclusionPatterns == null) exclusionPatterns = EXCLUDE_NONE;

    // access rules (optional)
    NodeList attributeList = getChildAttributes(TAG_ACCESS_RULES, children, foundChildren);
    IAccessRule[] accessRules = decodeAccessRules(attributeList);

    // backward compatibility
    if (accessRules == null) {
      accessRules = getAccessRules(inclusionPatterns, exclusionPatterns);
    }

    // combine access rules (optional)
    boolean combineAccessRestrictions = !removeAttribute(TAG_COMBINE_ACCESS_RULES, attributes).equals("false"); //$NON-NLS-1$

    // extra attributes (optional)
    attributeList = getChildAttributes(TAG_ATTRIBUTES, children, foundChildren);
    IClasspathAttribute[] extraAttributes = decodeExtraAttributes(attributeList);

    // custom output location
    IPath outputLocation = element.hasAttribute(TAG_OUTPUT) ? projectPath.append(removeAttribute(TAG_OUTPUT, attributes)) : null;

    String[] unknownAttributes = null;
    ArrayList unknownChildren = null;

    if (unknownElements != null) {
      // unknown attributes
      int unknownAttributeLength = attributes.getLength();
      if (unknownAttributeLength != 0) {
        unknownAttributes = new String[unknownAttributeLength*2];
        for (int i = 0; i < unknownAttributeLength; i++) {
          Node attribute = attributes.item(i);
          unknownAttributes[i*2] = attribute.getNodeName();
          unknownAttributes[i*2 + 1] = attribute.getNodeValue();
        }
      }

      // unknown children
      for (int i = 0, length = foundChildren.length; i < length; i++) {
        if (!foundChildren[i]) {
          Node node = children.item(i);
          if (node.getNodeType() != Node.ELEMENT_NODE) continue;
          if (unknownChildren == null)
            unknownChildren = new ArrayList();
          StringBuffer buffer = new StringBuffer();
          decodeUnknownNode(node, buffer, project);
          unknownChildren.add(buffer.toString());
        }
      }
    }

    // recreate the CP entry
    IClasspathEntry entry = null;
    switch (kind) {

      case IClasspathEntry.CPE_PROJECT :
        entry = new ClasspathEntry(
        IPackageFragmentRoot.K_SOURCE,
        IClasspathEntry.CPE_PROJECT,
        path,
        ClasspathEntry.INCLUDE_ALL, // inclusion patterns
        ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
        null, // source attachment
        null, // source attachment root
        null, // specific output folder
        isExported,
        accessRules,
        combineAccessRestrictions,
        extraAttributes);
        break;
      case IClasspathEntry.CPE_LIBRARY :
        entry = JavaCore.newLibraryEntry(
                        path,
                        sourceAttachmentPath,
                        sourceAttachmentRootPath,
                        accessRules,
                        extraAttributes,
                        isExported);
        break;
      case IClasspathEntry.CPE_SOURCE :
        // must be an entry in this project or specify another project
        String projSegment = path.segment(0);
        if (projSegment != null && projSegment.equals(project.getElementName())) { // this project
          entry = JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation, extraAttributes);
        } else {
          if (path.segmentCount() == 1) {
            // another project
            entry = JavaCore.newProjectEntry(
                        path,
                        accessRules,
                        combineAccessRestrictions,
                        extraAttributes,
                        isExported);
          } else {
            // an invalid source folder
            entry = JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation, extraAttributes);
          }
        }
        break;
      case IClasspathEntry.CPE_VARIABLE :
        entry = JavaCore.newVariableEntry(
            path,
            sourceAttachmentPath,
            sourceAttachmentRootPath,
            accessRules,
            extraAttributes,
            isExported);
        break;
      case IClasspathEntry.CPE_CONTAINER :
        entry = JavaCore.newContainerEntry(
            path,
            accessRules,
            extraAttributes,
            isExported);
        break;
      case ClasspathEntry.K_OUTPUT :
        if (!path.isAbsolute()) return null;
        entry = new ClasspathEntry(
            ClasspathEntry.K_OUTPUT,
            IClasspathEntry.CPE_LIBRARY,
            path,
            INCLUDE_ALL,
View Full Code Here

    if (VERBOSE)
      Util.verbose("-> saving index " + index.getIndexFile()); //$NON-NLS-1$
    index.save();
  }
  synchronized (this) {
    IPath containerPath = new Path(index.containerPath);
    if (this.jobEnd > this.jobStart) {
      for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job
        IJob job = this.awaitingJobs[i];
        if (job instanceof IndexRequest)
          if (((IndexRequest) job).containerPath.equals(containerPath)) return;
View Full Code Here

            manager.remove(paths[i], this.containerPath); // write lock will be acquired by the remove operation
          }
        } else {
          for (int i = 0, max = paths.length; i < max; i++) {
            String documentPath =  this.containerPath.toString() + '/' + paths[i];
            if (!Util.isExcluded(new Path(documentPath), this.inclusionPatterns, this.exclusionPatterns, false))
              manager.remove(paths[i], this.containerPath); // write lock will be acquired by the remove operation
          }
        }
      }
    } catch (IOException e) {
View Full Code Here

     
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element element= (Element) node;
        if (element.getNodeName().equals(TAG_ARCHIVE)) {
          String path = element.getAttribute(TAG_PATH);
          IPath sourceAttach= element.hasAttribute(TAG_SOURCEATTACHMENT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENT)) : null;
          IPath sourceAttachRoot= element.hasAttribute(TAG_SOURCEATTACHMENTROOT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENTROOT)) : null;
          NodeList children = element.getElementsByTagName("*"); //$NON-NLS-1$
          boolean[] foundChildren = new boolean[children.getLength()];
          NodeList attributeList = ClasspathEntry.getChildAttributes(ClasspathEntry.TAG_ATTRIBUTES, children, foundChildren);
          IClasspathAttribute[] extraAttributes = ClasspathEntry.decodeExtraAttributes(attributeList);
          attributeList = ClasspathEntry.getChildAttributes(ClasspathEntry.TAG_ACCESS_RULES, children, foundChildren);
          IAccessRule[] accessRules = ClasspathEntry.decodeAccessRules(attributeList);
          IClasspathEntry entry = JavaCore.newLibraryEntry(new Path(path), sourceAttach, sourceAttachRoot, accessRules, extraAttributes, false/*not exported*/);
          res.add(entry);
        }
      }
    }
   
 
View Full Code Here

    String key = event.getKey();
    if (key.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
      String libName = key.substring(CP_USERLIBRARY_PREFERENCES_PREFIX.length());
      try {
        // find affected projects
        IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(libName);
        IJavaProject[] allJavaProjects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
        ArrayList affectedProjects = new ArrayList();
        for (int i= 0; i < allJavaProjects.length; i++) {
          IJavaProject javaProject = allJavaProjects[i];
          IClasspathEntry[] entries= javaProject.getRawClasspath();
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.Path

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.