KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > model > IAntModel


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.ant.internal.ui.model;
12
13 import java.io.File JavaDoc;
14 import java.net.URLClassLoader JavaDoc;
15 import java.util.Map JavaDoc;
16
17 import org.apache.tools.ant.BuildException;
18 import org.apache.tools.ant.Project;
19 import org.apache.tools.ant.Target;
20 import org.apache.tools.ant.Task;
21 import org.eclipse.core.resources.IFile;
22 import org.eclipse.jface.text.BadLocationException;
23 import org.xml.sax.Attributes JavaDoc;
24
25 public interface IAntModel {
26
27     /**
28      * Returns the project node for this Ant model
29      * @return the project node for this Ant model
30      */

31     AntProjectNode getProjectNode();
32
33     /**
34      * Returns the name of the external entity defined by the specified path
35      * @param path the path to the entity
36      * @return the name or the entity or <code>null</code> if no entity could be resolved
37      */

38     String JavaDoc getEntityName(String JavaDoc path);
39
40     /**
41      * Returns the location provider for this Ant model
42      * @return the location provider for this Ant model
43      */

44     LocationProvider getLocationProvider();
45
46     /**
47      * Disposes this Ant model
48      */

49     void dispose();
50
51     /**
52      * Reconciles this Ant model with the buildfile it represents
53      */

54     void reconcile();
55
56     /**
57      * Sets the classloader for this Ant model
58      * @param newClassLoader the classloader to use when resolving this Ant model
59      */

60     void setClassLoader(URLClassLoader JavaDoc newClassLoader);
61     
62     /**
63      * Sets the extra properties to be used for parsing
64      * If global settings as defined in the Ant UI preferences are to be used this method does not need to be called.
65      * @param properties the properties to ensure are set for parsing.
66      */

67     void setProperties(Map JavaDoc properties);
68     
69     /**
70      * Sets the property files to be used for parsing
71      * If global settings as defined in the Ant UI preferences are to be used this method does not need to be called.
72      * @param propertyFiles the file names of the property files to use for parsing
73      */

74     void setPropertyFiles(String JavaDoc[] propertyFiles);
75
76     /**
77      * Returns the Eclipse resource for the buildfile this Ant model represents
78      * @return the Eclipse resource or <code>null</null> if the buildfile is not in the workspace
79      */

80     IFile getFile();
81
82     /**
83      * Handles a <code>BuildException</code> that occurred during parsing.
84      * @param be the build exception that occurred
85      * @param node the node associated with the problem
86      * @param severity the severity of the problem
87      */

88     void handleBuildException(BuildException be, AntElementNode node, int severity);
89
90     /**
91      * Returns the project node for this Ant model
92      * @param reconcile whether or not to ensure the Ant model is reconciled before retrieving the project node
93      * @return the project node for this Ant model
94      */

95     AntProjectNode getProjectNode(boolean reconcile);
96
97     /**
98      * Adds the new target to this Ant model
99      * @param newTarget the new Apache Ant target
100      * @param lineNumber the line number of the new target
101      * @param columnNumber the column number of the new target
102      */

103     void addTarget(Target newTarget, int lineNumber, int columnNumber);
104
105     /**
106      * Adds the new project to this Ant model
107      * @param project the new Apache Ant project
108      * @param lineNumber the line number of the new target
109      * @param columnNumber the column number of the new target
110      */

111     void addProject(Project project, int lineNumber, int columnNumber);
112
113     /**
114      * Return the <code>java.io.File</code> that is the buildfile that this Ant model represents
115      * @return the <code>java.io.File</code> that is the buildfile
116      */

117     //TODO Could this just be getPath().toLocation();
118
File JavaDoc getEditedFile();
119     
120     /**
121      * Returns whether this model contains task information
122      * @return whether task information is included in this model
123      */

124     boolean canGetTaskInfo();
125     
126     /**
127      * Returns whether this model contains lexical information
128      * @return whether lexical information is included in this model
129      */

130     boolean canGetLexicalInfo();
131     
132     /**
133      * Returns whether this model contains position information for the elements
134      * @return whether position information is included in this model
135      */

136     boolean canGetPositionInfo();
137
138     /**
139      * Adds a comment to the Ant model
140      * Only called if <code>canGetLexicalInfo()</code> is <code>true</code>
141      * @param lineNumber the line number of the comment
142      * @param columnNumber the column number of the comment
143      * @param length the length of the comment
144      */

145     void addComment(int lineNumber, int columnNumber, int length);
146
147     /**
148      * Adds a DTD element to the Ant model
149      * Only called if <code>canGetLexicalInfo()</code> is <code>true</code>
150      * @param name the name of the DTD element
151      * @param lineNumber the line number of the comment
152      * @param columnNumber the column number of the comment
153      */

154     void addDTD(String JavaDoc name, int lineNumber, int columnNumber);
155
156     /**
157      * Adds the external entity to the Ant model
158      * @param name the name of the external entity
159      * @param currentEntityPath the path of the entity
160      */

161     void addEntity(String JavaDoc name, String JavaDoc currentEntityPath);
162
163     /**
164      * Adds a task element to the Ant model
165      * Only called if <code>canGetTaskInfo()</code>() is <code>true</code>
166      * @param task the new Apache Ant task
167      * @param parentTask the parent Apache Ant task or <code>null</code>
168      * @param attributes the attributes of the new task
169      * @param lineNumber the line number of the task
170      * @param columnNumber the column number of the task
171      */

172     void addTask(Task newTask, Task parentTask, Attributes JavaDoc attributes, int lineNumber, int columnNumber);
173
174     /**
175      * Sets the length of the current element that was just finished being parsed
176      * @param lineNumber the current line number of parsing
177      * @param columnNumber the current column number of parsing
178      */

179     void setCurrentElementLength(int lineNumber, int columnNumber);
180
181     /**
182      * Returns the offset in the document associated with this Ant model for the
183      * given line number and position in the line
184      * @param lineNumber the line number in the doc
185      * @param column the column number in that line
186      * @return the offset in the document
187      * @throws BadLocationException
188      */

189     int getOffset(int lineNumber, int column) throws BadLocationException;
190
191     /**
192      * Handles a fatal error from an exception during parsing.
193      * @param e the exception that occurred
194      */

195     void error(Exception JavaDoc e);
196
197     /**
198      * Handles a fatal error from an exception during parsing.
199      * @param e the exception that occurred
200      */

201     void fatalError(Exception JavaDoc e);
202
203     /**
204      * Handles a warning from an exception during parsing.
205      * @param e the exception that occurred
206      */

207     void warning(Exception JavaDoc e);
208
209     void errorFromElement(Exception JavaDoc e, AntElementNode element, int lineNumber, int columnNumber);
210
211     void errorFromElementText(Exception JavaDoc e, int offset, int columnNumber);
212
213     /**
214      * Returns the text in the document of this Ant model for the given offset and length
215      *
216      * @param offset the offset within the document
217      * @param length the length of text to retrieve
218      * @return the text at the given offset of <code>null</code> if not contained within the document range
219      */

220     String JavaDoc getText(int offset, int length);
221     
222     /**
223      * Caches the text from the provided defining node so that the node definitions are only
224      * updated if the text changes on reconciliation
225      * @param node the defining task node to cache the associated text
226      */

227     void setDefiningTaskNodeText(AntDefiningTaskNode node);
228
229     /**
230      * Record the prefix-URI Namespace mapping.
231      * @param prefix The Namespace prefix being declared.
232      * @param uri The Namespace URI the prefix is mapped to.
233      */

234     void addPrefixMapping(String JavaDoc prefix, String JavaDoc uri);
235 }
236
Popular Tags