本文整理汇总了Java中org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement.getTagName方法的典型用法代码示例。如果您正苦于以下问题:Java IDOMElement.getTagName方法的具体用法?Java IDOMElement.getTagName怎么用?Java IDOMElement.getTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement
的用法示例。
在下文中一共展示了IDOMElement.getTagName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCollect
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected void doCollect(IDOMElement target, String name, IFile file, INgBindingCollector collector) {
String tagName = target.getTagName();
int index = name.lastIndexOf('.');
if (index != -1) {
String[] parts = name.split("[.]");
if (parts.length > 0 && ("keyup".equals(parts[0]) || "keydown".equals(parts[0]))) {
// Validate each parts
List<String> keyParts = createKeyParts();
for (int i = 1; i < parts.length; i++) {
keyParts.remove(parts[i]);
}
for (String keyPart : keyParts) {
collector.collect(name, name.substring(0, index) + "." + keyPart, null, this);
}
}
} else {
DomElementSchemaRegistry.INSTANCE.collectEvent(tagName, name, this, collector);
}
}
示例2: validateAttribute
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
public ValidationMessage validateAttribute(IDOMElement target, String attrName) {
// Attribute is a directive or directive parameter.
if (restriction == Restriction.A) {
// - 1) attribute is an angular attribute directive like @ng-app the
// attribute is valid.
return validateAttributeValue(target, attrName);
}
// - 2) attribute is an angular parameter directive like
// ng-pluralize/@src, check if it's a valid directive parameter
if (directive.getParameter(attrName) == null) {
String tagName = target.getTagName();
Segment segment = CustomValidatorUtil.getAttributeSegment((IDOMNode) target.getAttributeNode(attrName),
CustomValidatorUtil.ATTR_REGION_NAME);
return new ValidationMessage("Unknown directive parameter for directive " + tagName, segment.getOffset(),
segment.getLength(), ValidationMessage.ERROR);
}
return null;
}
示例3: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
// Key events
if (name.indexOf('.') != -1) {
// event binding with '.' are valid only with 'keyup' and 'keydown'
// see "parseEventName" in
// https://github.com/angular/angular/blob/master/modules/%40angular/platform-browser/src/dom/events/key_events.ts
String[] parts = name.split("[.]");
if (parts.length > 1 && ("keyup".equals(parts[0]) || "keydown".equals(parts[0]))) {
// Validate each parts
String part = null;
for (int i = 1; i < parts.length; i++) {
part = parts[i];
if (!validateKeyPart(part)) {
int partOffset = getPartOffset(parts, i);
Segment segment = CustomValidatorUtil.getAttributeSegment(
(IDOMNode) target.getAttributeNode(attrName), CustomValidatorUtil.ATTR_REGION_NAME);
return new ValidationMessage(
NLS.bind(AngularCoreMessages.UndefinedKeyEventBinding_error, part),
segment.getOffset() + partOffset + getStartsWith().length(), part.length(),
ValidationMessage.WARNING);
}
}
return null;
}
} else {
String tagName = target.getTagName();
if (DomElementSchemaRegistry.INSTANCE.hasEvent(tagName, name)) {
return null;
}
// Directive
if (NgDirectiveRegistry.INSTANCE.hasEvent(tagName, name, file)) {
return null;
}
}
return createValidationMessage(target, attrName,
NLS.bind(AngularCoreMessages.UndefinedEventBinding_error, name), ValidationMessage.WARNING);
}
示例4: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
String tagName = target.getTagName();
if (name.startsWith("-")) {
return createValidationMessage(target, attrName, AngularCoreMessages.VarDontAllow_error,
ValidationMessage.ERROR);
} else if (isTemplateElement(tagName)) {
return createValidationMessage(target, attrName, AngularCoreMessages.VarDeprecatedOnTemplate_error,
ValidationMessage.WARNING);
} else {
return createValidationMessage(target, attrName, AngularCoreMessages.VarDeprecatedOnNonTemplate_error,
ValidationMessage.WARNING);
}
}
示例5: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
String tagName = target.getTagName();
int index = name.indexOf('.');
if (index != -1) {
if (index + 1 < name.length()) {
String part = name.substring(0, index);
// see
// https://angular.io/docs/ts/latest/guide/template-syntax.html#!#attribute-binding
// https://angular.io/docs/ts/latest/guide/template-syntax.html#!#class-binding
// https://angular.io/docs/ts/latest/guide/template-syntax.html#!#style-binding
if (ATTR_PROP.equals(part) || CLASS_PROP.equals(part) || STYLE_PROP.equals(part)) {
// It's attribubte, class or style binding (ex: <button
// [style.color] = "" >)
// its'a valid binding.
return null;
}
}
} else {
if (DomElementSchemaRegistry.INSTANCE.hasProperty(tagName,
DomElementSchemaRegistry.INSTANCE.getMappedPropName(name))) {
return null;
}
// Directive
if (NgDirectiveRegistry.INSTANCE.hasProperty(tagName, name, file)) {
return null;
}
}
return createValidationMessage(target, attrName,
NLS.bind(AngularCoreMessages.UndefinedPropertyBinding_error, name), ValidationMessage.WARNING);
}
示例6: doCollect
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected void doCollect(IDOMElement target, String name, IFile file, INgBindingCollector collector) {
String tagName = target.getTagName();
int index = name.lastIndexOf('.');
if (index != -1) {
String part = name.substring(0, index);
if (ATTR_PROP.equals(part)) {
// completion for attributes
CMElementDeclaration eltDecl = CMNodeUtil.getElementDeclaration(target);
if (eltDecl != null) {
Iterator it = eltDecl.getAttributes().iterator();
CMAttributeDeclaration attr = null;
while (it.hasNext()) {
attr = (CMAttributeDeclaration) it.next();
collector.collect(name, part + "." + attr.getAttrName(),
null, this);
}
}
}
} else {
DomElementSchemaRegistry.INSTANCE.collectProperty(tagName,
DomElementSchemaRegistry.INSTANCE.getMappedPropName(name), this, collector);
collector.collect(name, ATTR_PROP, formatAttr(ATTR_PROP), this);
collector.collect(name, CLASS_PROP, formatAttr(CLASS_PROP), this);
}
// style already exists
}
示例7: createValidationMessage
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
protected ValidationMessage createValidationMessage(IDOMElement target, String attrName, String message,
int severity) {
String tagName = target.getTagName();
Segment segment = CustomValidatorUtil.getAttributeSegment((IDOMNode) target.getAttributeNode(attrName),
CustomValidatorUtil.ATTR_REGION_NAME);
return new ValidationMessage(message, segment.getOffset(), segment.getLength(), severity);
}
示例8: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
String tagName = target.getTagName();
// Directive
if (NgDirectiveRegistry.INSTANCE.hasProperty(tagName, name, file)
|| NgDirectiveRegistry.INSTANCE.hasEvent(tagName, name, file)) {
return null;
}
return createValidationMessage(target, attrName,
NLS.bind(AngularCoreMessages.UndefinedPropertyAndEventBinding_error, name), ValidationMessage.WARNING);
}
示例9: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
String tagName = target.getTagName();
if (name.startsWith("-")) {
return createValidationMessage(target, attrName, AngularCoreMessages.RefDontAllow_error,
ValidationMessage.ERROR);
}
return null;
}
示例10: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
protected ValidationMessage validate(String name, IDOMElement target, String attrName, IFile file) {
String tagName = target.getTagName();
if (!isTemplateElement(tagName)) {
return createValidationMessage(target, attrName,
AngularCoreMessages.LetOnlySupportedOnTemplateElements_error, ValidationMessage.ERROR);
}
return null;
}
示例11: canValidate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
public boolean canValidate(IDOMElement target, String attrName) {
this.directive = null;
this.restriction = null;
if (super.hasAngularNature()) {
// the project has angular nature, the attribute must be validated
// if:
// - 1) attribute is an angular attribute directive like @ng-app
// - 2) attribute is an angular parameter directive like
// ng-pluralize/@src
// 1) check if it is an angular attribute directive like @ng-app
this.restriction = Restriction.A;
this.directive = getDirective(null, attrName, restriction);
if (directive == null) {
// 2) check if it an angular parameter directive like
// ng-pluralize/@src
String tagName = target.getTagName();
this.restriction = Restriction.E;
this.directive = getDirective(null, tagName, restriction);
}
if (directive != null) {
return true;
} else {
this.restriction = null;
return false;
}
}
return false;
}
示例12: canValidate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入方法依赖的package包/类
@Override
public boolean canValidate(IDOMElement target) {
if (hasAngularNature()) {
// the project has angular nature
// return true if the tag element is an known angular directive (ex
// <ng-pluralize) and false otherwise.
String tagName = target.getTagName();
return (getDirective(null, tagName, Restriction.E) != null);
}
return false;
}