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


Java IStructuredDocumentRegion类代码示例

本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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