Exemplo n.º 1
0
  private void processErrorsInReport(
      String report, String sourcePath, List<IProblem> items, List<String> filters) {
    int offset = 0;
    String elementName = "errorlist"; // $NON-NLS-1$
    String startTag = MessageFormat.format("<{0}>", elementName); // $NON-NLS-1$
    String endTag = MessageFormat.format("</{0}>", elementName); // $NON-NLS-1$

    while (offset < report.length()) {
      int errorListStart = report.indexOf(startTag, offset);
      if (errorListStart == -1) {
        break;
      }

      // advances past the start tag
      errorListStart += startTag.length();

      // gets the URI
      int uriStart =
          report.indexOf("<uri>", errorListStart) + "<uri>".length(); // $NON-NLS-1$ //$NON-NLS-2$
      int uriEnd = report.indexOf("</uri>", uriStart); // $NON-NLS-1$
      String uri = new String(report.substring(uriStart, uriEnd));

      // finds the end of this list
      int errorListEnd = report.indexOf(endTag, errorListStart);

      // checks if the uri matches the source
      if (uri != null && URLEncoder.encode(uri, null, null).equals(sourcePath)) {
        // extracts the error list
        String listString = new String(report.substring(errorListStart, errorListEnd));
        // finds the errors
        String[] errors = getContent(ERROR_PATTERN, listString);
        // add errors
        addErrors(errors, sourcePath, items, filters);
      }

      // advances past the current error list
      offset = errorListEnd + endTag.length();
    }
  }
Exemplo n.º 2
0
 /* (non-Javadoc)
  * @see org.eclipse.core.filesystem.provider.FileStore#toURI()
  */
 @Override
 public URI toURI() {
   return baseURI.resolve(URLEncoder.encode(path.toPortableString(), null, null));
 }
 /*
  * (non-Javadoc)
  * @see com.aptana.core.io.vfs.IConnectionFileManager#getCanonicalURI(org.eclipse.core.runtime.IPath)
  */
 public URI getCanonicalURI(IPath path) {
   // TODO:max - trace links here
   return getRootCanonicalURI()
       .resolve(URLEncoder.encode(basePath.append(path).toPortableString(), null, null));
 }