KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > model > WorkspaceFactory


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.internal.ide.model;
12
13 import org.eclipse.core.resources.ResourcesPlugin;
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.eclipse.ui.IElementFactory;
16 import org.eclipse.ui.IMemento;
17 import org.eclipse.ui.IPersistableElement;
18
19 /**
20  * The ResourceFactory is used to save and recreate an IResource object.
21  * As such, it implements the IPersistableElement interface for storage
22  * and the IElementFactory interface for recreation.
23  *
24  * @see IMemento
25  * @see IPersistableElement
26  * @see IElementFactory
27  */

28 public class WorkspaceFactory implements IElementFactory, IPersistableElement {
29     private static final String JavaDoc FACTORY_ID = "org.eclipse.ui.internal.model.WorkspaceFactory";//$NON-NLS-1$
30

31     /**
32      * Create a ResourceFactory. This constructor is typically used
33      * for our IElementFactory side.
34      */

35     public WorkspaceFactory() {
36     }
37
38     /**
39      * @see IElementFactory
40      */

41     public IAdaptable createElement(IMemento memento) {
42         return ResourcesPlugin.getWorkspace();
43     }
44
45     /**
46      * @see IPersistableElement
47      */

48     public String JavaDoc getFactoryId() {
49         return FACTORY_ID;
50     }
51
52     /**
53      * @see IPersistableElement
54      */

55     public void saveState(IMemento memento) {
56     }
57 }
58
Popular Tags