Skip to content

Package: ValidationDelegate

ValidationDelegate

nameinstructionbranchcomplexitylinemethod
static {...}
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.ide.builder;
15:
16: import org.eclipse.core.resources.IFile;
17: import org.eclipse.core.runtime.IProgressMonitor;
18: import org.eclipse.emf.common.util.Diagnostic;
19: import org.eclipse.emfforms.common.Optional;
20:
21: /**
22: * Protocol for delegates that the validation builder invokes to validate workspace resources.
23: */
24: public interface ValidationDelegate {
25:         /**
26:          * A validation delegate that does nothing.
27:          */
28:         ValidationDelegate NULL = new ValidationDelegate() {
29:
30:                 @Override
31:                 public Optional<Diagnostic> validate(IFile file, IProgressMonitor monitor) {
32:                         if (monitor != null) {
33:                                 monitor.done();
34:                         }
35:
36:                         return Optional.empty();
37:                 }
38:         };
39:
40:         /**
41:          * Validate a {@code file} in the workspace.
42:          *
43:          * @param file the file to validate
44:          * @param monitor for reporting validation progress
45:          *
46:          * @return the problems found, if any
47:          */
48:         Optional<Diagnostic> validate(IFile file, IProgressMonitor monitor);
49:
50: }