Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IPath


  public char[][] fullExclusionPatternChars() {

    if (this.fullExclusionPatternChars == UNINIT_PATTERNS) {
      int length = this.exclusionPatterns.length;
      this.fullExclusionPatternChars = new char[length][];
      IPath prefixPath = this.path.removeTrailingSeparator();
      for (int i = 0; i < length; i++) {
        this.fullExclusionPatternChars[i] =
          prefixPath.append(this.exclusionPatterns[i]).toString().toCharArray();
      }
    }
    return this.fullExclusionPatternChars;
  }
View Full Code Here


  public char[][] fullInclusionPatternChars() {

    if (this.fullInclusionPatternChars == UNINIT_PATTERNS) {
      int length = this.inclusionPatterns.length;
      this.fullInclusionPatternChars = new char[length][];
      IPath prefixPath = this.path.removeTrailingSeparator();
      for (int i = 0; i < length; i++) {
        this.fullInclusionPatternChars[i] =
          prefixPath.append(this.inclusionPatterns[i]).toString().toCharArray();
      }
    }
    return this.fullInclusionPatternChars;
  }
View Full Code Here

  public void elementEncode(XMLWriter writer, IPath projectPath, boolean indent, boolean newLine, Map unknownElements) {
    HashMap parameters = new HashMap();

    parameters.put(TAG_KIND, ClasspathEntry.kindToString(this.entryKind));

    IPath xmlPath = this.path;
    if (this.entryKind != IClasspathEntry.CPE_VARIABLE && this.entryKind != IClasspathEntry.CPE_CONTAINER) {
      // translate to project relative from absolute (unless a device path)
      if (xmlPath.isAbsolute()) {
        if (projectPath != null && projectPath.isPrefixOf(xmlPath)) {
          if (xmlPath.segment(0).equals(projectPath.segment(0))) {
            xmlPath = xmlPath.removeFirstSegments(1);
            xmlPath = xmlPath.makeRelative();
          } else {
            xmlPath = xmlPath.makeAbsolute();
          }
        }
      }
    }
    parameters.put(TAG_PATH, String.valueOf(xmlPath));

    if (this.sourceAttachmentPath != null) {
      xmlPath = this.sourceAttachmentPath;
      // translate to project relative from absolute
      if (this.entryKind != IClasspathEntry.CPE_VARIABLE && projectPath != null && projectPath.isPrefixOf(xmlPath)) {
        if (xmlPath.segment(0).equals(projectPath.segment(0))) {
          xmlPath = xmlPath.removeFirstSegments(1);
          xmlPath = xmlPath.makeRelative();
        }
      }
      parameters.put(TAG_SOURCEPATH, String.valueOf(xmlPath));
    }
    if (this.sourceAttachmentRootPath != null) {
      parameters.put(TAG_ROOTPATH, String.valueOf(this.sourceAttachmentRootPath));
    }
    if (this.isExported) {
      parameters.put(TAG_EXPORTED, "true");//$NON-NLS-1$
    }
    encodePatterns(this.inclusionPatterns, TAG_INCLUDING, parameters);
    encodePatterns(this.exclusionPatterns, TAG_EXCLUDING, parameters);
    if (this.entryKind == CPE_PROJECT && !this.combineAccessRules)
      parameters.put(TAG_COMBINE_ACCESS_RULES, "false"); //$NON-NLS-1$


    // unknown attributes
    UnknownXmlElements unknownXmlElements = unknownElements == null ? null : (UnknownXmlElements) unknownElements.get(this.path);
    String[] unknownAttributes;
    if (unknownXmlElements != null && (unknownAttributes = unknownXmlElements.attributes) != null)
      for (int i = 0, length = unknownAttributes.length; i < length; i+=2) {
        String tagName = unknownAttributes[i];
        String tagValue = unknownAttributes[i+1];
        parameters.put(tagName, tagValue);
      }

    if (this.specificOutputLocation != null) {
      IPath outputLocation = this.specificOutputLocation.removeFirstSegments(1);
      outputLocation = outputLocation.makeRelative();
      parameters.put(TAG_OUTPUT, String.valueOf(outputLocation));
    }

    boolean hasExtraAttributes = this.extraAttributes.length != 0;
    boolean hasRestrictions = getAccessRuleSet() != null; // access rule set is null if no access rules
View Full Code Here

    }
  }

  public static IClasspathEntry elementDecode(Element element, IJavaProject project, Map unknownElements) {

    IPath projectPath = project.getProject().getFullPath();
    NamedNodeMap attributes = element.getAttributes();
    NodeList children = element.getChildNodes();
    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) {
View Full Code Here

          }
        }
        if (this.focusType != null) {
          // if the hierarchy's project is on the added project classpath, then the hierarchy has changed
          classpath = ((JavaProject)element).getExpandedClasspath();
          IPath hierarchyProject = javaProject().getPath();
          for (int i = 0; i < classpath.length; i++) {
            if (classpath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT
                && classpath[i].getPath().equals(hierarchyProject)) {
              return true;
            }
View Full Code Here

      int flags = delta.getFlags();
      if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) > 0) {
        // check if the root is in the classpath of one of the projects of this hierarchy
        if (this.projectRegion != null) {
          IPackageFragmentRoot root = (IPackageFragmentRoot)element;
          IPath rootPath = root.getPath();
          IJavaElement[] elements = this.projectRegion.getElements();
          for (int i = 0; i < elements.length; i++) {
            JavaProject javaProject = (JavaProject)elements[i];
            try {
              IClasspathEntry entry = javaProject.getClasspathEntryFor(rootPath);
View Full Code Here

    } else {
      final IPath[] nestedFolders = getNestedFolders(root);
      IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
        public boolean visit(IResourceProxy proxy) throws CoreException {
          if (proxy.getType() == IResource.FOLDER) {
            IPath path = proxy.requestFullPath();
            if (prefixesOneOf(path, nestedFolders)) {
              // equals if nested source folder
              return !equalsOneOf(path, nestedFolders);
            } else {
              // subtree doesn't contain any nested source folders
View Full Code Here

  public static Integer REBUILDING_STATE = new Integer(3);

public synchronized void aboutToUpdateIndex(IPath containerPath, Integer newIndexState) {
  // newIndexState is either UPDATING_STATE or REBUILDING_STATE
  // must tag the index as inconsistent, in case we exit before the update job is started
  IPath indexLocation = computeIndexLocation(containerPath);
  Object state = getIndexStates().get(indexLocation);
  Integer currentIndexState = state == null ? UNKNOWN_STATE : (Integer) state;
  if (currentIndexState.equals(REBUILDING_STATE)) return; // already rebuilding the index

  int compare = newIndexState.compareTo(currentIndexState);
View Full Code Here

*/
public void addBinary(IFile resource, IPath containerPath) {
  if (JavaCore.getPlugin() == null) return
  SearchParticipant participant = SearchEngine.getDefaultSearchParticipant();
  SearchDocument document = participant.getDocument(resource.getFullPath().toString());
  IPath indexLocation = computeIndexLocation(containerPath);
  scheduleDocumentIndexing(document, containerPath, indexLocation, participant);
}
View Full Code Here

public void addSource(IFile resource, IPath containerPath, SourceElementParser parser) {
  if (JavaCore.getPlugin() == null) return
  SearchParticipant participant = SearchEngine.getDefaultSearchParticipant();
  SearchDocument document = participant.getDocument(resource.getFullPath().toString());
  ((InternalSearchDocument) document).parser = parser;
  IPath indexLocation = computeIndexLocation(containerPath);
  scheduleDocumentIndexing(document, containerPath, indexLocation, participant);
}
View Full Code Here

TOP

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

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.