@Override
 public void loadState(Element state) {
   try {
     DefaultJDOMExternalizer.readExternal(this, state);
     if (myNullables.isEmpty()) {
       Collections.addAll(myNullables, DEFAULT_NULLABLES);
     }
     if (myNotNulls.isEmpty()) {
       Collections.addAll(myNotNulls, DEFAULT_NOT_NULLS);
     }
   } catch (InvalidDataException e) {
     LOG.error(e);
   }
 }
Пример #2
0
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    List<HighlightSeverity> list = getOrderAsList(getOrderMap());
    for (HighlightSeverity severity : list) {
      Element info = new Element(INFO_TAG);
      String severityName = severity.getName();
      final SeverityBasedTextAttributes infoType = getAttributesBySeverity(severity);
      if (infoType != null) {
        infoType.writeExternal(info);
        final Color color = myRendererColors.get(severityName);
        if (color != null) {
          info.setAttribute(COLOR_ATTRIBUTE, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
        }
        element.addContent(info);
      }
    }

    if (myReadOrder != null && !myReadOrder.isEmpty()) {
      myReadOrder.writeExternal(element);
    } else if (!getDefaultOrder().equals(list)) {
      final JDOMExternalizableStringList ext =
          new JDOMExternalizableStringList(Collections.nCopies(getOrderMap().size(), ""));
      getOrderMap()
          .forEachEntry(
              new TObjectIntProcedure<HighlightSeverity>() {
                @Override
                public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
                  ext.set(oIdx, orderSeverity.getName());
                  return true;
                }
              });
      ext.writeExternal(element);
    }
  }
  @Override
  public boolean isEntryPoint(@NotNull PsiElement element) {
    if (!(element instanceof PsiModifierListOwner)) return false;
    PsiModifierListOwner owner = (PsiModifierListOwner) element;
    if (!ADDITIONAL_ANNOTATIONS.isEmpty()
        && ADDITIONAL_ANNOTATIONS.contains(Deprecated.class.getName())
        && element instanceof PsiDocCommentOwner
        && ((PsiDocCommentOwner) element).isDeprecated()) {
      return true;
    }

    if (element instanceof PsiClass) {
      final String qualifiedName = ((PsiClass) element).getQualifiedName();
      if (qualifiedName != null) {
        for (ClassPattern pattern : getPatterns()) {
          if (isAcceptedByPattern((PsiClass) element, qualifiedName, pattern, new HashSet<>())) {
            return true;
          }
        }
      }
    }

    return AnnotationUtil.checkAnnotatedUsingPatterns(owner, ADDITIONAL_ANNOTATIONS)
        || AnnotationUtil.checkAnnotatedUsingPatterns(owner, getAdditionalAnnotations());
  }
 private void readOldFormat(final Element e) {
   final JDOMExternalizableStringList list = new JDOMExternalizableStringList();
   try {
     list.readExternal(e);
   } catch (IllegalDataException ignored) {
   }
   if (list.isEmpty()) return;
   final boolean[] selection = new boolean[list.size()];
   for (int i = 0; i < list.size(); i++) {
     selection[i] = Boolean.parseBoolean(list.get(i));
   }
   final String methodSignature = fixSignature(JDOMExternalizer.readString(e, "METHOD"), false);
   myParameterMap.put(methodSignature, new MethodInfo(methodSignature, selection, false));
 }
  @SuppressWarnings({"HardCodedStringLiteral"})
  public static void writeExternal(
      final Element element,
      final Map<String, SmartRefElementPointer> persistentEntryPoints,
      final JDOMExternalizableStringList additional_annotations) {
    Element entryPointsElement = new Element("entry_points");
    entryPointsElement.setAttribute(VERSION_ATTR, VERSION);
    for (SmartRefElementPointer entryPoint : persistentEntryPoints.values()) {
      assert entryPoint.isPersistent();
      entryPoint.writeExternal(entryPointsElement);
    }

    element.addContent(entryPointsElement);
    if (!additional_annotations.isEmpty()) {
      additional_annotations.writeExternal(element);
    }
  }