org.eclipse.xtext.nodemodel.impl.RootNode Java Examples
The following examples show how to use
org.eclipse.xtext.nodemodel.impl.RootNode.
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: ConditionModelJavaValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Check public void checkComparatorSign(final Operation_Compare operation) { if (operation != null) { for (final Adapter adapter : operation.eAdapters()) { if (adapter instanceof RootNode) { final RootNode r = (RootNode) adapter; for (final INode iNode : r.getChildren()) { if (iNode.getText().equals("=")) { if (!(!iNode.getNextSibling().getText().equals("=") && iNode.getPreviousSibling().getText().equals("=")) || iNode.getNextSibling().getText().equals("=") && !iNode.getPreviousSibling().getText().equals("=")) { error(Messages.equalityError, operation, operation.eContainingFeature() ,ConditionModelJavaValidator.INVALID_EQUALITY_SIGN, r.getCompleteContent()); } } } } } } }
Example #2
Source File: N4JSResource.java From n4js with Eclipse Public License 1.0 | 5 votes |
void setText(String text) { try { String methodName = "basicSetCompleteContent"; Method basicSetCompleteContent = RootNode.class.getDeclaredMethod(methodName, String.class); basicSetCompleteContent.setAccessible(true); basicSetCompleteContent.invoke(rootNode, text); } catch (Exception e) { LOGGER.error("Error when setting contents of JS file", e); } }
Example #3
Source File: SerializationConversionContext.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected void fillGrammarElementToIdMap(XtextResource r) { IParseResult parseResult = r.getParseResult(); if (parseResult != null) { RootNode it = (RootNode) parseResult.getRootNode(); it.fillGrammarElementToIdMap(grammarElementToIdMap, grammarIdToURIMap); } }
Example #4
Source File: N4JSResource.java From n4js with Eclipse Public License 1.0 | 4 votes |
JSParseResult(String text) { scriptNode = N4JSFactory.eINSTANCE.createScript(); rootNode = new RootNode(); setText(text); scriptNode.eAdapters().add(rootNode); }
Example #5
Source File: NodeIteratorTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
private static INode getSingleNode() { return new RootNode(); }
Example #6
Source File: NodeModelUtils.java From xtext-core with Eclipse Public License 2.0 | 3 votes |
/** * Compute the line and column information at the given offset from any node that belongs the the document. The line is one-based, e.g. * the first line has the line number '1'. The line break belongs the line that it breaks. In other words, the first line break in the * document also has the line number '1'. The column number starts at '1', too. In effect, the document offset '0' will always return * line '1' and column '1'. * * If the given documentOffset points exactly to {@code anyNode.root.text.length}, it's assumed to be a virtual character thus * the offset is valid and the column and line information is returned as if it was there. * * This contract is in sync with {@link org.eclipse.emf.ecore.resource.Resource.Diagnostic}. * * @throws IndexOutOfBoundsException * if the document offset does not belong to the document, * {@code documentOffset < 0 || documentOffset > anyNode.rootNode.text.length} */ public static LineAndColumn getLineAndColumn(INode anyNode, int documentOffset) { // special treatment for inconsistent nodes such as SyntheticLinkingLeafNode if (anyNode.getParent() == null && !(anyNode instanceof RootNode)) { return LineAndColumn.from(1,1); } return InternalNodeModelUtils.getLineAndColumn(anyNode, documentOffset); }