Search in sources :

Example 1 with QName

use of com.liferay.ide.portlet.core.model.QName in project liferay-ide by liferay.

the class NameOrQnameValidationService method compute.

@Override
public Status compute() {
    Element element = context(Element.class);
    String elementLabel = element.type().getLabel(false, CapitalizationType.FIRST_WORD_ONLY, false);
    QName iqName = null;
    String name = null;
    String nsURI = null;
    String localPart = null;
    if (element instanceof QName) {
        iqName = (QName) element;
        nsURI = iqName.getNamespaceURI().text(false);
        localPart = iqName.getLocalPart().text(false);
    }
    if (isEmptyOrNull(name) && isEmptyOrNull(nsURI) && isEmptyOrNull(localPart)) {
        return Status.createErrorStatus(Resources.bind(Resources.message, elementLabel));
    } else if (isEmptyOrNull(name) && (isEmptyOrNull(nsURI) || isEmptyOrNull(localPart))) {
        return Status.createErrorStatus(Resources.bind(Resources.invalidQname, elementLabel));
    }
    return Status.createOkStatus();
}
Also used : QName(com.liferay.ide.portlet.core.model.QName) Element(org.eclipse.sapphire.Element)

Aggregations

QName (com.liferay.ide.portlet.core.model.QName)1 Element (org.eclipse.sapphire.Element)1