Java Code Examples for com.intellij.psi.xml.XmlTag#getLocalName()

The following examples show how to use com.intellij.psi.xml.XmlTag#getLocalName() . 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: MuleConfigUtils.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@NotNull
private static String getPrefix(XmlTag weavePart) {
    final String localName = weavePart.getLocalName();
    if (localName.equals("set-payload")) {
        return "payload:";
    } else if (localName.equals("set-variable")) {
        return "flowVar:" + weavePart.getAttributeValue("variableName");
    } else if (localName.equals("set-property")) {
        return "property:" + weavePart.getAttributeValue("propertyName");
    } else if (localName.equals("set-session-variable")) {
        return "sessionVar:" + weavePart.getAttributeValue("variableName");
    }

    return "payload:";
}
 
Example 2
Source File: MuleConfigUtils.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@NotNull
private static String getGlobalElementCategory(XmlTag element) {
    switch (element.getLocalName()) {
        case "flow":
            return "/processors";
        case "sub-flow":
            return "/subprocessors";
        case "test":
            return "/tests";
        default:
            return "/es";
    }

}
 
Example 3
Source File: XmlCamelIdeaUtils.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
private boolean isCamelRouteStartTag(XmlTag tag) {
    String name = tag.getLocalName();
    XmlTag parentTag = tag.getParentTag();
    if (parentTag != null) {
        //TODO: unsure about this, <rest> cannot be a child of <routes> according to blueprint xsd, see issue #475
        return "routes".equals(parentTag.getLocalName()) && "rest".equals(name)
            || "route".equals(parentTag.getLocalName()) && "from".equals(name);
    }
    return false;
}
 
Example 4
Source File: MuleConfigUtils.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
public static QName getQName(XmlTag xmlTag) {
    return new QName(xmlTag.getNamespace(), xmlTag.getLocalName());
}
 
Example 5
Source File: XmlIdeaUtils.java    From camel-idea-plugin with Apache License 2.0 2 votes vote down vote up
/**
 * Is the given element from a XML tag with any of the given tag names
 *
 * @param xml  the xml tag
 * @param methods  xml tag names
 * @return <tt>true</tt> if matched, <tt>false</tt> otherwise
 */
boolean isFromXmlTag(@NotNull XmlTag xml, @NotNull String... methods) {
    String name = xml.getLocalName();
    return Arrays.stream(methods).anyMatch(name::equals);
}
 
Example 6
Source File: IdeaUtils.java    From camel-idea-plugin with Apache License 2.0 2 votes vote down vote up
/**
 * Is the given element from a XML tag with any of the given tag names
 *
 * @param xml  the xml tag
 * @param methods  xml tag names
 * @return <tt>true</tt> if matched, <tt>false</tt> otherwise
 */
public boolean isFromXmlTag(@NotNull XmlTag xml, @NotNull String... methods) {
    String name = xml.getLocalName();
    return Arrays.stream(methods).anyMatch(name::equals);
}