1 /******************************************************************************* 2 * Copyright (c) 2006, 2011 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.compare; 15 16 import org.eclipse.core.resources.IWorkspace; 17 import org.eclipse.core.runtime.IStatus; 18 import org.eclipse.swt.widgets.Shell; 19 import org.eclipse.ui.texteditor.IDocumentProviderExtension; 20 21 /** 22 * Extends the {@link IEditableContent} interface to support validate edit. 23 * Clients should only use this interface if they obtained the content 24 * from an {@link IStreamContentAccessor}. If content was obtained through an 25 * {@link ISharedDocumentAdapter} then validation should be performed through 26 * the {@link IDocumentProviderExtension} interface. 27 * @see IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], Object) 28 * @since 3.3 29 */ 30 public interface IEditableContentExtension { 31 32 /** 33 * Return whether the typed element being displayed 34 * is read-only. a read-only element will require a 35 * call to validateEdit before the element can be modified on disk. 36 * @return whether the typed element is read-only 37 */ isReadOnly()38 boolean isReadOnly(); 39 40 /** 41 * If the element is read-only, this method should be called 42 * to attempt to make it writable. 43 * @param shell a shell used to prompt the user if required. 44 * @return a status object that is <code>OK</code> if things are fine, 45 * otherwise a status describing reasons why modifying the given files is not 46 * reasonable. A status with a severity of <code>CANCEL</code> is returned 47 * if the validation was canceled, indicating the edit should not proceed. 48 */ validateEdit(Shell shell)49 IStatus validateEdit(Shell shell); 50 51 } 52