@Override @NotNull public String getName() { return myIsTag ? DomBundle.message("remove.element.fix.name", myName) : DomBundle.message("remove.attribute.fix.name", myName); }
@Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { if (s == null) return super.getErrorMessage(s, context); return s.trim().length() == 0 ? DomBundle.message("value.converter.format.exception.empty.string", myNumberClass.getName()) : DomBundle.message("value.converter.format.exception", s, myNumberClass.getName()); }
public String getErrorMessage(@Nullable final String s, final ConvertContext context) { if (s == null) return super.getErrorMessage(s, context); return s.trim().length() == 0 ? DomBundle.message("value.converter.format.exception.empty.string", myNumberClass.getName()) : DomBundle.message("value.converter.format.exception", s, myNumberClass.getName()); }
private String computeName() { final String name = myElement.getXmlElementName(); return isTag() ? DomBundle.message("add.element.fix.name", name) : DomBundle.message("add.attribute.fix.name", name); }
@Override @NotNull public String getFamilyName() { return DomBundle.message("quick.fixes.family"); }
@Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, "char"); }
@Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, BOOLEAN); }
@NotNull public String getFamilyName() { return DomBundle.message("quick.fixes.family"); }
@NotNull public String getName() { return myIsTag ? DomBundle.message("remove.element.fix.name", myName) : DomBundle.message("remove.attribute.fix.name", myName); }
public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, "char"); }
public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, BOOLEAN); }
@NotNull public String getName() { return DomBundle.message("create.new.element", myTypeName, myNewName); }
@NotNull public static List<DomElementProblemDescriptor> checkExtendClass(final GenericDomValue element, final PsiClass value, final String name, final boolean instantiatable, final boolean canBeDecorator, final boolean allowInterface, final boolean allowNonPublic, final boolean allowAbstract, final boolean allowEnum, final DomElementAnnotationHolder holder) { final Project project = element.getManager().getProject(); PsiClass extendClass = JavaPsiFacade.getInstance(project).findClass(name, GlobalSearchScope.allScope(project)); final SmartList<DomElementProblemDescriptor> list = new SmartList<DomElementProblemDescriptor>(); if (extendClass != null) { if (!name.equals(value.getQualifiedName()) && !value.isInheritor(extendClass, true)) { String message = DomBundle.message("class.is.not.a.subclass", value.getQualifiedName(), extendClass.getQualifiedName()); list.add(holder.createProblem(element, message)); } } if (instantiatable) { if (value.hasModifierProperty(PsiModifier.ABSTRACT)) { list.add(holder.createProblem(element, DomBundle.message("class.is.not.concrete", value.getQualifiedName()))); } else if (!allowNonPublic && !value.hasModifierProperty(PsiModifier.PUBLIC)) { list.add(holder.createProblem(element, DomBundle.message("class.is.not.public", value.getQualifiedName()))); } else if (!PsiUtil.hasDefaultConstructor(value, true)) { if (canBeDecorator) { boolean hasConstructor = false; for (PsiMethod method : value.getConstructors()) { final PsiParameterList psiParameterList = method.getParameterList(); if (psiParameterList.getParametersCount() != 1) continue; PsiTypeElement typeElement = psiParameterList.getParameters()[0].getTypeElement(); if (typeElement != null) { final PsiType psiType = typeElement.getType(); if (psiType instanceof PsiClassType) { final PsiClass psiClass = ((PsiClassType)psiType).resolve(); if (psiClass != null && InheritanceUtil.isInheritorOrSelf(psiClass, extendClass, true)) { hasConstructor = true; break; } } } } if (!hasConstructor) { list.add(holder.createProblem(element, DomBundle.message("class.decorator.or.has.default.constructor", value.getQualifiedName()))); } } else { list.add(holder.createProblem(element, DomBundle.message("class.has.no.default.constructor", value.getQualifiedName()))); } } } if (!allowInterface && value.isInterface()) { list.add(holder.createProblem(element, DomBundle.message("interface.not.allowed", value.getQualifiedName()))); } if (!allowEnum && value.isEnum()) { list.add(holder.createProblem(element, DomBundle.message("enum.not.allowed", value.getQualifiedName()))); } if (!allowAbstract && value.hasModifierProperty(PsiModifier.ABSTRACT) && !value.isInterface()) { list.add(holder.createProblem(element, DomBundle.message("abstract.class.not.allowed", value.getQualifiedName()))); } return list; }