diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/META-INF/MANIFEST.MF b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/META-INF/MANIFEST.MF index 147b01a90e..a204490953 100644 --- a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/META-INF/MANIFEST.MF +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/META-INF/MANIFEST.MF @@ -7,8 +7,10 @@ Bundle-SymbolicName: org.eclipse.vorto.editor.datatype.ide;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.vorto.editor.datatype, org.eclipse.xtext.ide, - org.eclipse.xtext.xbase.ide + org.eclipse.xtext.xbase.ide, + org.eclipse.vorto.core Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.eclipse.vorto.editor.datatype.ide.contentassist.an - tlr,org.eclipse.vorto.editor.datatype.ide.contentassist.antlr.internal +Export-Package: org.eclipse.vorto.editor.datatype.ide.contentassist.antlr, + org.eclipse.vorto.editor.datatype.ide.contentassist.antlr.internal, + org.eclipse.vorto.editor.datatype.ide.syntaxcoloring Import-Package: org.eclipse.vorto.editor.datatype.services diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/src/org/eclipse/vorto/editor/datatype/ide/syntaxcoloring/PropertyNameSemanticHighlightingCalculator.xtend b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/src/org/eclipse/vorto/editor/datatype/ide/syntaxcoloring/PropertyNameSemanticHighlightingCalculator.xtend new file mode 100644 index 0000000000..ff8dceebea --- /dev/null +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ide/src/org/eclipse/vorto/editor/datatype/ide/syntaxcoloring/PropertyNameSemanticHighlightingCalculator.xtend @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2018 Bosch Software Innovations GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * The Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Bosch Software Innovations GmbH - Please refer to git log + */ +package org.eclipse.vorto.editor.datatype.ide.syntaxcoloring + +import javax.inject.Inject +import org.eclipse.emf.ecore.EObject +import org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator +import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor +import org.eclipse.xtext.util.CancelIndicator + +import org.eclipse.vorto.core.api.model.datatype.Property +import org.eclipse.vorto.core.api.model.datatype.DatatypePackage +import org.eclipse.vorto.editor.datatype.services.DatatypeGrammarAccess +import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles + +class PropertyNameSemanticHighlightingCalculator extends DefaultSemanticHighlightingCalculator { + @Inject package DatatypeGrammarAccess grammar + + override protected boolean highlightElement(EObject object, IHighlightedPositionAcceptor acceptor, + CancelIndicator cancelIndicator) { + switch (object) { + Property: { + highlightFeature(acceptor, object, DatatypePackage.eINSTANCE.property_Name, HighlightingStyles.DEFAULT_ID) + return true + } + default: false + } + } +} \ No newline at end of file diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ui/src/org/eclipse/vorto/editor/datatype/ui/DatatypeUiModule.xtend b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ui/src/org/eclipse/vorto/editor/datatype/ui/DatatypeUiModule.xtend index 02d29ed7ff..6eb329eeea 100644 --- a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ui/src/org/eclipse/vorto/editor/datatype/ui/DatatypeUiModule.xtend +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype.ui/src/org/eclipse/vorto/editor/datatype/ui/DatatypeUiModule.xtend @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015-2016 Bosch Software Innovations GmbH and others. + * Copyright (c) 2015-2018 Bosch Software Innovations GmbH and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -17,6 +17,8 @@ package org.eclipse.vorto.editor.datatype.ui import org.eclipse.ui.plugin.AbstractUIPlugin +import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator +import org.eclipse.vorto.editor.datatype.ide.syntaxcoloring.PropertyNameSemanticHighlightingCalculator /** * Use this class to register components to be used within the IDE. @@ -25,4 +27,7 @@ class DatatypeUiModule extends org.eclipse.vorto.editor.datatype.ui.AbstractData new(AbstractUIPlugin plugin) { super(plugin) } + def Class bindISemanticHighlightingCalculator () { + PropertyNameSemanticHighlightingCalculator + } } diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype/src/org/eclipse/vorto/editor/datatype/Datatype.xtext b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype/src/org/eclipse/vorto/editor/datatype/Datatype.xtext index e5dcc44ba3..3b99a9be49 100644 --- a/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype/src/org/eclipse/vorto/editor/datatype/Datatype.xtext +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.datatype/src/org/eclipse/vorto/editor/datatype/Datatype.xtext @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Bosch Software Innovations GmbH and others. + * Copyright (c) 2014-2018 Bosch Software Innovations GmbH and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. @@ -63,7 +63,7 @@ EnumLiteral: ; Property: - (extension ?= 'extension')? (presence = Presence)? (multiplicity ?= 'multiple')? name = ID 'as' type = PropertyType + (extension ?= 'extension')? (presence = Presence)? (multiplicity ?= 'multiple')? name = ValidID 'as' type = PropertyType ('with' '{' propertyAttributes+=PropertyAttribute (',' propertyAttributes+=PropertyAttribute)* '}')? ('<' constraintRule = ConstraintRule '>')? (description=STRING)? @@ -141,6 +141,10 @@ BOOLEAN: CATEGORY: ID ('/' ID)*; +ValidID: ID | KEYWORD; + +KEYWORD: 'status'|'events'|'operations'|'configuration'|'fault'; + terminal SIGNEDINT : '-'INT ; diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/META-INF/MANIFEST.MF b/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/META-INF/MANIFEST.MF index 4639a919ac..f4f208ce74 100644 --- a/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/META-INF/MANIFEST.MF +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/META-INF/MANIFEST.MF @@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.xtext.ui, org.eclipse.vorto.editor.functionblock.ide, org.eclipse.vorto.core, org.eclipse.xtext.xbase.lib, - org.eclipse.xtend.lib;resolution:=optional + org.eclipse.xtend.lib;resolution:=optional, + org.eclipse.vorto.editor.datatype.ide Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.vorto.editor.functionblock.ui,org.eclipse. vorto.editor.functionblock.ui.contentassist,org.eclipse.vorto.editor. diff --git a/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/src/org/eclipse/vorto/editor/functionblock/ui/FunctionblockUiModule.xtend b/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/src/org/eclipse/vorto/editor/functionblock/ui/FunctionblockUiModule.xtend index 45d1f41c1c..df3ce36e89 100644 --- a/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/src/org/eclipse/vorto/editor/functionblock/ui/FunctionblockUiModule.xtend +++ b/toolset/eclipse/bundles/org.eclipse.vorto.editor.functionblock.ui/src/org/eclipse/vorto/editor/functionblock/ui/FunctionblockUiModule.xtend @@ -17,6 +17,8 @@ package org.eclipse.vorto.editor.functionblock.ui import org.eclipse.ui.plugin.AbstractUIPlugin +import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator +import org.eclipse.vorto.editor.datatype.ide.syntaxcoloring.PropertyNameSemanticHighlightingCalculator /** * Use this class to register components to be used within the IDE. @@ -25,4 +27,7 @@ class FunctionblockUiModule extends org.eclipse.vorto.editor.functionblock.ui.Ab new(AbstractUIPlugin plugin) { super(plugin) } + def Class bindISemanticHighlightingCalculator () { + PropertyNameSemanticHighlightingCalculator + } }