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.ui; 12 13 /** 14 * An editor can implement this interface and participate in the workbench 15 * session save/restore cycle using <code>IMemento</code>, similar to how 16 * <code>IViewPart</code> currently works. 17 * <p> 18 * Refer to IWorkbenchPart for the part lifecycle. 19 * </p> 20 * <p> 21 * If a memento is available, restoreState(*) will be inserted into the editor 22 * startup. 23 * <ol> 24 * <li><code>editor.init(site, input)</code></li> 25 * <li><code>editor.restoreState(memento)</code></li> 26 * <li><code>editor.createPartControl(parent)</code></li> 27 * <li>...</li> 28 * </ol> 29 * </p> 30 * <p> 31 * On workbench shutdown, the editor state will be persisted when the editor 32 * references are saved. 33 * </p> 34 * 35 * @since 3.3 36 */ 37 public interface IPersistableEditor extends IPersistable { 38 /** 39 * Called with a memento for this editor. The editor can parse the data or 40 * save the memento. This method may not be called. 41 * 42 * @param memento 43 * the saved state for this editor. May be <code>null</code>. 44 */ 45 public void restoreState(IMemento memento); 46 } 47