org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionFinder Java Examples

The following examples show how to use org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionFinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractRegionAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyFollowing(EObject owner) {
	AbstractEObjectRegion region = regionForEObject(owner);
	if (region != null)
		return region.immediatelyFollowing();
	return SemanticRegionNullFinder.INSTANCE;
}
 
Example #2
Source File: AbstractRegionAccess.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyPreceding(EObject owner) {
	AbstractEObjectRegion region = regionForEObject(owner);
	if (region != null)
		return region.immediatelyPreceding();
	return SemanticRegionNullFinder.INSTANCE;
}
 
Example #3
Source File: SARLFormatter.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Format a list of comma separated elements.
 *
 * <p>This function does not considerer opening and closing delimiters, as
 * {@link #formatCommaSeparatedList(Collection, ISemanticRegion, ISemanticRegion, IFormattableDocument)}.
 *
 * @param elements the elements to format.
 * @param document the document.
 */
protected void formatCommaSeparatedList(Collection<? extends EObject> elements, IFormattableDocument document) {
	for (final EObject element : elements) {
		document.format(element);
		final ISemanticRegionFinder immediatelyFollowing = this.textRegionExtensions.immediatelyFollowing(element);
		final ISemanticRegion keyword = immediatelyFollowing.keyword(this.keywords.getCommaKeyword());
		document.prepend(keyword, NO_SPACE);
		document.append(keyword, ONE_SPACE);
	}
}
 
Example #4
Source File: AbstractEObjectRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyFollowing() {
	return new SemanticRegionMatcher(getNextSemanticRegion());
}
 
Example #5
Source File: AbstractEObjectRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyPreceding() {
	return new SemanticRegionMatcher(getPreviousSemanticRegion());
}
 
Example #6
Source File: StringSemanticRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyFollowing() {
	return new SemanticRegionMatcher(getNextSemanticRegion());
}
 
Example #7
Source File: StringSemanticRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyPreceding() {
	return new SemanticRegionMatcher(getPreviousSemanticRegion());
}
 
Example #8
Source File: NodeSemanticRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyFollowing() {
	return new SemanticRegionMatcher(getNextSemanticRegion());
}
 
Example #9
Source File: NodeSemanticRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyPreceding() {
	return new SemanticRegionMatcher(getPreviousSemanticRegion());
}
 
Example #10
Source File: AbstractHiddenRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyFollowing() {
	return new SemanticRegionMatcher(getNextSemanticRegion());
}
 
Example #11
Source File: AbstractHiddenRegion.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ISemanticRegionFinder immediatelyPreceding() {
	return new SemanticRegionMatcher(getPreviousSemanticRegion());
}