本文整理汇总了Java中org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion.getNext方法的典型用法代码示例。如果您正苦于以下问题:Java IStructuredDocumentRegion.getNext方法的具体用法?Java IStructuredDocumentRegion.getNext怎么用?Java IStructuredDocumentRegion.getNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion
的用法示例。
在下文中一共展示了IStructuredDocumentRegion.getNext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: visitDomTextRegions
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的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;
}
示例3: findNextSignificantNode
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
*
*/
public static IStructuredDocumentRegion findNextSignificantNode(
IStructuredDocumentRegion startNode) {
if (startNode == null) {
return null;
}
IStructuredDocumentRegion node = startNode.getNext();
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.getNext();
}
return null;
}
示例4: applyStyles
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
* Color the text in the sample area according to the current preferences
*/
void applyStyles() {
if (fText == null || fText.isDisposed())
return;
IStructuredDocumentRegion documentRegion = fDocument
.getFirstStructuredDocumentRegion();
while (documentRegion != null) {
ITextRegionList regions = documentRegion.getRegions();
for (int i = 0; i < regions.size(); i++) {
ITextRegion currentRegion = regions.get(i);
// lookup the local coloring type and apply it
String namedStyle = (String) fContextToStyleMap
.get(currentRegion.getType());
if (namedStyle == null)
continue;
TextAttribute attribute = getAttributeFor(namedStyle);
if (attribute == null)
continue;
StyleRange style = new StyleRange(
documentRegion.getStartOffset(currentRegion),
currentRegion.getTextLength(),
attribute.getForeground(), attribute.getBackground(),
attribute.getStyle());
style.strikeout = (attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
style.underline = (attribute.getStyle() & TextAttribute.UNDERLINE) != 0;
fText.setStyleRange(style);
}
documentRegion = documentRegion.getNext();
}
}
示例5: getNamedStyleAtOffset
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
private String getNamedStyleAtOffset(int offset) {
// ensure the offset is clean
if (offset >= fDocument.getLength())
return getNamedStyleAtOffset(fDocument.getLength() - 1);
else if (offset < 0)
return getNamedStyleAtOffset(0);
IStructuredDocumentRegion documentRegion = fDocument
.getFirstStructuredDocumentRegion();
while (documentRegion != null && !documentRegion.containsOffset(offset)) {
documentRegion = documentRegion.getNext();
}
if (documentRegion != null) {
// find the ITextRegion's Context at this offset
ITextRegion interest = documentRegion
.getRegionAtCharacterOffset(offset);
if (interest == null)
return null;
if (offset > documentRegion.getTextEndOffset(interest))
return null;
String regionContext = interest.getType();
if (regionContext == null)
return null;
// find the named style (internal/selectable name) for that
// context
String namedStyle = (String) fContextToStyleMap.get(regionContext);
if (namedStyle != null) {
return namedStyle;
}
}
return null;
}
示例6: getRegions
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
* Method getRegions.
*
* @param headNode
* @return List
*/
protected List getRegions(IStructuredDocumentRegion headNode) {
List allRegions = new ArrayList();
IStructuredDocumentRegion currentNode = headNode;
while (currentNode != null) {
ITextRegionList nodeRegions = currentNode.getRegions();
for (int i = 0; i < nodeRegions.size(); i++) {
allRegions.add(nodeRegions.get(i));
}
currentNode = currentNode.getNext();
}
return allRegions;
}
示例7: _countNodes
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
* This is a simple utility to count nodes. Used only for debug statements.
*/
private int _countNodes(IStructuredDocumentRegion nodes) {
int result = 0;
IStructuredDocumentRegion countNode = nodes;
while (countNode != null) {
result++;
countNode = countNode.getNext();
}
return result;
}
示例8: getRegionsWithoutWhiteSpaces
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
*
*/
protected CompoundRegion[] getRegionsWithoutWhiteSpaces(
IStructuredDocument model, IRegion reg, IJSONCleanupStrategy stgy) {
int start = reg.getOffset();
int end = reg.getOffset() + reg.getLength() - 1;
ArrayList list = new ArrayList();
IStructuredDocumentRegion flatNode = model
.getRegionAtCharacterOffset(start);
while (flatNode != null && flatNode.getStartOffset() <= end) {
ITextRegionList regionList = flatNode.getRegions();
Iterator it = regionList.iterator();
while (it.hasNext()) {
ITextRegion region = (ITextRegion) it.next();
if (flatNode.getStartOffset(region) < start)
continue;
if (end < flatNode.getStartOffset(region))
break;
if (region.getType() != JSONRegionContexts.WHITE_SPACE
|| (isCleanup() && !stgy.isFormatSource())) // for
// not
// formatting
// case
// on
// cleanup
// action
list.add(new CompoundRegion(flatNode, region));
}
flatNode = flatNode.getNext();
}
if (list.size() > 0) {
CompoundRegion[] regions = new CompoundRegion[list.size()];
list.toArray(regions);
return regions;
}
return new CompoundRegion[0];
}
示例9: findNodeForward
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
*
*/
public static IStructuredDocumentRegion findNodeForward(
IStructuredDocumentRegion startNode,
IStructuredDocumentRegion endNode, String type) {
IStructuredDocumentRegion node;
for (node = startNode; node != null; node = node.getNext()) {
if (endNode.getStartOffset() < node.getStartOffset()) {
node = null;
break;
} else if (getStructuredDocumentRegionType(node) == type) {
break;
}
}
return node;
}
示例10: applyStyles
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
* Color the text in the sample area according to the current preferences
*/
void applyStyles() {
if (fText == null || fText.isDisposed())
return;
IStructuredModel model = null;
try {
model = getDomModel();
IStructuredDocumentRegion documentRegion = model.getStructuredDocument().getFirstStructuredDocumentRegion();
while (documentRegion != null) {
ITextRegionList regions = documentRegion.getRegions();
for (int i = 0; i < regions.size(); i++) {
ITextRegion currentRegion = regions.get(i);
// lookup the local coloring type and apply it
String namedStyle = (String) fContextToStyleMap.get(currentRegion.getType());
if (namedStyle == null)
continue;
TextAttribute attribute = getAttributeFor(namedStyle);
if (attribute == null)
continue;
StyleRange style = new StyleRange(documentRegion.getStartOffset(currentRegion),
currentRegion.getTextLength(), attribute.getForeground(), attribute.getBackground(),
attribute.getStyle());
style.strikeout = (attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
style.underline = (attribute.getStyle() & TextAttribute.UNDERLINE) != 0;
fText.setStyleRange(style);
Position[] positions = null;
for (AbstractAngularSemanticHighlighting highlighting : SemanticHighlightingManager.getInstance()
.getHighlightings()) {
positions = highlighting.consumes(documentRegion,
model.getIndexedRegion(documentRegion.getStartOffset()));
if (positions != null) {
for (int j = 0; j < positions.length; j++) {
Position position = positions[j];
StyleRange styleRange = createStyleRange(
getAttributeFor(highlighting.getStyleStringKey()), position);
fText.setStyleRange(styleRange);
}
}
}
}
documentRegion = documentRegion.getNext();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (model != null) {
model.releaseFromRead();
}
}
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:56,代码来源:HTMLAngularEditorSyntaxColoringPreferencePage.java
示例11: getNamedStyleAtOffset
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
private String getNamedStyleAtOffset(int offset) {
IDOMModel model = null;
IStructuredDocument document = null;
try {
model = getDomModel();
document = model.getStructuredDocument();
// ensure the offset is clean
if (offset >= document.getLength())
return getNamedStyleAtOffset(document.getLength() - 1);
else if (offset < 0)
return getNamedStyleAtOffset(0);
IStructuredDocumentRegion documentRegion = document.getFirstStructuredDocumentRegion();
while (documentRegion != null && !documentRegion.containsOffset(offset)) {
documentRegion = documentRegion.getNext();
}
if (documentRegion != null) {
// find the ITextRegion's Context at this offset
ITextRegion interest = documentRegion.getRegionAtCharacterOffset(offset);
if (interest == null)
return null;
if (offset > documentRegion.getTextEndOffset(interest))
return null;
String regionContext = interest.getType();
if (regionContext == null)
return null;
// find the named style (internal/selectable name) for that
// context
String namedStyle = (String) fContextToStyleMap.get(regionContext);
if (namedStyle != null) {
return namedStyle;
}
}
} catch (IOException e) {
Trace.trace(Trace.SEVERE, "Error while loading DOM.", e);
} finally {
if (model != null) {
model.releaseFromRead();
}
}
return null;
}
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:42,代码来源:HTMLAngularEditorSyntaxColoringPreferencePage.java
示例12: getRegions
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入方法依赖的package包/类
/**
*
*/
protected CompoundRegion[] getRegions(IStructuredDocument model,
IRegion reg, IRegion exceptFor, String pickupType) {
int start = reg.getOffset();
int end = reg.getOffset() + reg.getLength();
int startE = (exceptFor != null) ? exceptFor.getOffset() : -1;
int endE = (exceptFor != null) ? exceptFor.getOffset()
+ exceptFor.getLength() : 0;
ArrayList list = new ArrayList();
IStructuredDocumentRegion flatNode = model
.getRegionAtCharacterOffset(start);
boolean pickuped = false;
while (flatNode != null && flatNode.getStartOffset() < end) {
ITextRegionList regionList = flatNode.getRegions();
Iterator it = regionList.iterator();
while (it.hasNext()) {
ITextRegion region = (ITextRegion) it.next();
if (flatNode.getStartOffset(region) < start)
continue;
if (end <= flatNode.getStartOffset(region))
break;
if (startE >= 0 && startE <= flatNode.getStartOffset(region)
&& flatNode.getEndOffset(region) <= endE)
continue;
// if (region.getType() == JSONRegionContexts.JSON_COMMENT
// || region.getType() == JSONRegionContexts.JSON_CDC
// || region.getType() == JSONRegionContexts.JSON_CDO)
// list.add(new CompoundRegion(flatNode, region));
// else
if (!pickuped && region.getType() == pickupType) {
list.add(new CompoundRegion(flatNode, region));
pickuped = true;
}
}
flatNode = flatNode.getNext();
}
if (list.size() > 0) {
CompoundRegion[] regions = new CompoundRegion[list.size()];
list.toArray(regions);
return regions;
}
return new CompoundRegion[0];
}