Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d70cd207823e211cc0bf4a67947704860d525223 (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
55
56
57
58
59
/*******************************************************************************
 * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
 * 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:
 *     Soyatec - initial API and implementation
 *******************************************************************************/
package org.eclipse.papyrus.xwt;

import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;

/**
 * @author hceylan
 * 
 */
public interface IValidationRule extends IValidator {

	public static IValidationRule[] EMPTY_ARRAY = new IValidationRule[0];

	public enum Phase {
		AfterGet, //
		AfterConvert, //
		BeforeSet
	}

	public enum Direction {
		SourceToTarget, //
		TargetToSource, //
		Both
	}

	/**
	 * Returns the direction of the validation
	 * 
	 * @return {@link Direction} indicating the direction of the validation.
	 *         Never null
	 */
	public Direction getBindingMode();

	/**
	 * Returns the phase this validator applies to
	 * 
	 * @return {@link Phase} to indicate the phase of the validation. Never null
	 */
	public Phase getPhase();

	/**
	 * Determines if the given value is valid.
	 * 
	 * @param value
	 *        the value to validate
	 * @return a status object indicating whether the validation succeeded {@link IStatus#isOK()} or not. Never null.
	 */
	public IStatus validateBack(Object value);
}

Back to the top