01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.util;
11:
12: import org.eclipse.core.resources.IFile;
13: import org.eclipse.core.runtime.IStatus;
14: import org.eclipse.core.runtime.Status;
15: import org.eclipse.pde.internal.ui.PDEPlugin;
16: import org.eclipse.ui.dialogs.ISelectionStatusValidator;
17:
18: public class FileValidator implements ISelectionStatusValidator {
19:
20: public IStatus validate(Object[] selection) {
21: if (selection.length > 0 && selection[0] instanceof IFile) {
22: return new Status(IStatus.OK, PDEPlugin.getPluginId(),
23: IStatus.OK, "", //$NON-NLS-1$
24: null);
25: }
26: return new Status(IStatus.ERROR, PDEPlugin.getPluginId(),
27: IStatus.ERROR, "", //$NON-NLS-1$
28: null);
29: }
30:
31: }
|