comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/ReadOnlyValidator.d @ 78:0a55d2d5a946

Added file for databinding
author Frank Benoit <benoit@tionex.de>
date Tue, 14 Apr 2009 11:35:29 +0200
parents
children 6be48cf9f95c
comparison
equal deleted inserted replaced
76:f05e6e8b2f2d 78:0a55d2d5a946
1 /*
2 * Copyright cast(C) 2005, 2006 db4objects Inc. (http://www.db4o.com) 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 v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * db4objects - Initial API and implementation
11 * Boris Bokowski (IBM Corporation) - bug 118429
12 * Tom Schindl<tom.schindl@bestsolution.at> - bugfix for 217940
13 */
14 module org.eclipse.core.internal.databinding.validation.ReadOnlyValidator;
15
16 import java.lang.all;
17
18 import org.eclipse.core.databinding.validation.IValidator;
19 import org.eclipse.core.databinding.validation.ValidationStatus;
20 import org.eclipse.core.internal.databinding.BindingMessages;
21 import org.eclipse.core.runtime.IStatus;
22
23 /**
24 * ReadOnlyValidator. A validator that can be used as a partial validator for read-only fields.
25 */
26 public class ReadOnlyValidator : IValidator {
27
28 private static ReadOnlyValidator singleton = null;
29
30 /**
31 * Returns the ReadOnlyValidator
32 *
33 * @return the ReadOnlyValidator
34 */
35 public static ReadOnlyValidator getDefault() {
36 if (singleton is null) {
37 singleton = new ReadOnlyValidator();
38 }
39 return singleton;
40 }
41
42 public IStatus validate(Object value) {
43 // No changes are allowed
44 return ValidationStatus.error(BindingMessages
45 .getStringcast(BindingMessages.VALIDATE_NO_CHANGE_ALLOWED_HELP));
46 }
47
48 }