private static void addRequiredAnnotation(DomExtension e, final ParameterData data) { if (Boolean.parseBoolean(data.parameter.getRequired().getStringValue()) && StringUtil.isEmptyOrSpaces(data.defaultValue) && StringUtil.isEmptyOrSpaces(data.expression)) { e.addCustomAnnotation(new Required(){ @Override public boolean value() { return true; } @Override public boolean nonEmpty() { return false; } @Override public boolean identifier() { return false; } public Class<? extends Annotation> annotationType() { return Required.class; } }); } }
/** * Returns the value of the name child. * * @return the value of the name child. */ @NotNull @Required //NOTE: We have to avoid @Convert since PsiField is in the read-only file and thus can't be renamed by platform //NOTE: Instead we are renaming the attribute value itself, see BeansRenamePsiElementProcessor //@Convert(soft = true, value = BeansPropertyNameConverter.class) GenericAttributeValue<String> getName();
@NotNull private static BaseControl createGenericValueControl(final Type type, final GenericDomValue<?> element, boolean commitOnEveryChange) { final DomStringWrapper stringWrapper = new DomStringWrapper(element); final Class rawType = ReflectionUtil.getRawType(type); if (type instanceof Class && Enum.class.isAssignableFrom(rawType)) { return new ComboControl(stringWrapper, rawType); } if (DomElement.class.isAssignableFrom(rawType)) { final ComboControl control = new ComboControl(element); final Required annotation = element.getAnnotation(Required.class); if (annotation == null || !annotation.value() || !annotation.nonEmpty()) { control.setNullable(true); } return control; } final DomFixedWrapper wrapper = new DomFixedWrapper(element); if (type.equals(boolean.class) || type.equals(Boolean.class)) { return new BooleanControl(wrapper); } if (type.equals(String.class)) { return getDomUIFactory().createTextControl(wrapper, commitOnEveryChange); } final BaseControl customControl = getDomUIFactory().createCustomControl(type, stringWrapper, commitOnEveryChange); if (customControl != null) return customControl; return getDomUIFactory().createTextControl(stringWrapper, commitOnEveryChange); }
@Override public boolean isRequired() { final Required required = myDescription.getAnnotation(Required.class); return required != null && required.value(); }
@NotNull @Required @Referencing(RngReferenceConverter.class) GenericAttributeValue<String> getName();
/** * Returns the value of the href child. * * @return the value of the href child. */ @NotNull @Required @Convert(RngHrefConverter.class) @com.intellij.util.xml.Attribute("href") GenericAttributeValue<XmlFile> getIncludedFile();
/** * Returns the value of the href child. * * @return the value of the href child. */ @NotNull @Required @Convert(RngHrefConverter.class) @com.intellij.util.xml.Attribute("href") GenericAttributeValue<XmlFile> getReferencedFile();
@Override @Required @Convert(ResourceNameConverter.class) GenericAttributeValue<String> getName();
@Required @Convert(ResourceNameConverter.class) GenericAttributeValue<String> getName();
@Convert(QuantityConverter.class) @Required GenericAttributeValue<String> getQuantity();
@Required AndroidAttributeValue<String> getName();
@Attribute("name") @Required @Convert(PackageClassConverter.class) @CompleteNonModuleClass @ExtendClass(AndroidUtils.INSTRUMENTATION_RUNNER_BASE_CLASS) AndroidAttributeValue<PsiClass> getInstrumentationClass();
@Required @Attribute("targetPackage") @Convert(InstrumentationTargetPackageConverter.class) AndroidAttributeValue<String> getTargetPackage();
@Attribute("name") @Required @Convert(PackageClassConverter.class) @ExtendClass("android.app.Activity") AndroidAttributeValue<PsiClass> getActivityClass();
@Required @Convert(value = PackageClassConverter.class) @ExtendClass("android.app.Activity") @Attribute("targetActivity") AndroidAttributeValue<PsiClass> getTargetActivity();
@Attribute("name") @Required @Convert(ConstantFieldConverter.class) @LookupClass("android.Manifest.permission") @LookupPrefix("android.permission") AndroidAttributeValue<String> getName();
@Attribute("toScene") @Convert(ResourceReferenceConverter.class) @Required @AndroidResourceType("layout") AndroidAttributeValue<ResourceValue> getToScene();
@Convert(ResourceReferenceConverter.class) @AndroidResourceType("color") @Required AndroidAttributeValue<ResourceValue> getColor();
@Convert(ResourceReferenceConverter.class) @AndroidResourceType("id") @Attribute("fromId") // without this it's interpreted as "from-id" @Required AndroidAttributeValue<ResourceValue> getFromId();
@Convert(ResourceReferenceConverter.class) @AndroidResourceType("id") @Attribute("toId") // without this it's interpreted as "to-id" @Required AndroidAttributeValue<ResourceValue> getToId();
@Convert(ResourceReferenceConverter.class) @AndroidResourceType("drawable") @Required AndroidAttributeValue<ResourceValue> getDrawable();
@Convert(ResourceReferenceConverter.class) @AndroidResourceType("color") @Attribute("color") @Required AndroidAttributeValue<ResourceValue> getColor();
@Required @Convert(ResourceReferenceConverter.class) @AndroidResourceType("drawable") AndroidAttributeValue<String> getSrc();
@Convert(ResourceReferenceConverter.class) @Required @AndroidResourceType("anim") AndroidAttributeValue<ResourceValue> getAnimation();
@Required AndroidAttributeValue<String> getValue();
@Required @AndroidResourceType("id") @Convert(ResourceReferenceConverter.class) AndroidAttributeValue<ResourceValue> getId();
@NotNull @Required(value = false, nonEmpty = true) @Convert(MavenDistributionStatusConverter.class) GenericDomValue<String> getStatus();
@NotNull @Required @Convert(MavenRepositoryConverter.Id.class) GenericDomValue<String> getId();
@NotNull @Required(value = false, nonEmpty = true) @Convert(MavenRepositoryLayoutConverter.class) GenericDomValue<String> getLayout();
@Required @NoSpellchecking @Convert(MavenArtifactCoordinatesGroupIdConverter.class) GenericDomValue<String> getGroupId();
@Required @NoSpellchecking @Convert(MavenArtifactCoordinatesArtifactIdConverter.class) GenericDomValue<String> getArtifactId();
@Required(value = false, nonEmpty = true) GenericDomValue<String> getGroupId();
@Required(value = false, nonEmpty = true) GenericDomValue<String> getVersion();