KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IElementFactory


1 /*******************************************************************************
2  * Copyright (c) 2000, 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 import org.eclipse.core.runtime.IAdaptable;
14
15 /**
16  * A factory for re-creating objects from a previously saved memento.
17  * <p>
18  * Clients should implement this interface and include the name of their class
19  * in an extension to the platform extension point named
20  * <code>"org.eclipse.ui.elementFactories"</code>.
21  * For example, the plug-in's XML markup might contain:
22  * <pre>
23  * &LT;extension point="org.eclipse.ui.elementFactories"&GT;
24  * &LT;factory id="com.example.myplugin.MyFactory" class="com.example.myplugin.MyFactory" /&GT;
25  * &LT;/extension&GT;
26  * </pre>
27  * </p>
28  *
29  * @see IPersistableElement
30  * @see IMemento
31  * @see org.eclipse.ui.IWorkbench#getElementFactory
32  */

33 public interface IElementFactory {
34     /**
35      * Re-creates and returns an object from the state captured within the given
36      * memento.
37      * <p>
38      * Under normal circumstances, the resulting object can be expected to be
39      * persistable; that is,
40      * <pre>
41      * result.getAdapter(org.eclipse.ui.IPersistableElement.class)
42      * </pre>
43      * should not return <code>null</code>.
44      * </p>
45      *
46      * @param memento a memento containing the state for the object
47      * @return an object, or <code>null</code> if the element could not be created
48      */

49     public IAdaptable createElement(IMemento memento);
50 }
51
Popular Tags