1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 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 /** 15 * Interface for asking an object to store its state in a memento. 16 * <p> 17 * This interface is typically included in interfaces where 18 * persistance is required. 19 * </p><p> 20 * When the workbench is shutdown objects which implement this interface 21 * will be persisted. At this time the <code>getFactoryId</code> method 22 * is invoked to discover the id of the element factory that will be used 23 * to re-create the object from a memento. Then the <code>saveState</code> 24 * method is invoked to store the element data into a newly created memento. 25 * The resulting mementos are collected up and written out to a single file. 26 * </p> 27 * <p> 28 * During workbench startup these mementos are read from the file. The 29 * factory Id for each is retrieved and mapped to an <code>IElementFactory</code> 30 * which has been registered in the element factory extension point. If a 31 * factory exists for the Id it will be engaged to re-create the original 32 * object. 33 * </p> 34 * 35 * @see org.eclipse.core.runtime.IAdaptable 36 * @see org.eclipse.ui.IMemento 37 * @see org.eclipse.ui.IElementFactory 38 */ 39 public interface IPersistableElement extends IPersistable { 40 /** 41 * Returns the id of the element factory which should be used to re-create this 42 * object. 43 * <p> 44 * Factory ids are declared in extensions to the standard extension point 45 * <code>"org.eclipse.ui.elementFactories"</code>. 46 * </p> 47 * 48 * @return the element factory id 49 * @see IElementFactory 50 */ 51 public String getFactoryId(); 52 } 53