KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > model > Factory


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.core.runtime.model;
12
13 import org.eclipse.core.internal.runtime.InternalPlatform;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.MultiStatus;
16
17 /**
18  * An object which can create plug-in related model objects (typically when
19  * parsing plug-in manifest files).
20  * <p>
21  * This class may be instantiated, or further subclassed.
22  * </p>
23  * @deprecated In Eclipse 3.0 the runtime was refactored and all
24  * non-essential elements removed. This class provides facilities primarily intended
25  * for tooling. As such it has been removed and no directly substitutable API provided.
26  */

27
28 public class Factory {
29     private MultiStatus status;
30
31     /**
32      * Creates a factory which can be used to create plug-in model objects.
33      * Errors and warnings during parsing etc. can be logged to the given
34      * status via the <code>error</code> method.
35      *
36      * @param status the status to which errors should be logged
37      */

38     public Factory(MultiStatus status) {
39         super();
40         this.status = status;
41     }
42
43     /**
44      * Returns a new configuration element model which is not initialized.
45      *
46      * @return a new configuration element model
47      */

48     public ConfigurationElementModel createConfigurationElement() {
49         return new ConfigurationElementModel();
50     }
51
52     /**
53      * Returns a new configuration property model which is not initialized.
54      *
55      * @return a new configuration property model
56      */

57     public ConfigurationPropertyModel createConfigurationProperty() {
58         return new ConfigurationPropertyModel();
59     }
60
61     /**
62      * Returns a new extension model which is not initialized.
63      *
64      * @return a new extension model
65      */

66     public ExtensionModel createExtension() {
67         return new ExtensionModel();
68     }
69
70     /**
71      * Returns a new extension point model which is not initialized.
72      *
73      * @return a new extension point model
74      */

75     public ExtensionPointModel createExtensionPoint() {
76         return new ExtensionPointModel();
77     }
78
79     /**
80      * Returns a new library model which is initialized to not export any
81      * of its code.
82      *
83      * @return a new library model
84      */

85     public LibraryModel createLibrary() {
86         return new LibraryModel();
87     }
88
89     /**
90      * Returns a new plug-in descriptor model which is not initialized.
91      *
92      * @return a new plug-in descriptor model
93      */

94     public PluginDescriptorModel createPluginDescriptor() {
95         return new PluginDescriptorModel();
96     }
97
98     /**
99      * Returns a new plug-in fragment model which is not initialized.
100      *
101      * @return a new plug-in fragment model
102      */

103     public PluginFragmentModel createPluginFragment() {
104         return new PluginFragmentModel();
105     }
106
107     /**
108      * Returns a new plug-in prerequisite model which is initialized to
109      * not export its code and to not require an exact match.
110      *
111      * @return a new plug-in prerequisite model
112      */

113     public PluginPrerequisiteModel createPluginPrerequisite() {
114         return new PluginPrerequisiteModel();
115     }
116
117     /**
118      * Returns a new plug-in registry model with an empty plug-in table.
119      *
120      * @return a new plug-in registry model
121      */

122     public PluginRegistryModel createPluginRegistry() {
123         return new PluginRegistryModel();
124     }
125
126     /**
127      * Returns a new URL model which is not initialized.
128      *
129      * @return a new URL model
130      */

131     public URLModel createURL() {
132         return new URLModel();
133     }
134
135     /**
136      * Handles an error state specified by the status. The collection of all logged status
137      * objects can be accessed using <code>getStatus()</code>.
138      *
139      * @param error a status detailing the error condition
140      */

141     public void error(IStatus error) {
142         status.add(error);
143         if (InternalPlatform.DEBUG)
144             System.out.println(error.toString());
145     }
146
147     /**
148      * Returns all of the status objects logged thus far by this factory.
149      *
150      * @return a multi-status containing all of the logged status objects
151      */

152     public MultiStatus getStatus() {
153         return status;
154     }
155 }
156
Popular Tags