本文整理汇总了Java中org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode类的典型用法代码示例。如果您正苦于以下问题:Java IDOMNode类的具体用法?Java IDOMNode怎么用?Java IDOMNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDOMNode类属于org.eclipse.wst.xml.core.internal.provisional.document包,在下文中一共展示了IDOMNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getNodeByOffset
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
/**
* Returns the SSE DOM Node {@link IDOMNode} by offset from the
* {@link IStructuredModel} SSE mode and null if not found.
*
* @param model
* the SSE model.
* @param offset
* the offset.
* @return
*/
public static final IDOMNode getNodeByOffset(IStructuredModel model, int offset) {
IndexedRegion node = null;
if (model != null) {
node = model.getIndexedRegion(offset);
if (node instanceof IDOMNode) {
return (IDOMNode) node;
}
if (model != null) {
int lastOffset = offset;
node = model.getIndexedRegion(offset);
while (node == null && lastOffset >= 0) {
lastOffset--;
node = model.getIndexedRegion(lastOffset);
}
}
}
return (IDOMNode) node;
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:30,代码来源:DOMUtils.java
示例2: consumes
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
@Override
public Position[] consumes(IStructuredDocumentRegion documentRegion,
IndexedRegion indexedRegion) {
if (indexedRegion != null && indexedRegion instanceof IDOMNode) {
IDOMNode node = (IDOMNode) indexedRegion;
IFile file = DOMUtils.getFile(node);
if (canConsume(file)) {
// project has angular nature, compute positions.
List<Position> positions = consumes(node, file, documentRegion);
if (positions != null) {
return positions.toArray(EMPTY_POSITION);
}
}
}
return null;
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:17,代码来源:AbstractAngularSemanticHighlighting.java
示例3: smartInsertCloseEndEL
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private void smartInsertCloseEndEL(DocumentCommand command, IDocument document, IStructuredModel model) {
try {
if (isPreferenceEnabled(AngularUIPreferenceNames.TYPING_COMPLETE_END_EL) && command.text.equals("{") //$NON-NLS-1$
&& document.getLength() > 0 && document.getChar(command.offset - 1) == '{') {
IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset - 1);
command.text += "}}";
command.shiftsCaret = false;
command.caretOffset = command.offset + 1;
command.doit = false;
}
} catch (BadLocationException e) {
}
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:17,代码来源:StructuredAutoEditStrategyAngular.java
示例4: visitDomTextRegions
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
public static boolean visitDomTextRegions(IDOMNode node,
IStructuredDocumentRegion region, DomTextRegionVisitor visitor) {
while (region != null) {
if (!(region instanceof BasicStructuredDocumentRegion)) {
return false;
}
BasicStructuredDocumentRegion basicRegion = (BasicStructuredDocumentRegion) region;
ITextRegionList regions = basicRegion.getRegions();
for (int i = 0; i < regions.size(); i++) {
if (!visitor.visitDomTextRegion(node, region, regions.get(i))) {
return true;
}
}
region = region.getNext();
}
return true;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:XmlUtilities.java
示例5: newSetterAttributeProposalComputer
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
/**
* Creates a proposal computer for widget attributes based on existing type
* setter methods.
*/
public static IProposalComputer newSetterAttributeProposalComputer(
ContentAssistRequest contentAssistRequest, IJavaProject javaProject) {
IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
if (node.getNodeType() != IDOMNode.ELEMENT_NODE) {
return null;
}
String widgetTypeName = UiBinderXmlModelUtilities.computeQualifiedWidgetTypeName(node);
if (widgetTypeName == null) {
return null;
}
String matchString = contentAssistRequest.getMatchString();
return new SetterAttributeProposalComputer(node, widgetTypeName,
javaProject, matchString,
contentAssistRequest.getReplacementBeginPosition(),
matchString.length());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:ProposalComputerFactory.java
示例6: newUiPhAttributeProposalComputer
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
public static IProposalComputer newUiPhAttributeProposalComputer(
ContentAssistRequest contentAssistRequest) {
IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
if (node.getNodeType() != IDOMNode.ELEMENT_NODE) {
return null;
}
if (XmlUtilities.getAttribute(node,
UiBinderConstants.UI_BINDER_PH_ATTRIBUTE_NAME, true,
UiBinderConstants.UI_BINDER_XML_NAMESPACE) != null) {
// This element already has a ui:field attribute
return null;
}
// Only show this on HTML elements, which should be without a namespace
if (node.getNamespaceURI() != null) {
return null;
}
return createStaticTextProposalComputerForUiAttribute(
UiBinderConstants.UI_BINDER_PH_ATTRIBUTE_NAME, node,
contentAssistRequest);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:ProposalComputerFactory.java
示例7: attrReplaced
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
/**
* attrReplaced method
*
* @param element
* org.w3c.dom.Element
* @param newAttr
* org.w3c.dom.Attr
* @param oldAttr
* org.w3c.dom.Attr
*/
public void attrReplaced(Element element, Attr newAttr, Attr oldAttr) {
if (element == null)
return;
Attr attr = null;
String oldValue = null;
String newValue = null;
if (oldAttr != null) {
attr = oldAttr;
oldValue = oldAttr.getValue();
}
if (newAttr != null) {
attr = newAttr;
newValue = newAttr.getValue();
}
IDOMNode notifier = (IDOMNode) element;
int offset = notifier.getStartOffset();
notify(notifier, INodeNotifier.CHANGE, attr, oldValue, newValue, offset);
propertyChanged(notifier);
}
开发者ID:angelozerr,项目名称:eclipse-wtp-freemarker,代码行数:30,代码来源:FMModelNotifier.java
示例8: proposeStatementId
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private void proposeStatementId(ContentAssistRequest contentAssistRequest,
IJavaProject project, String matchString, int start, int length, IDOMNode node)
throws JavaModelException, XPathExpressionException
{
final List<ICompletionProposal> results = new ArrayList<ICompletionProposal>();
final MethodNameStore methodStore = new MethodNameStore();
String qualifiedName = MybatipseXmlUtil.getNamespace(node.getOwnerDocument());
JavaMapperUtil.findMapperMethod(methodStore, project, qualifiedName,
new RejectStatementAnnotation(matchString, false));
for (String methodName : methodStore.getMethodNames())
{
results.add(new CompletionProposal(methodName, start, length, methodName.length(),
Activator.getIcon(), methodName, null, null));
}
addProposals(contentAssistRequest, results);
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:17,代码来源:XmlCompletionProposalComputer.java
示例9: proposeProperty
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private void proposeProperty(ContentAssistRequest contentAssistRequest, String matchString,
int start, int length, IDOMNode node) throws JavaModelException
{
String javaType = MybatipseXmlUtil.findEnclosingType(node);
if (javaType != null && !MybatipseXmlUtil.isDefaultTypeAlias(javaType))
{
IJavaProject project = getJavaProject(contentAssistRequest);
IType type = project.findType(javaType);
if (type == null)
{
javaType = TypeAliasCache.getInstance().resolveAlias(project, javaType, null);
if (javaType == null)
return;
}
addProposals(contentAssistRequest, ProposalComputorHelper.proposePropertyFor(project,
start, length, javaType, false, -1, matchString));
}
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:19,代码来源:XmlCompletionProposalComputer.java
示例10: linkToXmlElement
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private IHyperlink linkToXmlElement(IJavaProject project, String targetElement,
String namespace, String id, IRegion linkRegion, ITextViewer viewer)
{
IFile mapperXmlFile = MapperNamespaceCache.getInstance().get(project, namespace, null);
if (mapperXmlFile == null)
return null;
IDOMDocument domDoc = MybatipseXmlUtil.getMapperDocument(mapperXmlFile);
if (domDoc == null)
return null;
try
{
IDOMNode node = (IDOMNode)XpathUtil.xpathNode(domDoc,
"//" + targetElement + "[@id='" + id + "']");
if (node != null)
{
IRegion destRegion = new Region(node.getStartOffset(),
node.getEndOffset() - node.getStartOffset());
return new ToXmlHyperlink(mapperXmlFile, linkRegion, "Open declaration", destRegion);
}
}
catch (XPathExpressionException e)
{
Activator.log(Status.ERROR, e.getMessage(), e);
}
return null;
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:27,代码来源:JavaHyperlinkDetector.java
示例11: getNodeByOffset
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
/**
* Returns the SSE DOM Node {@link IDOMNode} by offset from the
* {@link IStructuredModel} SSE mode and null if not found.
*
* @param model
* the SSE model.
* @param offset
* the offset.
* @return
*/
public static final IDOMNode getNodeByOffset(IStructuredModel model,
int offset) {
IndexedRegion node = null;
if (model != null) {
node = model.getIndexedRegion(offset);
if (node instanceof IDOMNode) {
return (IDOMNode) node;
}
int lastOffset = offset;
node = model.getIndexedRegion(offset);
while (node == null && lastOffset >= 0) {
lastOffset--;
node = model.getIndexedRegion(lastOffset);
}
}
return (IDOMNode) node;
}
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:29,代码来源:DOMHelper.java
示例12: addDirectiveParameter
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
public void addDirectiveParameter(
final ContentAssistRequest contentAssistRequest,
DirectiveParameter parameter, IDOMNode element,
IIDETernProject ternProject) {
// Add the directive parameter in the
// completion.
if (hasParameterAttribute(parameter, element)) {
return;
}
Directive directive = parameter.getDirective();
String displayString = parameter.getName() + " - "
+ directive.getModule().getName() + "#" + directive.getName();
String additionalProposalInfo = HTMLAngularPrinter
.getDirectiveParameterInfo(parameter);
Image image = ImageResource.getImage(ImageResource.IMG_DIRECTIVE_PARAM);
addProposal(contentAssistRequest, parameter.getName(),
DirectiveValue.required, null, displayString, image,
additionalProposalInfo, element, ternProject);
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:21,代码来源:HTMLAngularTagsCompletionProposalComputer.java
示例13: computeRegionHelp
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
protected String computeRegionHelp(IndexedRegion treeNode,
IDOMNode parentNode, IStructuredDocumentRegion flatNode,
ITextRegion region, int documentPosition, IDocument document) {
String result = null;
if (region == null) {
return null;
}
if (AngularDOMUtils.hasAngularNature(parentNode)) {
String regionType = region.getType();
if (regionType == DOMRegionContext.XML_CONTENT) {
return computeAngularExpressionHelp((IDOMNode) treeNode,
parentNode, flatNode, region, document,
documentPosition);
} else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
return computeTagAttValueHelp((IDOMNode) treeNode, parentNode,
flatNode, region, document, documentPosition);
}
}
return super.computeRegionHelp(treeNode, parentNode, flatNode, region);
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:21,代码来源:HTMLAngularTagInfoHoverProcessor.java
示例14: computeAngularExpressionHelp
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
protected String computeAngularExpressionHelp(IDOMNode treeNode,
IDOMNode parentNode, IStructuredDocumentRegion flatNode,
ITextRegion region, IDocument document, int documentPosition) {
IFile file = DOMUtils.getFile(treeNode);
try {
IIDETernProject ternProject = AngularProject.getTernProject(file
.getProject());
AngularELRegion angularRegion = AngularRegionUtils
.getAngularELRegion(flatNode, documentPosition,
file.getProject());
if (angularRegion != null) {
String expression = angularRegion.getExpression();
int expressionOffset = angularRegion.getExpressionOffset() + 1;
return computeHelp(treeNode, expression, expressionOffset,
file, document, ternProject, AngularType.model);
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error while tern hover.", e);
}
return null;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:22,代码来源:HTMLAngularTagInfoHoverProcessor.java
示例15: computeTagNameHelp
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
@Override
protected String computeTagNameHelp(IDOMNode xmlnode, IDOMNode parentNode,
IStructuredDocumentRegion flatNode, ITextRegion region) {
// Display Help of Angular Directive if it's an angular directive
// element
if (AngularDOMUtils.hasAngularNature(xmlnode)
&& xmlnode instanceof Element) {
Element element = (Element) xmlnode;
IProject project = DOMUtils.getFile(xmlnode).getProject();
Directive directive = AngularDOMUtils.getAngularDirective(project,
element);
if (directive != null) {
return HTMLAngularPrinter.getDirectiveInfo(directive);
}
}
return super.computeTagNameHelp(xmlnode, parentNode, flatNode, region);
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:18,代码来源:HTMLAngularTagInfoHoverProcessor.java
示例16: createHyperlinkForExpression
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private HTMLAngularHyperLink createHyperlinkForExpression(String regionType,
String regionText, int regionStartOffset, int documentPosition,
IDOMNode node, IDocument document, IIDETernProject ternProject,
IFile file, String startSymbol, String endSymbol) {
AngularELRegion angularRegion = AngularRegionUtils.getAngularELRegion(
regionType, regionText, regionStartOffset, documentPosition,
file.getProject());
if (angularRegion != null) {
String expression = angularRegion.getExpression();
int expressionOffset = angularRegion.getExpressionOffset();
return new HTMLAngularHyperLink(node, AngularELWordFinder.findWord(
document, documentPosition, startSymbol, endSymbol), file,
document, ternProject, expression, expressionOffset,
AngularType.model);
}
return null;
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:18,代码来源:HTMLAngularHyperLinkDetector.java
示例17: smartInsertCloseEndEL
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的package包/类
private void smartInsertCloseEndEL(DocumentCommand command,
IDocument document, IStructuredModel model) {
try {
if (isPreferenceEnabled(AngularUIPreferenceNames.TYPING_COMPLETE_END_EL)
&& command.text.equals("{") && document.getLength() > 0 && document.getChar(command.offset - 1) == '{') { //$NON-NLS-1$
IDOMNode node = (IDOMNode) model
.getIndexedRegion(command.offset - 1);
command.text += "}}";
command.shiftsCaret = false;
command.caretOffset = command.offset + 1;
command.doit = false;
}
} catch (BadLocationException e) {
}
}
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:19,代码来源:StructuredAutoEditStrategyAngular.java
示例18: validateAttribute
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的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
示例19: validateAttributeValue
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的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
示例20: validate
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; //导入依赖的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
注:本文中的org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论