KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > ischema > ISchema


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.pde.internal.core.ischema;
12
13 import java.net.URL JavaDoc;
14
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.pde.core.IBaseModel;
17 import org.eclipse.pde.core.IModelChangeProvider;
18
19 /**
20  * Objects of this class encapsulate data loaded from the XML Schema file that
21  * defines an Eclipse extension point. These files are used for three reasons:
22  * <ul>
23  * <li>To provide grammar that can be used by validation parsers to validate
24  * extensions that plug into this extension point
25  * <li>To provide additional metadata about this extension point that can be
26  * used by PDE to provide user assistence in plug-in development
27  * <li>To provide enough material that can be used by tools to compose a
28  * reference HTML documentation about this extension point.
29  * </ul>
30  * Objects of this class can be changed if editable. Other classes can register
31  * as change listener in order to receive notification about these changes.
32  */

33 public interface ISchema extends ISchemaObject, IBaseModel, IModelChangeProvider {
34     String JavaDoc P_POINT = "pointId"; //$NON-NLS-1$
35

36     String JavaDoc P_PLUGIN = "pluginId"; //$NON-NLS-1$
37

38     int REFRESH_ADD = 1;
39
40     int REFRESH_DELETE = 2;
41
42     int REFRESH_RENAME = 3;
43
44     /**
45      * Returns a reference to a schema element defined in this schema or
46      * <samp>null</samp> if not found.
47      *
48      * @param name
49      * name of the element to find
50      */

51     ISchemaElement findElement(String JavaDoc name);
52
53     /**
54      * Returns an array of schema elements that can be children of the provided
55      * schema element. The information is computed based on the grammar rules in
56      * this schema. The computation ignores number of occurances of each
57      * element. Therefore, it will always return the same result even if there
58      * could be only one element of a certain type in the document and it
59      * already exists.
60      *
61      * @param element
62      * the parent element that is used for the calculation
63      * @return an array of elements that can appear as children of the provided
64      * element, according to the grammar of this schema
65      */

66     ISchemaElement[] getCandidateChildren(ISchemaElement element);
67
68     /**
69      * Returns an array of document sections that are defined in this schema.
70      *
71      * @return an array of sections in this schema
72      */

73     IDocumentSection[] getDocumentSections();
74
75     /**
76      * Returns a number of elements with global scope defined in this schema.
77      *
78      * @return number of global elements
79      */

80     public int getElementCount();
81
82     /**
83      * Returns a total number of elements after the included schemas have been
84      * resolved and their elements added to the list.
85      *
86      * @return the total number of elements including external schemas
87      */

88     public int getResolvedElementCount();
89
90     /**
91      * Returns an array of elements with the global scope defined in this
92      * schema.
93      *
94      * @return an array of global elements
95      */

96     public ISchemaElement[] getElements();
97
98     /**
99      * Returns an array of elements with the global scope defined in this schema
100      * and all the included schemas.
101      *
102      * @return an expanded array of global elements
103      */

104     public ISchemaElement[] getResolvedElements();
105
106     /**
107      * Returns an Id of the extension point that is defined in this schema.
108      *
109      * @return extension point Id of this schema
110      */

111     public String JavaDoc getQualifiedPointId();
112
113     public String JavaDoc getPointId();
114
115     public void setPointId(String JavaDoc pointId) throws CoreException;
116
117     public String JavaDoc getPluginId();
118
119     public void setPluginId(String JavaDoc pluginId) throws CoreException;
120
121     /**
122      * Returns an object that holds a reference to this schema. Descriptors are
123      * responsible for loading and disposing schema objects and could be
124      * implemented in various ways, depending on whether the schema is defined
125      * inside the workspace or is referenced externally.
126      *
127      * @return schema descriptor that holds this schema
128      */

129     public ISchemaDescriptor getSchemaDescriptor();
130
131     /**
132      * Returns a URL that defines this schema's location.
133      *
134      * @return a URL that points to this schema's location.
135      */

136     public URL JavaDoc getURL();
137
138     /**
139      * Returns a list of elements that correspond to the <samp>include</samp>
140      * statements in the schema file. Included schemas are incorporated into the
141      * model and references can be made to elements in the included files.
142      *
143      * @return an array of included schema elements or a zero-size array if
144      * none.
145      */

146     ISchemaInclude[] getIncludes();
147     
148     /**
149      * Returns whether the root schema element ( the <exension> element)
150      * has been marked deprecated, making this schema deprecated.
151      * @return true if this schema is deprecated
152      */

153     public boolean isDeperecated();
154     
155     /**
156      * Returns replacement schema in case this one is deprecated.
157      * @return the replacement schema
158      */

159     public String JavaDoc getDeprecatedSuggestion();
160 }
161
Popular Tags