Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2017-08-28 15:42:46 +0000
committerRalf Mollik2017-08-28 15:42:46 +0000
commitad672786c4b4b0f88e9a839e861baf3c5e1abbde (patch)
tree9e02cfddd7f0de5e3dd954fede93f6f17d06f03a /org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend
downloadorg.eclipse.osbp.xtext.table-ad672786c4b4b0f88e9a839e861baf3c5e1abbde.tar.gz
org.eclipse.osbp.xtext.table-ad672786c4b4b0f88e9a839e861baf3c5e1abbde.tar.xz
org.eclipse.osbp.xtext.table-ad672786c4b4b0f88e9a839e861baf3c5e1abbde.zip
parallel ip - initial checkin
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
Diffstat (limited to 'org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend')
-rw-r--r--org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend94
1 files changed, 94 insertions, 0 deletions
diff --git a/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend b/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend
new file mode 100644
index 0000000..a9a20a0
--- /dev/null
+++ b/org.eclipse.osbp.xtext.table/src/org/eclipse/osbp/xtext/table/validation/TableDSLValidator.xtend
@@ -0,0 +1,94 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ *
+ * This copyright notice shows up in the generated Java code
+ *
+ */
+
+package org.eclipse.osbp.xtext.table.validation
+
+import java.util.List
+import org.eclipse.xtext.common.types.JvmGenericType
+import org.eclipse.xtext.validation.Check
+import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage
+import org.eclipse.xtext.common.types.util.TypeReferences
+import org.vaadin.hene.popupbutton.PopupButton
+import org.eclipse.osbp.xtext.table.TableDSLPackage
+import org.tepi.filtertable.FilterTable
+import org.eclipse.osbp.xtext.table.TablePackage
+import org.eclipse.osbp.xtext.table.TableModel
+
+//import org.eclipse.xtext.validation.Check
+
+/**
+ * Custom validation rules.
+ *
+ * see http://www.eclipse.org/Xtext/documentation.html#validation
+ */
+class TableDSLValidator extends AbstractTableDSLValidator {
+
+// public static val INVALID_NAME = 'invalidName'
+//
+// @Check
+// def checkGreetingStartsWithCapital(Greeting greeting) {
+// if (!Character.isUpperCase(greeting.name.charAt(0))) {
+// warning('Name should start with a capital',
+// MyDslPackage.Literals.GREETING__NAME,
+// INVALID_NAME)
+// }
+// }
+
+ public static val String CODE__MISSING__L_RUNTIME_COMMON = "0_108"
+ public static val String CODE__MISSING__DATATYPE_LIB = "0_109"
+ public static val String CODE__MISSING__XBASE_LIB = "0_111"
+ public static val String CODE__MISSING__JDK_1_5 = "0_112"
+
+ @Check
+ def checkClassPath(TableModel tableModel) {
+ var typeReferences = services.typeReferences
+ val listType = typeReferences.findDeclaredType(List, tableModel) as JvmGenericType
+ if (listType == null || listType.getTypeParameters().isEmpty()) {
+ error("Couldn't find a JDK 1.5 or higher on the project's classpath.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ CODE__MISSING__JDK_1_5);
+ }
+ if (typeReferences.findDeclaredType(PopupButton, tableModel) == null) {
+ error("Couldn't find a the mandatory library 'popupbutton.osgi' on the project's classpath.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ "");
+ }
+ if (typeReferences.findDeclaredType(FilterTable, tableModel) == null) {
+ error("Couldn't find a the mandatory library 'filteringtable.osgi' on the project's classpath.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ "");
+ }
+ if (typeReferences.findDeclaredType(
+ "org.eclipse.osbp.runtime.common.annotations.Dispose", tableModel) == null) {
+ error("Couldn't find the mandatory library 'org.eclipse.osbp.runtime.common' on the project's classpath.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ CODE__MISSING__L_RUNTIME_COMMON);
+ }
+ if (typeReferences.findDeclaredType(
+ "org.eclipse.osbp.dsl.common.datatypes.IDatatypeConstants", tableModel) == null) {
+ warning("Couldn't find the optional library 'org.eclipse.osbp.dsl.datatype.lib' on the project's classpath. This may cause resolving problems.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ CODE__MISSING__DATATYPE_LIB);
+ }
+ if (typeReferences.findDeclaredType("javax.validation.Valid", tableModel) == null) {
+ error("Couldn't find the library 'javax.validation' on the project's classpath. This may cause resolving problems.",
+ tableModel, TableDSLPackage.Literals.TABLE_MODEL__PACKAGES,
+ CODE__MISSING__DATATYPE_LIB);
+ }
+ }
+
+}

Back to the top