Java Code Examples for org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion#getGrammarElement()
The following examples show how to use
org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion#getGrammarElement() .
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: XbaseFormatter.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected AbstractRule binaryOperationPrecedence(final EObject op) { final ISemanticRegion node = this.textRegionExtensions.regionFor(op).feature(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE); if (((node != null) && (node.getGrammarElement() instanceof RuleCall))) { EObject _grammarElement = node.getGrammarElement(); return ((RuleCall) _grammarElement).getRule(); } return null; }
Example 2
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; EObject element = input.getGrammarElement(); Assignment assignment = GrammarUtil.containingAssignment(element); if (assignment == null || !name.equals(assignment.getFeature())) return false; EObject semanticElement = input.getSemanticElement(); return type.isInstance(semanticElement); }
Example 3
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; EObject element = input.getGrammarElement(); return element instanceof Keyword && keyword.equals(((Keyword) element).getValue()); }
Example 4
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; EObject element = input.getGrammarElement(); return element instanceof Keyword && keywords.contains(((Keyword) element).getValue()); }
Example 5
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; EObject element = input.getGrammarElement(); return element instanceof RuleCall && ((RuleCall) element).getRule() == rule; }
Example 6
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; EObject element = input.getGrammarElement(); return element instanceof RuleCall && rules.contains(((RuleCall) element).getRule()); }
Example 7
Source File: BugSinglelineCommentIndentation.java From sarl with Apache License 2.0 | 5 votes |
private static boolean detectBugSituation(IHiddenRegion hiddenRegion) { if (hiddenRegion != null) { final ISemanticRegion semanticRegion = hiddenRegion.getNextSemanticRegion(); if (semanticRegion != null) { final EObject element = semanticRegion.getGrammarElement(); if (element instanceof Keyword && Strings.equal(((Keyword) element).getValue(), "}")) { //$NON-NLS-1$ return true; } } } return false; }
Example 8
Source File: BugSinglelineCommentIndentation.java From sarl with Apache License 2.0 | 5 votes |
private static boolean fixBug(IHiddenRegion hiddenRegion) { boolean needBugFix = true; final ISemanticRegion semanticRegion = hiddenRegion.getPreviousSemanticRegion(); if (semanticRegion != null) { final EObject element = semanticRegion.getGrammarElement(); if (element instanceof Keyword && Strings.equal(((Keyword) element).getValue(), "{")) { //$NON-NLS-1$ needBugFix = false; } } return needBugFix; }
Example 9
Source File: BugMultilineCommentIndentation.java From sarl with Apache License 2.0 | 5 votes |
private static boolean detectBugSituation(IHiddenRegion hiddenRegion) { if (hiddenRegion != null) { final ISemanticRegion semanticRegion = hiddenRegion.getPreviousSemanticRegion(); if (semanticRegion != null) { final EObject element = semanticRegion.getGrammarElement(); if (element instanceof Keyword && Strings.equal(((Keyword) element).getValue(), "{")) { //$NON-NLS-1$ return true; } } } return false; }
Example 10
Source File: BugMultilineCommentIndentation.java From sarl with Apache License 2.0 | 5 votes |
private static boolean fixBug(IHiddenRegion hiddenRegion) { boolean needBugFix = true; final ISemanticRegion semanticRegion = hiddenRegion.getNextSemanticRegion(); if (semanticRegion != null) { final EObject element = semanticRegion.getGrammarElement(); if (element instanceof Keyword && Strings.equal(((Keyword) element).getValue(), "}")) { //$NON-NLS-1$ needBugFix = false; } } return needBugFix; }
Example 11
Source File: AbstractSemanticRegionsFinder.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public boolean apply(ISemanticRegion input) { if (input == null) return false; return input.getGrammarElement() == grammarElement; }