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


Java IComment类代码示例

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


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

示例1: toString

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
protected String toString(ITextSegment region) {
	String result;
	if (region instanceof IEObjectRegion)
		result = toString((IEObjectRegion) region);
	else if (region instanceof ISemanticRegion)
		result = toString((ISemanticRegion) region);
	else if (region instanceof IHiddenRegion)
		result = toString((IHiddenRegion) region);
	else if (region instanceof IWhitespace)
		result = toString((IWhitespace) region);
	else if (region instanceof IComment)
		result = toString((IComment) region);
	else if (region != null)
		result = region.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(region));
	else
		result = "null";
	if (hightlightOrigin && region == origin)
		return ">>>" + result + "<<<";
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:TextRegionAccessToString.java

示例2: createCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public ITextReplacer createCommentReplacer(IComment comment) {
	EObject grammarElement = comment.getGrammarElement();
	if (grammarElement instanceof AbstractRule) {
		String ruleName = ((AbstractRule) grammarElement).getName();
		if (ruleName.startsWith("ML"))
			return new MultilineCommentReplacer(comment, '*');
		if (ruleName.startsWith("SL")) {
			if (comment.getLineRegions().get(0).getIndentation().getLength() > 0)
				return new SinglelineDocCommentReplacer(comment, "//");
			else
				return new SinglelineCodeCommentReplacer(comment, "//");
		}
	}
	String elementName = new GrammarElementTitleSwitch().showQualified().showRule().doSwitch(grammarElement);
	throw new IllegalStateException("No " + ITextReplacer.class.getSimpleName() + " configured for " + elementName);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:AbstractFormatter2.java

示例3: N4MultilineCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
/** @see MultilineCommentReplacer#MultilineCommentReplacer(IComment, char) */
public N4MultilineCommentReplacer(IComment comment, char prefix) {
	super(comment, prefix);
	this.prefix = prefix;
	multiline = comment.isMultiline();

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:N4MultilineCommentReplacer.java

示例4: collectAlternatingSpaceAndComments

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
protected List<ITextSegment> collectAlternatingSpaceAndComments(boolean includeComments) {
	List<IHiddenRegionPart> parts = getParts();
	if (parts.isEmpty()) {
		return Collections.<ITextSegment>singletonList(this);
	} else {
		ITextSegment lastWhitespace = null;
		List<ITextSegment> result = Lists.newArrayList();
		for (IHiddenRegionPart part : parts) {
			if (part instanceof IWhitespace) {
				if (lastWhitespace == null) {
					result.add(part);
					lastWhitespace = part;
				} else {
					int mergedLength = lastWhitespace.getLength() + part.getLength();
					lastWhitespace = new TextSegment(access, lastWhitespace.getOffset(), mergedLength);
					result.set(result.size() - 1, lastWhitespace);
				}
			} else if (part instanceof IComment) {
				if (lastWhitespace == null) {
					result.add(new TextSegment(access, part.getOffset(), 0));
				} else {
					lastWhitespace = null;
				}
				if (includeComments) {
					result.add(part);
				}
			}
		}
		if (lastWhitespace == null) {
			result.add(new TextSegment(access, getEndOffset(), 0));
		}
		return ImmutableList.copyOf(result);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:35,代码来源:AbstractHiddenRegion.java

示例5: containsComment

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
@Override
public boolean containsComment() {
	for (IHiddenRegionPart hidden : hiddens)
		if (hidden instanceof IComment)
			return true;
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:AbstractHiddenRegion.java

示例6: getFirstSpace

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
protected ITextSegment getFirstSpace() {
	IComment comment = getComment();
	String text = comment.getText();
	if (!text.startsWith(prefix))
		return null;
	int start = prefix.length();
	for (int i = start; i < text.length(); i++) {
		char charAt = text.charAt(i);
		if (!Character.isWhitespace(charAt) || charAt == '\r' || charAt == '\n')
			return new TextSegment(comment.getTextRegionAccess(), comment.getOffset() + start, i - start);
	}
	return new TextSegment(comment.getTextRegionAccess(), comment.getOffset() + start, text.length() - start);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:SinglelineCommentReplacer.java

示例7: hasEmptyBody

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
protected boolean hasEmptyBody() {
	IComment comment = getComment();
	String text = comment.getText();
	if (!text.startsWith(prefix))
		return false;
	int start = prefix.length();
	for (int i = start; i < text.length(); i++) {
		char charAt = text.charAt(i);
		if (!Character.isWhitespace(charAt))
			return false;
	}
	return true;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:SinglelineCommentReplacer.java

示例8: FixedMultilineCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
/** */
public FixedMultilineCommentReplacer(IComment comment) {
	super(comment);
	this.multiline = comment.isMultiline();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:6,代码来源:FixedMultilineCommentReplacer.java

示例9: MultilineCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public MultilineCommentReplacer(IComment comment, char prefix) {
	super(comment);
	this.prefix = prefix;
	this.multiline = comment.isMultiline();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:6,代码来源:MultilineCommentReplacer.java

示例10: SinglelineDocCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public SinglelineDocCommentReplacer(IComment comment, String prefix) {
	super(comment, prefix);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:SinglelineDocCommentReplacer.java

示例11: SinglelineCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public SinglelineCommentReplacer(IComment comment, String prefix) {
	super(comment);
	this.prefix = prefix;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:SinglelineCommentReplacer.java

示例12: CommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public CommentReplacer(IComment comment) {
	this.comment = comment;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:CommentReplacer.java

示例13: getComment

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public IComment getComment() {
	return comment;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:CommentReplacer.java

示例14: SinglelineCodeCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
public SinglelineCodeCommentReplacer(IComment comment, String prefix) {
	super(comment, prefix);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:SinglelineCodeCommentReplacer.java

示例15: OffMultilineCommentReplacer

import org.eclipse.xtext.formatting2.regionaccess.IComment; //导入依赖的package包/类
/**
 * Ctor for comment with indentation.
 *
 * @param comment
 *            to be processed
 */
public OffMultilineCommentReplacer(IComment comment) {
	this(comment, false);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:OffMultilineCommentReplacer.java


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