Java Code Examples for com.intellij.psi.xml.XmlAttributeValue#getValue()

The following examples show how to use com.intellij.psi.xml.XmlAttributeValue#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowInPlaceRenamer.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
private static Template buildTemplate(@NotNull XmlAttribute attr, List<XmlTag> refs) {
        //XmlFile containingFile = (XmlFile)attr.getContainingFile();
        PsiElement commonParent = PsiTreeUtil.findCommonParent(refs);
        TemplateBuilderImpl builder = new TemplateBuilderImpl(attr);

        XmlAttributeValue attrValue = attr.getValueElement();
        PsiElement valuePsi = attrValue.getFirstChild().getNextSibling();

        String flowNameValue = new String(attrValue.getValue());
        builder.replaceElement(valuePsi,"PrimaryVariable", new TextExpression(flowNameValue), true);
/*

        for (XmlTag ref : refs) {
            if (ref.getContainingFile().equals(attr.getContainingFile())) {
                XmlAttribute nextAttr = ref.getAttribute(MuleConfigConstants.NAME_ATTRIBUTE);
                XmlAttributeValue nextValue = nextAttr.getValueElement();
                PsiElement nextValuePsi = nextValue.getFirstChild().getNextSibling();
                builder.replaceElement(nextValuePsi, "OtherVariable", "PrimaryVariable",false);
            }
        }
*/

        return builder.buildInlineTemplate();
    }
 
Example 2
Source File: DoctrineMetadataLineMarkerProvider.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
private void attachXmlRelationMarker(@NotNull PsiElement target, @NotNull XmlAttributeValue psiElement, @NotNull Collection<LineMarkerInfo> results) {
    String value = psiElement.getValue();
    if(StringUtils.isBlank(value)) {
        return;
    }

    Collection<PhpClass> classesInterface = DoctrineMetadataUtil.getClassInsideScope(psiElement, value);
    if(classesInterface.size() == 0) {
        return;
    }

    NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.DOCTRINE_LINE_MARKER).
        setTargets(classesInterface).
        setTooltipText("Navigate to class");

    results.add(builder.createLineMarkerInfo(target));
}
 
Example 3
Source File: MuleLanguageInjector.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
private boolean isExpectedLocalName(@NotNull String langPrefix,
                                    @NotNull PsiLanguageInjectionHost psiLanguageInjectionHost) {

    final XmlAttributeValue attributeValue = (XmlAttributeValue) psiLanguageInjectionHost;
    final String expressionText = attributeValue.getValue();
    return expressionText.startsWith(getLanguagePrefix(langPrefix)) && expressionText.endsWith("]");
}
 
Example 4
Source File: BeanUtils.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
private ReferencedClass findReferencedClass(XmlAttributeValue element) {
    JavaClassReference ref = JavaClassUtils.getService().findClassReference(element);
    if (ref != null) {
        return new ReferencedClass(element.getValue(), ref);
    }
    return null;
}
 
Example 5
Source File: BlueprintPropertyNameReferenceProvider.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected PsiReference[] getAttributeReferences(@NotNull XmlAttribute attribute, @NotNull XmlAttributeValue value,
                                                ProcessingContext context) {
    if (isPropertyName(attribute, value)) {
        PsiClass beanClass = BeanUtils.getService().getPropertyBeanClass(attribute.getParent());
        if (beanClass != null) {
            return new PsiReference[] {new PropertyNameReference(value, value.getValue(), beanClass)};
        }
    }
    return PsiReference.EMPTY_ARRAY;
}
 
Example 6
Source File: BeanUtils.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
private ReferenceableBeanId createReferenceableId(@NotNull XmlTag tag, @NotNull XmlAttributeValue idValue) {
    ReferencedClass referencedClass = findAttributeValue(tag, "class")
            .map(this::findReferencedClass)
            .orElse(null);
    return new ReferenceableBeanId(idValue, idValue.getValue(), referencedClass);
}