01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui;
11:
12: /**
13: * Interface for asking an object to store its state in a memento.
14: * <p>
15: * This interface is typically included in interfaces where
16: * persistance is required.
17: * </p><p>
18: * When the workbench is shutdown objects which implement this interface
19: * will be persisted. At this time the <code>getFactoryId</code> method
20: * is invoked to discover the id of the element factory that will be used
21: * to re-create the object from a memento. Then the <code>saveState</code>
22: * method is invoked to store the element data into a newly created memento.
23: * The resulting mementos are collected up and written out to a single file.
24: * </p>
25: * <p>
26: * During workbench startup these mementos are read from the file. The
27: * factory Id for each is retrieved and mapped to an <code>IElementFactory</code>
28: * which has been registered in the element factory extension point. If a
29: * factory exists for the Id it will be engaged to re-create the original
30: * object.
31: * </p>
32: *
33: * @see org.eclipse.core.runtime.IAdaptable
34: * @see org.eclipse.ui.IMemento
35: * @see org.eclipse.ui.IElementFactory
36: */
37: public interface IPersistableElement extends IPersistable {
38: /**
39: * Returns the id of the element factory which should be used to re-create this
40: * object.
41: * <p>
42: * Factory ids are declared in extensions to the standard extension point
43: * <code>"org.eclipse.ui.elementFactories"</code>.
44: * </p>
45: *
46: * @return the element factory id
47: * @see IElementFactory
48: */
49: public String getFactoryId();
50: }
|