KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > IEditableContentExtension


1 /*******************************************************************************
2  * Copyright (c) 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.compare;
12
13 import org.eclipse.core.resources.IWorkspace;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.swt.widgets.Shell;
16 import org.eclipse.ui.texteditor.IDocumentProviderExtension;
17
18 /**
19  * Extends the {@link IEditableContent} interface to support validate edit.
20  * Clients should only use this interface if they obtained the content
21  * from an {@link IStreamContentAccessor}. If content was obtained through an
22  * {@link ISharedDocumentAdapter} then validation should be performed through
23  * the {@link IDocumentProviderExtension} interface.
24  * @see IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], Object)
25  * @since 3.3
26  */

27 public interface IEditableContentExtension {
28     
29     /**
30      * Return whether the typed element being displayed
31      * is read-only. a read-only element will require a
32      * call to validateEdit before the element can be modified on disk.
33      * @return whether the typed element is read-only
34      */

35     boolean isReadOnly();
36     
37     /**
38      * If the element is read-only, this method should be called
39      * to attempt to make it writable.
40      * @param shell a shell used to prompt the user if required.
41      * @return a status object that is <code>OK</code> if things are fine,
42      * otherwise a status describing reasons why modifying the given files is not
43      * reasonable. A status with a severity of <code>CANCEL</code> is returned
44      * if the validation was canceled, indicating the edit should not proceed.
45      */

46     IStatus validateEdit(Shell shell);
47
48 }
49
Popular Tags