01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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: import org.eclipse.core.runtime.IAdaptable;
13:
14: /**
15: * A factory for re-creating objects from a previously saved memento.
16: * <p>
17: * Clients should implement this interface and include the name of their class
18: * in an extension to the platform extension point named
19: * <code>"org.eclipse.ui.elementFactories"</code>.
20: * For example, the plug-in's XML markup might contain:
21: * <pre>
22: * <extension point="org.eclipse.ui.elementFactories">
23: * <factory id="com.example.myplugin.MyFactory" class="com.example.myplugin.MyFactory" />
24: * </extension>
25: * </pre>
26: * </p>
27: *
28: * @see IPersistableElement
29: * @see IMemento
30: * @see org.eclipse.ui.IWorkbench#getElementFactory
31: */
32: public interface IElementFactory {
33: /**
34: * Re-creates and returns an object from the state captured within the given
35: * memento.
36: * <p>
37: * Under normal circumstances, the resulting object can be expected to be
38: * persistable; that is,
39: * <pre>
40: * result.getAdapter(org.eclipse.ui.IPersistableElement.class)
41: * </pre>
42: * should not return <code>null</code>.
43: * </p>
44: *
45: * @param memento a memento containing the state for the object
46: * @return an object, or <code>null</code> if the element could not be created
47: */
48: public IAdaptable createElement(IMemento memento);
49: }
|