blob: ce905492fdc3d23dab04476922fc40776122b48d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*******************************************************************************
* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
* All rights reserved.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* CONTRIBUTORS:
* Jan Belle (initial contribution)
*
*******************************************************************************/
package org.eclipse.etrice.generator.base;
import java.util.List;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.generator.base.args.Arguments;
import org.eclipse.etrice.generator.base.logging.ILogger;
import org.eclipse.etrice.generator.base.validation.GeneratorResourceValidator;
import org.eclipse.xtext.validation.IResourceValidator;
import com.google.inject.Inject;
/**
* Tries to validate all contents of the underlying resource set of the resources.
*/
public class ModelValidator extends GeneratorResourceValidator {
@Inject
public ModelValidator(IResourceValidator validator) {
super(validator);
}
@Override
public void validate(List<Resource> resources, Arguments arguments, ILogger logger) {
logger.logInfo("-- validating models");
if(!resources.isEmpty()) {
ResourceSet rs = resources.get(0).getResourceSet();
if(rs != null) {
super.validate(rs.getResources(), arguments, logger);
return;
}
}
super.validate(resources, arguments, logger);
}
}
|