当前位置: 首页>>代码示例>>Java>>正文


Java IStructuredModel.getIndexedRegion方法代码示例

本文整理汇总了Java中org.eclipse.wst.sse.core.internal.provisional.IStructuredModel.getIndexedRegion方法的典型用法代码示例。如果您正苦于以下问题:Java IStructuredModel.getIndexedRegion方法的具体用法?Java IStructuredModel.getIndexedRegion怎么用?Java IStructuredModel.getIndexedRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.wst.sse.core.internal.provisional.IStructuredModel的用法示例。


在下文中一共展示了IStructuredModel.getIndexedRegion方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNodeByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的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: smartInsertCloseEndEL

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的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

示例3: getNodeByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的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

示例4: smartInsertCloseEndEL

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的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

示例5: collectJSONNodes

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
public List collectJSONNodes(IStructuredModel model, int start, int length) {
	List nodes = new ArrayList();

	IndexedRegion startNode = model.getIndexedRegion(start);
	IndexedRegion endNode = model.getIndexedRegion(start + length - 1);

	if (startNode == null || endNode == null) {
		return nodes;
	}

	if (model instanceof IJSONModel && startNode instanceof IJSONNode
			&& endNode instanceof IJSONNode) {
		// JSON model
		IJSONNode ca = getCommonAncestor((IJSONNode) startNode,
				(IJSONNode) endNode);
		if (ca != null) {
			for (IJSONNode node = ca.getFirstChild(); node != null
					&& start + length < ((IndexedRegion) node)
							.getStartOffset(); node = node.getNextSibling()) {
				if (start < ((IndexedRegion) node).getEndOffset()) {
					nodes.add(node);
				}
			}
		}
	}
	return nodes;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:28,代码来源:JSONFormatUtil.java

示例6: getCurrentNode

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the node the cursor is currently on in the document. null if no node is selected
 * 
 * @param offset
 * @return Node either element, doctype, text, or null
 */
private Node getCurrentNode(IDocument document, int offset)
{
	// get the current node at the offset (returns either: element,
	// doctype, text)
	IndexedRegion inode = null;
	IStructuredModel sModel = null;
	try
	{
		sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		if (sModel != null)
		{
			inode = sModel.getIndexedRegion(offset);
			if (inode == null)
			{
				inode = sModel.getIndexedRegion(offset - 1);
			}
		}
	}
	finally
	{
		if (sModel != null)
			sModel.releaseFromRead();
	}

	if (inode instanceof Node)
	{
		return (Node)inode;
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:37,代码来源:XmlHyperlinkDetector.java

示例7: getAttrByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
public static final IDOMAttr getAttrByOffset(IStructuredModel model,
		int offset) {
	if (model != null) {
		IndexedRegion node = model.getIndexedRegion(offset);
		if (node instanceof IDOMNode) {
			return getAttrByOffset(node, offset);
		}
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:11,代码来源:DOMHelper.java


注:本文中的org.eclipse.wst.sse.core.internal.provisional.IStructuredModel.getIndexedRegion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。