• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IStructuredDocumentRegion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IStructuredDocumentRegion类属于org.eclipse.wst.sse.core.internal.provisional.text包,在下文中一共展示了IStructuredDocumentRegion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: consumes

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
@Override
public Position[] consumes(IStructuredDocumentRegion documentRegion,
		IndexedRegion indexedRegion) {
	if (indexedRegion != null && indexedRegion instanceof IDOMNode) {
		IDOMNode node = (IDOMNode) indexedRegion;
		IFile file = DOMUtils.getFile(node);
		if (canConsume(file)) {
			// project has angular nature, compute positions.
			List<Position> positions = consumes(node, file, documentRegion);
			if (positions != null) {
				return positions.toArray(EMPTY_POSITION);
			}
		}
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:17,代码来源:AbstractAngularSemanticHighlighting.java


示例2: 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


示例3: 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;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:XmlUtilities.java


示例4: fixPotentialEmptyMaskedMediaRule

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
private void fixPotentialEmptyMaskedMediaRule(ICSSNode node) {
  CSSMediaRule mediaRule = (CSSMediaRule) node;
  IndexedRegion mediaRuleRegion = (IndexedRegion) mediaRule;

  if (!containsEmptyMaskedMediaRule(mediaRule, mediaRuleRegion)) {
    return;
  }

  // Set the range to a valid value (it won't be proper since we don't have
  // any additional words that can be categorized as CSS_MEDIUM.)
  MediaList mediaList = mediaRule.getMedia();
  IStructuredDocumentRegion[] structuredDocumentRegions = structuredDocument.getStructuredDocumentRegions(
      mediaRuleRegion.getStartOffset(), mediaRuleRegion.getLength());

  // The value we set is a 0-length region starting where the next word would
  // have been
  ITextRegion textRegion = new ContextRegion(CSSRegionContexts.CSS_MEDIUM,
      structuredDocumentRegions[0].getEndOffset()
          - structuredDocumentRegions[0].getStartOffset(), 0, 0);

  try {
    callSetRangeRegion(mediaList, structuredDocumentRegions, textRegion);
  } catch (Throwable e) {
    GWTPluginLog.logError(e, "Could not clean up the @else in the CSS model.");
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:27,代码来源:CssResourceAwareModelRepairer.java


示例5: isCssPartition

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * Determines whether the given XML model-backed region is an inlined CSS
 * partition.
 */
private boolean isCssPartition(ITextRegion textRegion, int offset) {

  if (CSS_DISALLOWED_TYPES.contains(textRegion.getType())) {
    return false;
  }
  
  IStructuredDocumentRegion region = fStructuredDocument.getRegionAtCharacterOffset(offset);

  // Backtrack to find the tag open
  IStructuredDocumentRegion tagOpenRegion = SseUtilities.findStructuredDocumentRegion(
      OPEN_TYPES, CLOSED_TYPES, region, false);
  if (tagOpenRegion == null) {
    return false;
  }

  // Notice we do not search for the closing tag. Anything including or past
  // the closing tag will not be tagged as CSS because of our checks above.
  return isStyleElement(tagOpenRegion);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:StructuredTextPartitionerForUiBinderXml.java


示例6: getTextLength

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * 
 */
public static int getTextLength(IStructuredDocumentRegionList nodes) {
	int length = 0;

	if (nodes != null) {
		for (Enumeration e = nodes.elements(); e.hasMoreElements();) {
			IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e
					.nextElement();
			if (flatNode != null) {
				length += flatNode.getText().length();
			}
		}
	}

	return length;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:19,代码来源:JSONUtil.java


示例7: getMatchString

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
private String getMatchString(IStructuredDocumentRegion parent,
		ITextRegion aRegion, int offset) {
	if (aRegion == null) {
		return "";
	}
	String regionType = aRegion.getType();
	if (regionType != JSONRegionContexts.JSON_OBJECT_KEY) {
		return "";
	}
	if ((parent.getText(aRegion).length() > 0)
			&& (parent.getStartOffset(aRegion) < offset)) {
		return parent.getText(aRegion).substring(0,
				offset - parent.getStartOffset(aRegion));
	}
	return "";
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:17,代码来源:AbstractJSONCompletionProposalComputer.java


示例8: getRegionText

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * 
 */
public static String getRegionText(IStructuredDocumentRegion flatNode,
		ITextRegionList regions) {
	StringBuffer buf = new StringBuffer();
	if (regions != null) {
		for (Iterator i = regions.iterator(); i.hasNext();) {
			ITextRegion region = (ITextRegion) i.next();
			if (region == null) {
				continue;
			}
			buf.append(flatNode.getText(region));
		}
	}

	return buf.toString();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:19,代码来源:JSONUtil.java


示例9: computeRegionHelp

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * Computes the hoverhelp based on region
 * 
 * @return String hoverhelp
 */
protected String computeRegionHelp(IndexedRegion treeNode,
		IJSONNode parentNode, IStructuredDocumentRegion flatNode,
		ITextRegion region) {
	if (region == null) {
		return null;
	}
	String regionType = region.getType();
	if (regionType == JSONRegionContexts.JSON_OBJECT_KEY) {
		return computeObjectKeyHelp((IJSONPair) treeNode, parentNode,
				flatNode, region);
	}
	if (JSONUtil.isJSONSimpleValue(regionType)) {
		return computeValueHelp((IJSONValue) treeNode, parentNode,
				flatNode, region);
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:23,代码来源:JSONHoverProcessor.java


示例10: getDocumentRegions

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
@Override
public IStructuredDocumentRegion getDocumentRegions() {
	IStructuredDocumentRegion headnode = null;
	if (headnode == null) {
		if (Debug.perfTest) {
			fStartTime = System.currentTimeMillis();
		}
		headnode = parseNodes();
		if (Debug.perfTest) {
			fStopTime = System.currentTimeMillis();
			System.out
					.println(" -- creating nodes of IStructuredDocument -- "); //$NON-NLS-1$
			System.out
					.println(" Time parse and init all regions: " + (fStopTime - fStartTime) + " (msecs)"); //$NON-NLS-2$//$NON-NLS-1$
			// System.out.println(" for " + fRegions.size() + "
			// Regions");//$NON-NLS-2$//$NON-NLS-1$
			System.out
					.println("      and " + _countNodes(headnode) + " Nodes"); //$NON-NLS-2$//$NON-NLS-1$
		}
	}
	return headnode;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:23,代码来源:JSONSourceParser.java


示例11: getRegions

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * Return the full list of known regions. Typically getNodes should be used
 * instead of this method.
 */
@Override
public List getRegions() {
	IStructuredDocumentRegion headNode = null;
	if (!getTokenizer().isEOF()) {
		headNode = getDocumentRegions();
		// throw new IllegalStateException("parsing has not finished");
	}
	// for memory recovery, we assume if someone
	// requests all regions, we can reset our big
	// memory consuming objects
	// but the new "getRegions" method is then more expensive.
	// I don't think its used much, though.
	List localRegionsList = getRegions(headNode);
	primReset();
	return localRegionsList;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:21,代码来源:JSONSourceParser.java


示例12: getUpdateRangeForDelimiter

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
private ReparseRange getUpdateRangeForDelimiter(int start, int end) {
	if (dirtyStart != null && dirtyStart.getStart() < start) {
		start = dirtyStart.getStart();
	}
	IStructuredDocumentRegion docRegion = fStructuredDocument
			.getRegionAtCharacterOffset(start);
	if (docRegion == null) {
		return null;
	}
	// if (docRegion.getType() == JSONRegionContexts.JSON_DELIMITER) {
	// IStructuredDocumentRegion prevRegion = docRegion.getPrevious();
	// if (prevRegion != null) {
	// return new ReparseRange(prevRegion.getStart(), end);
	// }
	// }

	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:19,代码来源:JSONStructuredDocumentReParser.java


示例13: 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


示例14: getChildInsertPos

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
	 * 
	 */
	public int getChildInsertPos(IJSONNode node) {
		int n = ((IndexedRegion) node).getEndOffset();
		if (n > 0) {
			IStructuredDocument structuredDocument = node.getOwnerDocument()
					.getModel().getStructuredDocument();
			IStructuredDocumentRegion flatNode = structuredDocument
					.getRegionAtCharacterOffset(n - 1);
			ITextRegion region = flatNode.getRegionAtCharacterOffset(n - 1);
			RegionIterator it = new RegionIterator(flatNode, region);
			while (it.hasPrev()) {
				ITextRegion reg = it.prev();
//				if (reg.getType() == JSONRegionContexts.JSON_CDC)
//					return it.getStructuredDocumentRegion().getStartOffset(reg);
			}
			return n;
		}
		return -1;
	}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONDocumentFormatter.java


示例15: 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;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONUtil.java


示例16: toString

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
@Override
public String toString() {
	StringBuilder buffer = new StringBuilder();
	String tagName = getName();
	buffer.append(tagName);
	IStructuredDocumentRegion startStructuredDocumentRegion = getStartStructuredDocumentRegion();
	if (startStructuredDocumentRegion != null) {
		buffer.append('@');
		buffer.append(startStructuredDocumentRegion.toString());
	}
	IStructuredDocumentRegion endStructuredDocumentRegion = getEndStructuredDocumentRegion();
	if (endStructuredDocumentRegion != null) {
		buffer.append('@');
		buffer.append(endStructuredDocumentRegion.toString());
	}
	return buffer.toString();

}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:19,代码来源:JSONPairImpl.java


示例17: toString

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * toString method
 * 
 * @return java.lang.String
 */
public String toString() {
	StringBuffer buffer = new StringBuffer();
	buffer.append('{');
	int count = getStructuredDocumentRegionCount();
	for (int i = 0; i < count; i++) {
		if (i != 0)
			buffer.append(',');
		IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(i);
		if (flatNode == null)
			buffer.append("null");//$NON-NLS-1$
		else
			buffer.append(flatNode.toString());
	}
	buffer.append('}');
	return buffer.toString();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:StructuredDocumentRegionContainer.java


示例18: toString

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
public String toString() {
	StringBuilder buffer = new StringBuilder();
	String tagName = null;//getName();
	if (hasStartTag())
		buffer.append(tagName);
	if (isEmptyTag())
		buffer.append('/');
	if (hasEndTag()) {
		buffer.append('/');
		buffer.append(tagName);
	}
	if (buffer.length() == 0)
		buffer.append(tagName);

	IStructuredDocumentRegion startStructuredDocumentRegion = getStartStructuredDocumentRegion();
	if (startStructuredDocumentRegion != null) {
		buffer.append('@');
		buffer.append(startStructuredDocumentRegion.toString());
	}
	IStructuredDocumentRegion endStructuredDocumentRegion = getEndStructuredDocumentRegion();
	if (endStructuredDocumentRegion != null) {
		buffer.append('@');
		buffer.append(endStructuredDocumentRegion.toString());
	}
	return buffer.toString();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:27,代码来源:JSONObjectImpl.java


示例19: 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


示例20: changeStructuredDocumentRegion

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; //导入依赖的package包/类
/**
 * changeStructuredDocumentRegion method
 * 
 */
private void changeStructuredDocumentRegion(
		IStructuredDocumentRegion flatNode) {
	if (flatNode == null)
		return;
	if (this.model.getDocument() == null)
		return;

	setupContext(flatNode);

	removeStructuredDocumentRegion(flatNode);
	// make sure the parent is set to deepest level
	// when end tag has been removed
	this.context.setLast();
	insertStructuredDocumentRegion(flatNode);

	// cleanupText();
	cleanupEndTag();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:23,代码来源:JSONModelParser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HostedRoom类代码示例发布时间:2022-05-22
下一篇:
Java MockitoHamcrest类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap