本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}