@Check public void checkClassPath(PatternModel modelFile) { if (!classpathValidationEnabled) { return; } final JvmGenericType listType = (JvmGenericType) typeReferences.findDeclaredType(Stream.class, modelFile); if (listType == null) { error("Couldn't find a JDK 1.8 or higher on the project's classpath.", modelFile, PatternLanguagePackage.Literals.PATTERN_MODEL__PACKAGE_NAME, IssueCodes.JDK_NOT_ON_CLASSPATH); } else if (typeReferences.findDeclaredType(ViatraQueryEngine.class, modelFile) == null) { error("Couldn't find the mandatory library 'org.eclipse.viatra.query.runtime' on the project's classpath.", modelFile, PatternLanguagePackage.Literals.PATTERN_MODEL__PACKAGE_NAME, IssueCodes.IQR_NOT_ON_CLASSPATH, "org.eclipse.viatra.query.runtime"); } }
@Check public void checkPackageImportGeneratedCode(PackageImport packageImport) { if (!classpathValidationEnabled) { return; } if (packageImport.getEPackage() != null && packageImport.getEPackage().getNsURI() != null && !metamodelProvider .isGeneratedCodeAvailable(packageImport.getEPackage(), packageImport.eResource().getResourceSet())) { warning(String.format( "The generated code of the Ecore model %s cannot be found. Check the org.eclipse.emf.ecore.generated_package extension in the model project or consider setting up a generator model for the generated code to work.", packageImport.getEPackage().getNsURI()), PatternLanguagePackage.Literals.PACKAGE_IMPORT__EPACKAGE, IssueCodes.IMPORT_WITH_GENERATEDCODE); } } }
@Check(CheckType.NORMAL) public void checkClassPath(ClassType typeDecl) { if (!classpathValidationEnabled) { return; } EClassifier classifier = typeDecl.getClassname(); String clazz = metamodelProvider.getQualifiedClassName(classifier, classifier); if (clazz != null && !clazz.isEmpty() && typeReferences.findDeclaredType(clazz, typeDecl) == null) { error(String.format("Couldn't find type %s on the project's classpath", clazz), typeDecl, null, IssueCodes.TYPE_NOT_ON_CLASSPATH, classifier.getEPackage().getNsURI()); } }