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


Java IStructuredDocumentRegion.getPrevious方法代码示例

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


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

示例1: findStructuredDocumentRegion

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * Searches for the specified structured document region type, in the
 * direction specified.
 * 
 * @param types if one of these is found, the method will return
 * @param abortTypes optional, if one of these is found before one of
 *          <code>types</code> is found, the method will return null
 * @param searchStartRegion the region to start the search at, exclusive
 * @param searchForward true to search forward, false to search backward
 * @return the region, or null
 */
public static IStructuredDocumentRegion findStructuredDocumentRegion(
    Set<String> types, Set<String> abortTypes,
    IStructuredDocumentRegion searchStartRegion,
    boolean searchForward) {

  IStructuredDocumentRegion region = searchForward
      ? searchStartRegion.getNext() : searchStartRegion.getPrevious();
  while (region != null) {
    ITextRegionList textRegions = region.getRegions();
    for (int i = 0; i < textRegions.size(); i++) {
      String curType = textRegions.get(i).getType();

      if (abortTypes != null && abortTypes.contains(curType)) {
        return null;
      } else if (types.contains(curType)) {
        return region;
      }
    }

    region = searchForward ? region.getNext() : region.getPrevious();
  }
  
  return null;    
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:36,代码来源:SseUtilities.java

示例2: findRuleStart

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
private IStructuredDocumentRegion findRuleStart(
		IStructuredDocumentRegion startRegion) {
	IStructuredDocumentRegion region = startRegion;
	// find '{'
	while (region != null
			&& (region.getType() != JSONRegionContexts.JSON_OBJECT_OPEN && region
					.getType() != JSONRegionContexts.JSON_ARRAY_OPEN)) {
		region = region.getPrevious();
	}
	// if (region == startRegion) {
	// return null;
	// } else
	if (region != null) { // '{' is found
	// region = region.getPrevious();
	// if (isLeadingDeclarationType(region.getType())) {
	// return region;
	// }
		return region;
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONStructuredDocumentReParser.java

示例3: findPreviousSignificantNode

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * 
 */
public static IStructuredDocumentRegion findPreviousSignificantNode(
		IStructuredDocumentRegion startNode) {
	if (startNode == null) {
		return null;
	}
	IStructuredDocumentRegion node = startNode.getPrevious();
	while (node != null) {
		String type = getStructuredDocumentRegionType(node);
		/*
		 * if (type != JSONRegionContexts.JSON_S && type !=
		 * JSONRegionContexts.JSON_COMMENT && type !=
		 * JSONRegionContexts.JSON_CDO && type !=
		 * JSONRegionContexts.JSON_CDC) { return node; }
		 */
		node = node.getPrevious();
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONUtil.java

示例4: findNodeBackward

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
 * 
 */
public static IStructuredDocumentRegion findNodeBackward(
		IStructuredDocumentRegion startNode,
		IStructuredDocumentRegion endNode, String type) {
	IStructuredDocumentRegion node;
	for (node = startNode; node != null; node = node.getPrevious()) {
		if (node.getStartOffset() < endNode.getStartOffset()) {
			node = null;
			break;
		} else if (getStructuredDocumentRegionType(node) == type) {
			break;
		}
	}
	return node;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:18,代码来源:JSONUtil.java


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