private void swallowError(IPath file, Throwable e) throws CoreException {
    IStatus s;
    /*
     * If the thrown CoreException is for a STATUS_PDOM_TOO_LARGE, we don't want to
     * swallow this one.
     */
    if (e instanceof CoreException) {
      s = ((CoreException) e).getStatus();
      if (s.getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE) {
        if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin())) throw (CoreException) e;
      }

      // mask errors in order to avoid dialog from platform
      Throwable exception = s.getException();
      if (exception != null) {
        Throwable masked = getMaskedException(exception);
        if (masked != exception) {
          e = masked;
          exception = null;
        }
      }
      if (exception == null) {
        s = new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e);
      }
    } else {
      e = getMaskedException(e);
      s = createStatus(getMessage(MessageKind.errorWhileParsing, file), e);
    }
    logError(s);
    if (++fStatistics.fErrorCount > MAX_ERRORS) {
      throw new CoreException(createStatus(getMessage(MessageKind.tooManyIndexProblems)));
    }
  }
Ejemplo n.º 2
0
 private IIndexFragmentName createPDOMName(PDOMLinkage linkage, IASTName name, PDOMName caller)
     throws CoreException {
   final IBinding binding = name.getBinding();
   if (binding instanceof IParameter) {
     return null;
   }
   try {
     if (binding instanceof IMacroBinding
         || (binding == null
             && name.getPropertyInParent() == IASTPreprocessorStatement.MACRO_NAME)) {
       return createPDOMMacroReferenceName(linkage, name);
     }
     PDOMBinding pdomBinding = linkage.addBinding(name);
     if (pdomBinding != null) {
       final PDOMName result = new PDOMName(fLinkage, name, this, pdomBinding, caller);
       linkage.onCreateName(this, name, result);
       return result;
     }
   } catch (CoreException e) {
     final IStatus status = e.getStatus();
     if (status != null && status.getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE) {
       if (CCorePlugin.PLUGIN_ID.equals(status.getPlugin())) throw e;
     }
     CCorePlugin.log(e);
   }
   return null;
 }