Skip to content
Snippets Groups Projects
Commit b488eb6a authored by Simon Eismann's avatar Simon Eismann
Browse files

fixed Syntax Highlighting

parent d1efbd77
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,11 @@ import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration;
import org.eclipse.xtext.util.CancelIndicator;
import tools.descartes.dql.lang.descartesQL.ChildrenClause;
import tools.descartes.dql.lang.descartesQL.DescartesQLPackage;
import tools.descartes.dql.lang.descartesQL.EntityReference;
import tools.descartes.dql.lang.descartesQL.FindClause;
import tools.descartes.dql.lang.descartesQL.ParentClause;
public class SyntaxHighlighting implements ISemanticHighlightingCalculator {
......@@ -23,9 +26,21 @@ public class SyntaxHighlighting implements ISemanticHighlightingCalculator {
EObject element = contents.next();
if (element instanceof EntityReference)
highlightAsDataType(element, DescartesQLPackage.Literals.ENTITY_REFERENCE__TYPE, arg1);
if (element instanceof ChildrenClause)
highlightAsDefault(element, DescartesQLPackage.Literals.CHILDREN_CLAUSE__CONTENT, arg1);
if (element instanceof ParentClause)
highlightAsDefault(element, DescartesQLPackage.Literals.PARENT_CLAUSE__CONTENT, arg1);
if (element instanceof FindClause)
highlightAsDefault(element, DescartesQLPackage.Literals.FIND_CLAUSE__START, arg1);
}
}
protected void highlightAsDefault(EObject element, EStructuralFeature feature,
IHighlightedPositionAcceptor acceptor) {
for (INode node : NodeModelUtils.findNodesForFeature(element, feature))
acceptor.addPosition(node.getOffset(), node.getLength(), DefaultHighlightingConfiguration.DEFAULT_ID);
}
protected void highlightAsDataType(EObject element, EStructuralFeature feature,
IHighlightedPositionAcceptor acceptor) {
for (INode node : NodeModelUtils.findNodesForFeature(element, feature))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment