本文整理汇总了Java中org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement类的典型用法代码示例。如果您正苦于以下问题:Java IDOMElement类的具体用法?Java IDOMElement怎么用?Java IDOMElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDOMElement类属于org.eclipse.wst.xml.core.internal.provisional.document包,在下文中一共展示了IDOMElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:21,代码来源:BaseEventBinding.java
示例2: completion
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private List<CompletionItem> completion(String html, int offset) throws CoreException {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
if (!project.exists()) {
project.create(new NullProgressMonitor());
project.open(new NullProgressMonitor());
}
IFile file = project.getFile("test.html");
if (file.exists()) {
file.setContents(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
} else {
file.create(IOUtils.toInputStream(html), 1, new NullProgressMonitor());
}
IDOMModel model = DOMUtils.getModel(project, file);
IDOMElement element = (IDOMElement) DOMUtils.getNodeByOffset(model, offset);
IDOMAttr attr = DOMUtils.getAttrByOffset(element, offset);
String attrName = attr.getName();
CompletionCollector collector = new CompletionCollector(element, attr);
AngularCorePlugin.getBindingManager().collect(element, attrName, file, collector);
return collector.getList();
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:23,代码来源:HTMLAngularCompletionTest.java
示例3: computeProposalsForDomainSpecificFragments
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private void computeProposalsForDomainSpecificFragments(
List<ICompletionProposal> proposals,
Set<ElExpressionFirstFragment> matchedFirstFragments)
throws UiBinderException {
for (ElExpressionFirstFragment firstFragment : matchedFirstFragments) {
IDOMElement node = (IDOMElement) firstFragment.getNode();
IType javaType;
if (UiBinderXmlModelUtilities.isStyleElement(node)) {
// This is a <ui:style> element
computeProposalsForStyleElement(proposals, node);
} else if ((javaType = UiBinderXmlModelUtilities.resolveElementToJavaType(
node, javaProject)) != null) {
// This is either a <ui:with> element or sth like <g:Button>
computeProposalsForJavaType(proposals, javaType);
}
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:20,代码来源:ElExpressionProposalComputer.java
示例4: onApply
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
@Override
public void onApply(IDocument document, ITextViewer viewer)
throws BadLocationException {
IDOMModel model = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForEdit(
document);
if (model == null) {
return;
}
try {
apply(document, viewer,
(IDOMElement) model.getDocument().getDocumentElement());
} finally {
model.releaseFromEdit();
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:17,代码来源:WidgetProposalComputer.java
示例5: removeSchemaUiBinderElementProposal
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private void removeSchemaUiBinderElementProposal(
IStructuredDocument document, List<ICompletionProposal> proposals) {
IDOMModel model = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(
document);
try {
IDOMElement rootElement = (IDOMElement) model.getDocument().getDocumentElement();
if (rootElement == null) {
// There is no root element, so the <ui:UiBinder> is a valid proposal
return;
}
// Remove the proposal whose display string matches the root element's
// name (e.g. "ui:UiBinder")
for (Iterator<ICompletionProposal> it = proposals.iterator(); it.hasNext();) {
ICompletionProposal proposal = it.next();
if (rootElement.getNodeName().equals(proposal.getDisplayString())) {
it.remove();
}
}
} finally {
model.releaseFromRead();
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:UiBinderXmlCompletionProcessor.java
示例6: markDuplicateFieldErrors
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private void markDuplicateFieldErrors() {
for (ElExpressionFirstFragment fragment : firstFragmentComputer.getDuplicateFirstFragments()) {
IRegion region;
IDOMAttr fieldAttribute = (IDOMAttr) UiBinderXmlModelUtilities.getFieldAttribute(fragment.getNode());
if (fieldAttribute != null) {
region = XmlUtilities.getAttributeValueRegion(fieldAttribute);
} else {
List<IRegion> tagRegions = XmlUtilities.getElementTagRegions(
(IDOMElement) fragment.getNode(), true);
region = tagRegions.size() > 0 ? tagRegions.get(0) : null;
}
if (region != null) {
problemMarkerManager.setDuplicateFieldError(region, fragment.getValue());
}
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:18,代码来源:UiBinderXmlParser.java
示例7: tryParseCssElExpression
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private void tryParseCssElExpression(IDOMElement styleElement,
String remainingFragments, int remainingFragmentsOffsetInDoc,
IRegion fieldRefRegion) {
CssExtractor extractor = UiBinderXmlModelUtilities.createCssExtractorForStyleElement(
styleElement, javaProject);
if (extractor != null) {
for (String selector : CssSelectorNameCollector.getValidSelectorNames(extractor.getCssDocument())) {
if (selector.equals(remainingFragments)) {
return;
}
}
}
if (remainingFragments.length() > 0) {
problemMarkerManager.setCssSelectorFragmentUndefinedError(new Region(
remainingFragmentsOffsetInDoc, remainingFragments.length()),
remainingFragments);
} else {
problemMarkerManager.setCssSelectorFragmentUnspecifiedError(fieldRefRegion);
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:22,代码来源:UiBinderXmlParser.java
示例8: tryParseStyleElement
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
/**
* Parses ui:style elements.
*/
private void tryParseStyleElement(IDOMElement element) {
if (!UiBinderXmlModelUtilities.isStyleElement(element)) {
return;
}
// Check for duplicate selector names
CssExtractor extractor = UiBinderXmlModelUtilities.createCssExtractorForStyleElement(
element, javaProject);
if (extractor != null) {
String errorMessage = CssSelectorNameCollector.getDuplicateSelectorNamesErrorMessage(extractor.getCssDocument());
if (errorMessage != null) {
List<IRegion> elementTagRegions = XmlUtilities.getElementTagRegions(
element, true);
problemMarkerManager.setDuplicateCssSelectorError(
elementTagRegions.get(0), errorMessage);
}
}
tryParseStyleElementSrcAttribute(element);
tryParseTypeAttribute(element);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:UiBinderXmlParser.java
示例9: createCssExtractorForStyleElement
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
/**
* Creates a {@link CssExtractor} from a <ui:style> element.
*
* @param styleElement the style element that contains CSS inline, a src
* attribute pointing to an external CSS file, or both
* @return a CSS extractor for the CSS, or null
*/
public static CssExtractor createCssExtractorForStyleElement(
IDOMElement styleElement, IJavaProject javaProject) {
// The contents of the element is appended to the source files
String cssBlock = "";
String externalCssContents = getExternalCssContents(styleElement,
javaProject);
if (externalCssContents != null) {
cssBlock += externalCssContents;
}
Node contents = styleElement.getFirstChild();
if (contents != null) {
cssBlock += contents.getNodeValue();
}
if (cssBlock.trim().length() == 0) {
return null;
}
return CssExtractor.extract(cssBlock, new CssResourceAwareModelLoader());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:30,代码来源:UiBinderXmlModelUtilities.java
示例10: validateStatementId
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private void validateStatementId(IDOMElement element, IFile file, IDOMDocument doc,
ValidationResult result, IJavaProject project, IDOMAttr attr, String attrValue)
throws JavaModelException, XPathExpressionException
{
if (attrValue == null)
{
return;
}
String qualifiedName = MybatipseXmlUtil.getNamespace(doc);
IType mapperType = project.findType(qualifiedName);
if (mapperType != null
&& !JavaMapperCache.getInstance().methodExists(project, qualifiedName, attrValue))
{
addMarker(result, file, doc.getStructuredDocument(), attr, MISSING_STATEMENT_METHOD,
IMarker.SEVERITY_WARNING, IMarker.PRIORITY_HIGH,
"Method '" + attrValue + "' not found or there is an overload method"
+ " (same name with different parameters) in mapper interface " + qualifiedName);
}
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:21,代码来源:XmlValidator.java
示例11: 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;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:21,代码来源:HTMLAngularAttributeValidator.java
示例12: validateAttributeValue
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
private ValidationMessage validateAttributeValue(IDOMElement target, String attrName) {
AngularType type = directive.getDirectiveType();
switch (type) {
case module:
case controller:
try {
IFile file = getFile();
IDocument document = getDocument();
IIDETernProject ternProject = AngularProject.getTernProject(file.getProject());
IDOMAttr attr = (IDOMAttr) target.getAttributeNode(attrName);
boolean exists = isAngularElementExists(attr, file, document, ternProject, type);
if (!exists) {
Segment segment = CustomValidatorUtil.getAttributeSegment(
(IDOMNode) target.getAttributeNode(attrName), CustomValidatorUtil.ATTR_REGION_VALUE);
return new ValidationMessage(
NLS.bind(AngularCoreMessages.Validation_AngularElementNotFound, type.name(),
attr.getValue()),
segment.getOffset(), segment.getLength(), ValidationMessage.ERROR);
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error while Angular validator.", e);
}
break;
}
return null;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:27,代码来源:HTMLAngularAttributeValidator.java
示例13: getAttr
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
/**
* Returns the SSE DOM attribute by name from the ownner element.
*
* @param element
* @param attrName
* @return
*/
public static IDOMAttr getAttr(IDOMElement element, String attrName) {
if (StringUtils.isEmpty(attrName)) {
return null;
}
String prefix = element.getPrefix();
if (!StringUtils.isEmpty(prefix)) {
String namespaceURI = element.getNamespaceURI();
IDOMAttr attr = (IDOMAttr) element.getAttributeNodeNS(namespaceURI,
attrName);
if (attr != null) {
return attr;
}
}
return (IDOMAttr) element.getAttributeNode(attrName);
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:23,代码来源:DOMUtils.java
示例14: canValidate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
@Override
public boolean canValidate(IDOMElement target, String attrName) {
if (!super.hasAngularNature()) {
return false;
}
// It's an Angular project, check if attribute name starts with '(',
// '[', '*', 'bind-' or 'on-', etc.
return AngularCorePlugin.getBindingManager().isNgBindingType(attrName);
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:10,代码来源:HTMLAngularAttributeValidator.java
示例15: canValidate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
@Override
public boolean canValidate(IDOMElement target) {
if (!super.hasAngularNature()) {
return false;
}
if (TEMPLATE_ELEMENT.equals(target.getTagName())) {
return true;
}
// TODO: search definition of directive inside *.ts files
return false;
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:12,代码来源:HTMLAngularTagValidator.java
示例16: 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);
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:39,代码来源:BaseEventBinding.java
示例17: 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);
}
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:15,代码来源:VarBindingCanonicalSyntax.java
示例18: 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);
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:32,代码来源:BasePropertyBinding.java
示例19: 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
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:28,代码来源:BasePropertyBinding.java
示例20: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; //导入依赖的package包/类
@Override
public ValidationMessage validate(IDOMElement target, String attrName, IFile file) {
try {
// See normalize attribute rule in
// @angular/compiler/src/template_parser.ts
String name = extractName(this.normalizeAttributeName(attrName));
return validate(name, target, attrName, file);
} catch (NgBindingTypeException e) {
return createValidationMessage(target, attrName, e.getMessage(), e.getSeverity());
}
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:12,代码来源:AbstractNgBindingType.java
注:本文中的org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论