001: /*
002: ====================================================================
003: The JRefactory License, Version 1.0
004: Copyright (c) 2001 JRefactory. All rights reserved.
005: Redistribution and use in source and binary forms, with or without
006: modification, are permitted provided that the following conditions
007: are met:
008: 1. Redistributions of source code must retain the above copyright
009: notice, this list of conditions and the following disclaimer.
010: 2. Redistributions in binary form must reproduce the above copyright
011: notice, this list of conditions and the following disclaimer in
012: the documentation and/or other materials provided with the
013: distribution.
014: 3. The end-user documentation included with the redistribution,
015: if any, must include the following acknowledgment:
016: "This product includes software developed by the
017: JRefactory (http://www.sourceforge.org/projects/jrefactory)."
018: Alternately, this acknowledgment may appear in the software itself,
019: if and wherever such third-party acknowledgments normally appear.
020: 4. The names "JRefactory" must not be used to endorse or promote
021: products derived from this software without prior written
022: permission. For written permission, please contact seguin@acm.org.
023: 5. Products derived from this software may not be called "JRefactory",
024: nor may "JRefactory" appear in their name, without prior written
025: permission of Chris Seguin.
026: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
027: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
028: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
029: DISCLAIMED. IN NO EVENT SHALL THE CHRIS SEGUIN OR
030: ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
031: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
032: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
033: USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
034: ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
035: OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
036: OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
037: SUCH DAMAGE.
038: ====================================================================
039: This software consists of voluntary contributions made by many
040: individuals on behalf of JRefactory. For more information on
041: JRefactory, please see
042: <http://www.sourceforge.org/projects/jrefactory>.
043: */
044: package org.acm.seguin.ide.common;
045:
046: import java.awt.Frame;
047: import javax.swing.Icon;
048: import javax.swing.tree.TreeNode;
049: import java.io.File;
050: import java.io.IOException;
051:
052: import org.acm.seguin.ide.common.options.PropertiesFile;
053: import net.sourceforge.jrefactory.ast.Node;
054:
055: /**
056: * Description of the Interface
057: *
058: *@author Mike Atkinson
059: */
060: public interface IDEInterface {
061: /**
062: * Debugging message urgency. Should be used for messages only useful when debugging a problem.
063: *
064: *@since JRefactory 2.8.02
065: */
066: public final static int DEBUG = 1;
067:
068: /**
069: * Message urgency. Should be used for messages which give more detail than notices.
070: *
071: *@since JRefactory 2.8.02
072: */
073: public final static int MESSAGE = 3;
074:
075: /**
076: * Notice urgency. Should be used for messages that directly affect the user.
077: *
078: *@since JRefactory 2.8.02
079: */
080: public final static int NOTICE = 5;
081:
082: /**
083: * Warning urgency. Should be used for messages that warrant attention.
084: *
085: *@since JRefactory 2.8.02
086: */
087: public final static int WARNING = 7;
088:
089: /**
090: * Error urgency. Should be used for messages that signal a failure.
091: *
092: *@since JRefactory 2.8.02
093: */
094: public final static int ERROR = 9;
095:
096: /**
097: * Signals that this is to do with coding standards checking.
098: *
099: *@since JRefactory 2.9.17
100: */
101: public final static int CODING_STANDARDS = 1;
102:
103: /**
104: * Signals that this is to do with cut and paste detection.
105: *
106: *@since JRefactory 2.9.17
107: */
108: public final static int CUT_AND_PASTE_DETECTOR = 2;
109:
110: /**
111: * Gets the IDEProperty attribute of the IDEInterface object
112: *
113: *@param prop Description of Parameter
114: *@return The IDEProperty value
115: */
116: String getIDEProperty(String prop);
117:
118: /**
119: * Gets the IDEProperty attribute of the IDEInterface object
120: *
121: *@param prop Description of Parameter
122: *@param deflt Description of Parameter
123: *@return The IDEProperty value
124: */
125: String getIDEProperty(String prop, String deflt);
126:
127: /**
128: * Gets the IDEProjects attribute of the IDEInterface object
129: *
130: *@param parent Description of Parameter
131: *@return The IDEProjects value
132: */
133: String[] getIDEProjects(Frame parent);
134:
135: /**
136: * Description of the Method
137: *
138: *@param parent Description of Parameter
139: */
140: void showWaitCursor(Frame parent);
141:
142: /**
143: * Description of the Method
144: *
145: *@param parent Description of Parameter
146: */
147: void hideWaitCursor(Frame parent);
148:
149: /**
150: * Description of the Method
151: *
152: *@param urgency Description of Parameter
153: *@param source Description of Parameter
154: *@param message Description of Parameter
155: */
156: void log(int urgency, Object source, Object message);
157:
158: /**
159: * Gets the Properties attribute of the IDEInterface object
160: *
161: *@param type Description of Parameter
162: *@param project Description of Parameter
163: *@return The Properties value
164: */
165: PropertiesFile getProperties(String type, String project);
166:
167: /**
168: * Description of the Method
169: *
170: *@param view Description of Parameter
171: *@param fileName The new Buffer value
172: */
173: void setBuffer(Frame view, Object fileName);
174:
175: /**
176: * Description of the Method
177: *
178: *@param view Description of Parameter
179: *@param start The new Selection value
180: *@param end The new Selection value
181: */
182: void setSelection(Frame view, Object buffer, int start, int end);
183:
184: /**
185: * Description of the Method
186: *
187: *@param view Description of Parameter
188: *@exception IOException Description of Exception
189: */
190: void cpdBuffer(Frame view, Object buffer) throws IOException;
191:
192: /**
193: * Description of the Method
194: *
195: *@param view Description of Parameter
196: *@exception IOException Description of Exception
197: */
198: void cpdAllOpenBuffers(Frame view) throws IOException;
199:
200: /**
201: * Description of the Method
202: *
203: *@param view Description of Parameter
204: *@param recursive Description of Parameter
205: *@exception IOException Description of Exception
206: */
207: void cpdDir(Frame view, boolean recursive) throws IOException;
208:
209: /**
210: * Description of the Method
211: *
212: *@param view Description of Parameter
213: *@param fileName Description of Parameter
214: *@return Description of the Returned Value
215: *@exception IOException Description of Exception
216: */
217: Object openFile(Frame view, String fileName) throws IOException;
218:
219: /**
220: * Description of the Method
221: *
222: *@param buffer Description of Parameter
223: *@param begin Description of Parameter
224: *@return The BeginLine value
225: */
226: int getLineStartOffset(Object buffer, int begin);
227:
228: /**
229: * Description of the Method
230: *
231: *@param buffer Description of Parameter
232: *@param end Description of Parameter
233: *@return The LineEndOffset value
234: */
235: int getLineEndOffset(Object buffer, int end);
236:
237: /**
238: * Description of the Method
239: *
240: *@param view Description of Parameter
241: *@param start Description of Parameter
242: */
243: void moveCaretPosition(Frame view, Object buffer, int start);
244:
245: /**
246: * Description of the Method
247: *
248: *@param runnable Description of Parameter
249: */
250: void runInAWTThread(Runnable runnable);
251:
252: /**
253: * Description of the Method
254: *
255: *@param view Description of Parameter
256: *@return The Text value
257: */
258: String getText(Frame view, Object buffer);
259:
260: /**
261: * Description of the Method
262: *
263: *@param view Description of Parameter
264: */
265: void checkBuffer(Frame view, Object buffer);
266:
267: /**
268: * Description of the Method
269: *
270: *@param view Description of Parameter
271: */
272: void checkAllOpenBuffers(Frame view);
273:
274: /**
275: * Description of the Method
276: *
277: *@param view Description of Parameter
278: *@param recursive Description of Parameter
279: */
280: void checkDirectory(Frame view, boolean recursive);
281:
282: /**
283: * Description of the Method
284: *
285: *@param view Description of Parameter
286: *@param buffer Description of Parameter
287: */
288: void goToBuffer(Frame view, Object buffer);
289:
290: /**
291: * Description of the Method
292: *
293: *@param buffer Description of Parameter
294: *@return The LineCount value
295: */
296: int getLineCount(Object buffer);
297:
298: /**
299: * Description of the Method
300: *
301: *@param view Description of Parameter
302: *@param buffer Description of Parameter
303: *@return The ProjectName value
304: */
305: String getProjectName(Frame view, Object buffer);
306:
307: /**
308: * Description of the Method
309: *
310: *@param view Description of Parameter
311: *@param buffer Description of Parameter
312: */
313: void saveProperties();
314:
315: /**
316: * Description of the Method
317: *
318: * @param buffer Description of Parameter
319: * @return The File path for this buffer
320: */
321: String getFilePathForBuffer(Object buffer);
322:
323: /**
324: * Load an icon from the IDE
325: *
326: * @param name The name of the icon.
327: * @return An icon (or null if the icon cannot be found).
328: */
329: Icon loadIcon(String name);
330:
331: /**
332: * Returns the frame that contains the editor. If this is not available or
333: * you want dialog boxes to be centered on the screen return null from this
334: * operation.
335: *
336: *@return the frame
337: */
338: Frame getEditorFrame();
339:
340: /**
341: * Get the current (atcive) buffer.
342: *
343: * @param view The frame containing the IDE.
344: * @return The active buffer or null if no active buffer.
345: */
346: Object getCurrentBuffer(Frame view);
347:
348: /**
349: * Get the line number of the cursor within the current buffer.
350: *
351: * @param view The frame containing the IDE.
352: * @param buffer Description of Parameter
353: * @param lineNumber The line number of the cursor in the current buffer.
354: */
355: int getLineNumber(Frame view, Object buffer);
356:
357: /**
358: * Get the line number of the cursor within the current buffer.
359: *
360: * @param view The frame containing the IDE.
361: * @param buffer Description of Parameter
362: * @return The line number of the cursor in the current buffer, or -1 if no current buffer.
363: */
364: void setLineNumber(Frame view, Object buffer, int lineNumber);
365:
366: /**
367: * Does the buffer contain Java source code.
368: *
369: * @param view The frame containing the IDE.
370: * @param buffer Description of Parameter
371: *@return <code>true</code> if the buffer contains Java source code, <code>false</code> otherwise.
372: */
373: boolean bufferContainsJavaSource(Frame view, Object buffer);
374:
375: /**
376: * Sets the string in the IDE
377: *
378: * @param view The frame containing the IDE.
379: * @param buffer Description of Parameter
380: *@param value The new file contained in a string
381: */
382: void setText(Frame view, Object buffer, String value);
383:
384: /**
385: * Gets the file that is being edited
386: *
387: *@return The File value
388: */
389: File getFile(Frame view, Object buffer);
390:
391: /**
392: * Indicates that a buffer has been parsed and that an Abstract Syntax Tree is available.
393: *
394: * @param view The frame containing the IDE.
395: * @param buffer The buffer (containing Java Source) that has been parsed.
396: * @param compilationUnit The root node of the AST.
397: */
398: void bufferParsed(Frame view, Object buffer, Node compilationUnit);
399:
400: /**
401: * Indicates that a buffer has been parsed and that a navigator tree of the source is available.
402: *
403: * @param view The frame containing the IDE.
404: * @param buffer The buffer (containing Java Source) that has been parsed.
405: * @param node The root node of the tree.
406: */
407: void bufferNavigatorTree(Frame view, Object buffer, TreeNode node);
408:
409: /**
410: * Adds an annotation to an ide buffer.
411: *
412: * @param view The frame containing the IDE.
413: * @param buffer The buffer (containing Java Source) that has been parsed.
414: * @param type either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
415: * @param lineNo The line number of the annotation.
416: * @param description The annotation
417: */
418: void addAnnotation(Frame view, Object buffer, int type, int lineNo,
419: String description);
420:
421: /**
422: * Clears all annotation for an ide buffer.
423: *
424: * @param view The frame containing the IDE.
425: * @param buffer The buffer (containing Java Source) that has been parsed.
426: * @param type either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
427: */
428: void clearAnnotations(Frame view, Object buffer, int type);
429: }
|