Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 /*******************************************************************************2 * Copyright (c) 2000, 2007 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/11 package org.eclipse.core.resources;12 13 importorg.eclipse.core.resources.team.FileModificationValidator;14 importorg.eclipse.core.runtime.IStatus;15 16 /**17 * The file modification validator is a Team-related hook for pre-checking operations 18 * that modify the contents of files.19 * <p>20 * This interface is used only in conjunction with the21 * "org.eclipse.core.resources.fileModificationValidator"22 * extension point. It is intended to be implemented only 23 * by the Eclipse Platform Team plug-in.24 * </p>25 * 26 * @since 2.027 * @deprecated clients should subclass {@link FileModificationValidator} instead28 * of implementing this interface29 */30 publicinterface IFileModificationValidator {31 /**32 * Validates that the given files can be modified. The files must all exist33 * in the workspace. The optional context object may be supplied if34 * UI-based validation is required. If the context is <code>null</code>, the 35 * validator must attempt to perform the validation in a headless manner.36 * The returned status is <code>IStatus.OK</code> if this validator 37 * believes the given file can be modified. Other return statuses indicate38 * the reason why the individual files cannot be modified.39 * 40 * @param files the files that are to be modified; these files must all exist in the workspace41 * @param context the <code>org.eclipse.swt.widgets.Shell</code> that is to be used to42 * parent any dialogs with the user, or <code>null</code> if there is no UI context (declared43 * as an <code>Object</code> to avoid any direct references on the SWT component)44 * @return a status object that is OK if things are fine, otherwise a status describing45 * reasons why modifying the given files is not reasonable46 * @see IWorkspace#validateEdit(IFile[], Object)47 */48 publicIStatus validateEdit(IFile[] files, Object context);49 50 /**51 * Validates that the given file can be saved. This method is called from 52 * <code>IFile#setContents</code> and <code>IFile#appendContents</code> 53 * before any attempt to write data to disk. The returned status is 54 * <code>IStatus.OK</code> if this validator believes the given file can be 55 * successfully saved. In all other cases the return value is a non-OK status. 56 * Note that a return value of <code>IStatus.OK</code> does not guarantee 57 * that the save will succeed.58 * 59 * @param file the file that is to be modified; this file must exist in the workspace60 * @return a status indicating whether or not it is reasonable to try writing to the given file; 61 * <code>IStatus.OK</code> indicates a save should be attempted.62 * 63 * @see IFile#setContents(java.io.InputStream, int, org.eclipse.core.runtime.IProgressMonitor)64 * @see IFile#appendContents(java.io.InputStream, int, org.eclipse.core.runtime.IProgressMonitor)65 */66 publicIStatus validateSave(IFile file);67 }68