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


Java IStructuredDocumentRegion.getStart方法代码示例

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


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

示例1: getStartOffset

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * getStartOffset method
 * 
 * @return int
 */
public int getStartOffset() {
	if (this.flatNode != null)
		return this.flatNode.getStart();
	JSONNodeImpl prev = (JSONNodeImpl) getPreviousSibling();
	if (prev != null)
		return prev.getEndOffset();
	IJSONNode parent = getParentNode();
	if (parent != null && parent.getNodeType() == IJSONNode.OBJECT_NODE) {
		JSONObjectImpl element = (JSONObjectImpl) parent;
		if (element.hasStartTag())
			return element.getStartEndOffset();
		return element.getStartOffset();
	}
	// final fallback to look into first child
	JSONNodeImpl child = (JSONNodeImpl) getFirstChild();
	while (child != null) {
		IStructuredDocumentRegion childStructuredDocumentRegion = child
				.getStructuredDocumentRegion();
		if (childStructuredDocumentRegion != null)
			return childStructuredDocumentRegion.getStart();
		child = (JSONNodeImpl) child.getFirstChild();
	}
	return 0;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:30,代码来源:JSONNodeImpl.java

示例2: changeAttrName

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * changeAttrName method
 * 
 */
private void changeAttrName(IStructuredDocumentRegion flatNode,
		ITextRegion region) {
	int offset = flatNode.getStart();
	if (offset < 0)
		return;
	JSONNodeImpl root = (JSONNodeImpl) this.context.getRootNode();
	if (root == null)
		return;
	IJSONNode node = root.getNodeAt(offset);
	if (node == null)
		return;
	if (node.getNodeType() != IJSONNode.PAIR_NODE) {
		return;
	}

	JSONPairImpl pair = (JSONPairImpl) node;
	String name = flatNode.getText(region); 
	pair.setName(name);
	/*
	 * List<IJSONPair> attributes = element.getPairs(); if (attributes ==
	 * null) return; for (IJSONPair attr : attributes) { if (((JSONPairImpl)
	 * attr).getNameRegion() != region) continue;
	 * 
	 * String name = flatNode.getText(region); ((JSONPairImpl)
	 * attr).setName(name); break; }
	 */
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:32,代码来源:JSONModelParser.java

示例3: getStart

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 */
public int getStart() {
	IStructuredDocumentRegion first = getFirstStructuredDocumentRegion();
	if (first == null)
		return 0;
	return first.getStart();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:9,代码来源:StructuredDocumentRegionContainer.java

示例4: setStructuredDocumentRegion

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 */
void setStructuredDocumentRegion(IStructuredDocumentRegion flatNode) {
	if (this.flatNode != null)
		this.offset += this.flatNode.getStart();
	this.flatNode = flatNode;
	if (this.flatNode != null)
		this.offset -= flatNode.getStart();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:10,代码来源:StructuredDocumentRegionProxy.java

示例5: changeEndTag

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 */
private void changeEndTag(IStructuredDocumentRegion flatNode,
		ITextRegionList newRegions, ITextRegionList oldRegions) {
	int offset = flatNode.getStart();
	if (offset < 0)
		return; // error
	JSONNodeImpl root = (JSONNodeImpl) this.context.getRootNode();
	if (root == null)
		return; // error
	IJSONNode node = root.getNodeAt(offset);
	if (node == null)
		return; // error

	if (node.getNodeType() != IJSONNode.OBJECT_NODE) {
		changeStructuredDocumentRegion(flatNode);
		return;
	}

	// check if change is only for close tag
	// if (newRegions != null) {
	// Iterator e = newRegions.iterator();
	// while (e.hasNext()) {
	// ITextRegion region = (ITextRegion) e.next();
	// String regionType = region.getType();
	// if (regionType == JSONRegionContexts.JSON_TAG_CLOSE)
	// continue;
	//
	// // other region has changed
	// changeStructuredDocumentRegion(flatNode);
	// return;
	// }
	// }
	// if (oldRegions != null) {
	// Iterator e = oldRegions.iterator();
	// while (e.hasNext()) {
	// ITextRegion region = (ITextRegion) e.next();
	// String regionType = region.getType();
	// if (regionType == JSONRegionContexts.JSON_TAG_CLOSE)
	// continue;
	//
	// // other region has changed
	// changeStructuredDocumentRegion(flatNode);
	// return;
	// }
	// }

	// change for close tag has no impact
	// do nothing
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:51,代码来源:JSONModelParser.java

示例6: setupContext

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * setupContext method
 * 
 */
private void setupContext(
		IStructuredDocumentRegion startStructuredDocumentRegion) {
	int offset = startStructuredDocumentRegion.getStart();
	if (offset < 0)
		return;
	JSONNodeImpl root = (JSONNodeImpl) this.context.getRootNode();
	if (root == null)
		return;

	if (offset == 0) {
		// at the beginning of document
		IJSONNode child = root.getFirstChild();
		if (child != null)
			this.context.setNextNode(child);
		else
			this.context.setParentNode(root);
		return;
	}

	JSONNodeImpl node = (JSONNodeImpl) root.getNodeAt(offset);
	if (node == null) {
		// might be at the end of document
		this.context.setParentNode(root);
		this.context.setLast();
		return;
	}

	if (offset == node.getStartOffset()) {
		this.context.setNextNode(node);
		return;
	}

	// if (node.getNodeType() == Node.TEXT_NODE) {
	// TextImpl text = (TextImpl) node;
	// Text nextText = text.splitText(startStructuredDocumentRegion);
	// // notify the change
	// text.notifyValueChanged();
	// if (nextText == null)
	// return; // error
	// this.context.setNextNode(nextText);
	// return;
	// }

	for (IJSONNode child = node.getFirstChild(); child != null; child = child
			.getNextSibling()) {
		if (offset >= ((JSONNodeImpl) child).getEndOffset())
			continue;
		this.context.setNextNode(child);
		return;
	}
	this.context.setParentNode(node);
	this.context.setLast();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:58,代码来源:JSONModelParser.java


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