1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.ui.dialogs; 12 13 /** 14 * For validating selections in some selection dialogs. 15 * <p> 16 * Clients should implement this interface to define specialized selection 17 * validators. 18 * </p> 19 */ 20 public interface ISelectionValidator { 21 /** 22 * Returns a string indicating whether the given selection is valid. If the 23 * result is <code>null</code>, the selection is considered to be valid; if the result is 24 * non-empty, it contains the error message to be displayed to the user. 25 * 26 * @param selection the selection to be validated 27 * @return the error message, or <code>null</code> indicating 28 * that the value is valid 29 */ 30 public String isValid(Object selection); 31 } 32