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.internal.ide.model;
11:
12: import org.eclipse.core.resources.ResourcesPlugin;
13: import org.eclipse.core.runtime.IAdaptable;
14: import org.eclipse.ui.IElementFactory;
15: import org.eclipse.ui.IMemento;
16: import org.eclipse.ui.IPersistableElement;
17:
18: /**
19: * The ResourceFactory is used to save and recreate an IResource object.
20: * As such, it implements the IPersistableElement interface for storage
21: * and the IElementFactory interface for recreation.
22: *
23: * @see IMemento
24: * @see IPersistableElement
25: * @see IElementFactory
26: */
27: public class WorkspaceFactory implements IElementFactory,
28: IPersistableElement {
29: private static final String 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 getFactoryId() {
49: return FACTORY_ID;
50: }
51:
52: /**
53: * @see IPersistableElement
54: */
55: public void saveState(IMemento memento) {
56: }
57: }
|