78
|
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 }
|