Source Code Cross Referenced for IDEPlugin.java in  » UML » jrefactory » org » acm » seguin » ide » common » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » jrefactory » org.acm.seguin.ide.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:
050:        import java.io.File;
051:        import java.io.IOException;
052:        import org.acm.seguin.ide.common.options.PropertiesFile;
053:        import net.sourceforge.jrefactory.ast.Node;
054:
055:        /**
056:         *  Description of the Class
057:         *
058:         *@author    Chris Seguin
059:         */
060:        public class IDEPlugin {
061:            private static IDEInterface ideInterface = null;
062:
063:            /**
064:             *  Sets the Plugin attribute of the IDEPlugin class
065:             *
066:             *@param  ideIf  The new Plugin value
067:             */
068:            public static void setPlugin(IDEInterface ideIf) {
069:                ideInterface = ideIf;
070:            }
071:
072:            /**
073:             *  Description of the Method
074:             *
075:             *@param  view    Description of Parameter
076:             *@param  buffer  The new Buffer value
077:             */
078:            public static void setBuffer(Frame view, Object buffer) {
079:                if (ideInterface != null) {
080:                    ideInterface.setBuffer(view, buffer);
081:                }
082:            }
083:
084:            /**
085:             *  Description of the Method
086:             *
087:             *@param  view   Description of Parameter
088:             *@param  start  The new Selection value
089:             *@param  end    The new Selection value
090:             */
091:            public static void setSelection(Frame view, Object buffer,
092:                    int start, int end) {
093:                if (ideInterface != null) {
094:                    ideInterface.setSelection(view, buffer, start, end);
095:                }
096:            }
097:
098:            /**
099:             *  Gets the Property attribute of the IDEPlugin class
100:             *
101:             *@param  prop  Description of Parameter
102:             *@return       The Property value
103:             */
104:            public static String getProperty(String prop) {
105:                //System.out.println("ideInterface="+ideInterface);
106:                if (ideInterface == null) {
107:                    return System.getProperty(prop);
108:                }
109:                return ideInterface.getIDEProperty(prop);
110:            }
111:
112:            /**
113:             *  Gets the Property attribute of the IDEPlugin class
114:             *
115:             *@param  prop   Description of Parameter
116:             *@param  deflt  Description of Parameter
117:             *@return        The Property value
118:             */
119:            public static String getProperty(String prop, String deflt) {
120:                if (ideInterface == null) {
121:                    return System.getProperty(prop, deflt);
122:                }
123:                return ideInterface.getIDEProperty(prop, deflt);
124:            }
125:
126:            /**
127:             *  Gets the Projects attribute of the IDEPlugin class
128:             *
129:             *@param  parent  Description of Parameter
130:             *@return         The Projects value
131:             */
132:            public static String[] getProjects(Frame parent) {
133:                if (ideInterface == null) {
134:                    return new String[] { "default" };
135:                }
136:                return ideInterface.getIDEProjects(parent);
137:            }
138:
139:            /**
140:             *  Gets the Properties attribute of the IDEPlugin class
141:             *
142:             *@param  type     Description of Parameter
143:             *@param  project  Description of Parameter
144:             *@return          The Properties value
145:             */
146:            public static PropertiesFile getProperties(String type,
147:                    String project) {
148:                return ideInterface.getProperties(type, project);
149:            }
150:
151:            /**
152:             *  Description of the Method
153:             *
154:             *@param  buffer  Description of Parameter
155:             *@param  begin   Description of Parameter
156:             *@return         The BeginLine value
157:             */
158:            public static int getLineStartOffset(Object buffer, int begin) {
159:                if (ideInterface != null) {
160:                    return ideInterface.getLineStartOffset(buffer, begin);
161:                }
162:                return 0;
163:            }
164:
165:            /**
166:             *  Description of the Method
167:             *
168:             *@param  buffer  Description of Parameter
169:             *@param  end     Description of Parameter
170:             *@return         The LineEndOffset value
171:             */
172:            public static int getLineEndOffset(Object buffer, int end) {
173:                if (ideInterface != null) {
174:                    return ideInterface.getLineEndOffset(buffer, end);
175:                }
176:                return 0;
177:            }
178:
179:            /**
180:             *  Description of the Method
181:             *
182:             *@param  view  Description of Parameter
183:             *@return       The Text value
184:             */
185:            public static String getText(Frame view, Object buffer) {
186:                if (ideInterface != null) {
187:                    return ideInterface.getText(view, buffer);
188:                }
189:                return "";
190:            }
191:
192:            /**
193:             *  Description of the Method
194:             *
195:             *@param  buffer  Description of Parameter
196:             *@return         The LineCount value
197:             */
198:            public static int getLineCount(Object buffer) {
199:                if (ideInterface != null) {
200:                    return ideInterface.getLineCount(buffer);
201:                }
202:                return 0;
203:            }
204:
205:            /**
206:             *  Description of the Method
207:             *
208:             *@param  view    Description of Parameter
209:             *@param  buffer  Description of Parameter
210:             *@return         The ProjectName value
211:             */
212:            public static String getProjectName(Frame view, Object buffer) {
213:                if (ideInterface != null) {
214:                    return ideInterface.getProjectName(view, buffer);
215:                }
216:                return null;
217:            }
218:
219:            /**
220:             *  Description of the Method
221:             *
222:             *@param  parent  Description of Parameter
223:             */
224:            public static void showWaitCursor(Frame parent) {
225:                if (ideInterface != null) {
226:                    ideInterface.showWaitCursor(parent);
227:                }
228:            }
229:
230:            /**
231:             *  Description of the Method
232:             *
233:             *@param  parent  Description of Parameter
234:             */
235:            public static void hideWaitCursor(Frame parent) {
236:                if (ideInterface != null) {
237:                    ideInterface.hideWaitCursor(parent);
238:                }
239:            }
240:
241:            /**
242:             *  Description of the Method
243:             *
244:             *@param  urgency  Description of Parameter
245:             *@param  source   Description of Parameter
246:             *@param  message  Description of Parameter
247:             */
248:            public static void log(int urgency, Object source, Object message) {
249:                if (ideInterface != null) {
250:                    ideInterface.log(urgency, source, message);
251:                } else {
252:                    System.err.println(source + ": " + message);
253:                }
254:            }
255:
256:            /**
257:             *  Description of the Method
258:             *
259:             *@param  view             Description of Parameter
260:             *@exception  IOException  Description of Exception
261:             */
262:            public static void cpdBuffer(Frame view, Object buffer)
263:                    throws IOException {
264:                if (ideInterface != null) {
265:                    ideInterface.cpdBuffer(view, buffer);
266:                }
267:            }
268:
269:            /**
270:             *  Description of the Method
271:             *
272:             *@param  view             Description of Parameter
273:             *@exception  IOException  Description of Exception
274:             */
275:            public static void cpdAllOpenBuffers(Frame view) throws IOException {
276:                if (ideInterface != null) {
277:                    ideInterface.cpdAllOpenBuffers(view);
278:                }
279:            }
280:
281:            /**
282:             *  Description of the Method
283:             *
284:             *@param  view             Description of Parameter
285:             *@param  recursive        Description of Parameter
286:             *@exception  IOException  Description of Exception
287:             */
288:            public static void cpdDir(Frame view, boolean recursive)
289:                    throws IOException {
290:                if (ideInterface != null) {
291:                    ideInterface.cpdDir(view, recursive);
292:                }
293:            }
294:
295:            /**
296:             *  Description of the Method
297:             *
298:             *@param  view             Description of Parameter
299:             *@param  fileName         Description of Parameter
300:             *@return                  Description of the Returned Value
301:             *@exception  IOException  Description of Exception
302:             */
303:            public static Object openFile(Frame view, String fileName)
304:                    throws IOException {
305:                if (ideInterface != null) {
306:                    return ideInterface.openFile(view, fileName);
307:                }
308:                return null;
309:            }
310:
311:            /**
312:             *  Description of the Method
313:             *
314:             *@param  view   Description of Parameter
315:             *@param  start  Description of Parameter
316:             */
317:            public static void moveCaretPosition(Frame view, Object buffer,
318:                    int start) {
319:                if (ideInterface != null) {
320:                    ideInterface.moveCaretPosition(view, buffer, start);
321:                }
322:            }
323:
324:            /**
325:             *  Description of the Method
326:             *
327:             *@param  runnable  Description of Parameter
328:             */
329:            public static void runInAWTThread(Runnable runnable) {
330:                if (ideInterface != null) {
331:                    ideInterface.runInAWTThread(runnable);
332:                }
333:            }
334:
335:            /**
336:             *  Description of the Method
337:             *
338:             *@param  view  Description of Parameter
339:             */
340:            public static void checkBuffer(Frame view, Object buffer) {
341:                if (ideInterface != null) {
342:                    ideInterface.checkBuffer(view, buffer);
343:                }
344:            }
345:
346:            /**
347:             *  Description of the Method
348:             *
349:             *@param  view  Description of Parameter
350:             */
351:            public static void checkAllOpenBuffers(Frame view) {
352:                if (ideInterface != null) {
353:                    ideInterface.checkAllOpenBuffers(view);
354:                }
355:            }
356:
357:            /**
358:             *  Description of the Method
359:             *
360:             *@param  view       Description of Parameter
361:             *@param  recursive  Description of Parameter
362:             */
363:            public static void checkDirectory(Frame view, boolean recursive) {
364:                if (ideInterface != null) {
365:                    ideInterface.checkDirectory(view, recursive);
366:                }
367:            }
368:
369:            /**
370:             *  Description of the Method
371:             *
372:             *@param  view    Description of Parameter
373:             *@param  buffer  Description of Parameter
374:             */
375:            public static void goToBuffer(Frame view, Object buffer) {
376:                if (ideInterface != null) {
377:                    ideInterface.goToBuffer(view, buffer);
378:                }
379:            }
380:
381:            /**
382:             *  Description of the Method
383:             *
384:             *@param  view    Description of Parameter
385:             *@param  buffer  Description of Parameter
386:             */
387:            public static void saveProperties() {
388:                if (ideInterface != null) {
389:                    ideInterface.saveProperties();
390:                }
391:            }
392:
393:            /**
394:             *  Description of the Method
395:             *
396:             * @param  buffer  Description of Parameter
397:             * @return         The File path for this buffer
398:             */
399:            public static String getFilePathForBuffer(Object buffer) {
400:                if (ideInterface != null) {
401:                    return ideInterface.getFilePathForBuffer(buffer);
402:                }
403:                return "";
404:            }
405:
406:            /**
407:             *  Load an icon from the IDE
408:             *
409:             * @param  name  The name of the icon.
410:             * @return       An icon (or null if the icon cannot be found).
411:             */
412:            public static Icon loadIcon(String name) {
413:                if (ideInterface != null) {
414:                    return ideInterface.loadIcon(name);
415:                }
416:                return null;
417:            }
418:
419:            /**
420:             *  Returns the frame that contains the editor. If this is not available or
421:             *  you want dialog boxes to be centered on the screen return null from this
422:             *  operation.
423:             *
424:             *@return    the frame
425:             */
426:            public static Frame getEditorFrame() {
427:                if (ideInterface != null) {
428:                    return ideInterface.getEditorFrame();
429:                }
430:                return null;
431:            }
432:
433:            /**
434:             * Get the current (atcive) buffer.
435:             *
436:             * @param  view  The frame containing the IDE.
437:             * @return       The active buffer or null if no active buffer.
438:             */
439:            public static Object getCurrentBuffer(Frame view) {
440:                if (ideInterface != null) {
441:                    return ideInterface.getCurrentBuffer(view);
442:                }
443:                return null;
444:            }
445:
446:            /**
447:             * Get the line number of the cursor within the current buffer.
448:             *
449:             * @param  view  The frame containing the IDE.
450:             * @return       The ine number of the cursor in the current buffer, or -1 if no current buffer.
451:             */
452:            public static int getLineNumber(Frame view, Object buffer) {
453:                if (ideInterface != null) {
454:                    return ideInterface.getLineNumber(view, buffer);
455:                }
456:                return -1;
457:            }
458:
459:            /**
460:             * Get the line number of the cursor within the current buffer.
461:             *
462:             * @param  view  The frame containing the IDE.
463:             * @param  buffer  Description of Parameter
464:             * @return       The line number of the cursor in the current buffer, or -1 if no current buffer.
465:             */
466:            public static void setLineNumber(Frame view, Object buffer,
467:                    int lineNumber) {
468:                if (lineNumber < 1) {
469:                    throw new IllegalArgumentException(
470:                            "lineNumber must be 1 or greater: " + lineNumber);
471:                }
472:                if (ideInterface != null) {
473:                    ideInterface.setLineNumber(view, buffer, lineNumber);
474:                }
475:            }
476:
477:            /**
478:             *  Does the buffer contain Java source code.
479:             *
480:             * @param  view  The frame containing the IDE.
481:             * @param  buffer  Description of Parameter
482:             *@return <code>true</code> if the buffer contains Java source code, <code>false</code> otherwise.
483:             */
484:            public static boolean bufferContainsJavaSource(Frame view,
485:                    Object buffer) {
486:                if (ideInterface != null) {
487:                    return ideInterface.bufferContainsJavaSource(view, buffer);
488:                }
489:                return false;
490:            }
491:
492:            /**
493:             *  Sets the string in the IDE
494:             *
495:             * @param  view  The frame containing the IDE.
496:             * @param  buffer  Description of Parameter
497:             *@param  value  The new file contained in a string
498:             */
499:            public static void setText(Frame view, Object buffer, String value) {
500:                if (ideInterface != null) {
501:                    ideInterface.setText(view, buffer, value);
502:                }
503:            }
504:
505:            /**
506:             *  Gets the file that is being edited
507:             *
508:             *@return    The File value
509:             */
510:            public static File getFile(Frame view, Object buffer) {
511:                if (ideInterface != null) {
512:                    return ideInterface.getFile(view, buffer);
513:                }
514:                return null;
515:            }
516:
517:            /**
518:             * Indicates that a buffer has been parsed and that an Abstract Syntax Tree is available.
519:             *
520:             * @param  view  The frame containing the IDE.
521:             * @param  buffer  The buffer (containing Java Source) that has been parsed.
522:             * @param  compilationUnit  The root node of the AST.
523:             */
524:            public static void bufferParsed(Frame view, Object buffer,
525:                    Node compilationUnit) {
526:                if (ideInterface != null) {
527:                    ideInterface.bufferParsed(view, buffer, compilationUnit);
528:                }
529:            }
530:
531:            /**
532:             * Indicates that a buffer has been parsed and that a navigator tree of the source is available.
533:             *
534:             * @param  view    The frame containing the IDE.
535:             * @param  buffer  The buffer (containing Java Source) that has been parsed.
536:             * @param  node    The root node of the tree.
537:             */
538:            public static void bufferNavigatorTree(Frame view, Object buffer,
539:                    TreeNode node) {
540:                if (ideInterface != null) {
541:                    ideInterface.bufferNavigatorTree(view, buffer, node);
542:                }
543:            }
544:
545:            /**
546:             * Adds an annotation to an ide buffer.
547:             *
548:             * @param  view         The frame containing the IDE.
549:             * @param  buffer       The buffer (containing Java Source) that has been parsed.
550:             * @param  type         either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
551:             * @param  lineNo       The line number of the annotation.
552:             * @param  description  The annotation
553:             */
554:            public static void addAnnotation(Frame view, Object buffer,
555:                    int type, int lineNo, String description) {
556:                if (ideInterface != null) {
557:                    ideInterface.addAnnotation(view, buffer, type, lineNo,
558:                            description);
559:                }
560:            }
561:
562:            /**
563:             * Clears all annotation for an ide buffer.
564:             *
565:             * @param  view         The frame containing the IDE.
566:             * @param  buffer       The buffer (containing Java Source) that has been parsed.
567:             * @param  type         either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
568:             */
569:            public static void clearAnnotations(Frame view, Object buffer,
570:                    int type) {
571:                if (ideInterface != null) {
572:                    ideInterface.clearAnnotations(view, buffer, type);
573:                }
574:            }
575:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.