Source Code Cross Referenced for JavaStylePlugin.java in  » UML » jrefactory » org » acm » seguin » ide » jedit » 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.jedit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:            JavaStylePlugin.java - a Java pretty printer plugin for jEdit
0003:            Copyright (c) 1999 Andreas "Mad" Schaefer (andreas.schaefer@madplanet.ch)
0004:            Copyright (c) 2000,2001 Dirk Moebius (dmoebius@gmx.net)
0005:            jEdit buffer options:
0006:            :tabSize=4:indentSize=4:noTabs=false:maxLineLen=0:
0007:            This program is free software; you can redistribute it and/or
0008:            modify it under the terms of the GNU General Public License
0009:            as published by the Free Software Foundation; either version 2
0010:            of the License, or any later version.
0011:            This program is distributed in the hope that it will be useful,
0012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
0013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014:            GNU General Public License for more details.
0015:            You should have received a copy of the GNU General Public License
0016:            along with this program; if not, write to the Free Software
0017:            Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0018:         */
0019:        package org.acm.seguin.ide.jedit;
0020:
0021:        import java.awt.Frame;
0022:        import java.awt.event.ActionEvent;
0023:        import java.io.File;
0024:        import java.io.FileInputStream;
0025:        import java.io.FileNotFoundException;
0026:        import java.io.IOException;
0027:        import java.util.ArrayList;
0028:        import java.util.HashMap;
0029:        import java.util.HashSet;
0030:        import java.util.Iterator;
0031:        import java.util.List;
0032:        import java.util.Map;
0033:        import java.util.Properties;
0034:        import java.util.Set;
0035:
0036:        import javax.swing.Icon;
0037:        import javax.swing.ImageIcon;
0038:        import javax.swing.JFileChooser;
0039:        import javax.swing.JLabel;
0040:        import javax.swing.JOptionPane;
0041:        import javax.swing.JPanel;
0042:        import javax.swing.JTextField;
0043:        import javax.swing.tree.TreeNode;
0044:        import errorlist.DefaultErrorSource;
0045:
0046:        import errorlist.ErrorSource;
0047:        import net.sourceforge.jrefactory.action.*;
0048:
0049:        import net.sourceforge.jrefactory.ast.Node;
0050:        import net.sourceforge.jrefactory.parser.JavaParser;
0051:
0052:        import org.acm.seguin.JRefactoryVersion;
0053:        import org.acm.seguin.ide.common.CPDDuplicateCodeViewer;
0054:        import org.acm.seguin.ide.common.CodingStandardsViewer;
0055:        import org.acm.seguin.ide.common.IDEInterface;
0056:        import org.acm.seguin.ide.common.IDEPlugin;
0057:        import org.acm.seguin.ide.common.options.PropertiesFile;
0058:        import org.acm.seguin.ide.common.options.SelectedRules;
0059:
0060:        import org.acm.seguin.pmd.PMD;
0061:        import org.acm.seguin.pmd.PMDException;
0062:        import org.acm.seguin.pmd.Report;
0063:        import org.acm.seguin.pmd.RuleContext;
0064:        import org.acm.seguin.pmd.RuleSetNotFoundException;
0065:        import org.acm.seguin.pmd.RuleViolation;
0066:        import org.acm.seguin.pmd.cpd.CPD;
0067:        import org.acm.seguin.pmd.cpd.CPPLanguage;
0068:        import org.acm.seguin.pmd.cpd.FileFinder;
0069:        import org.acm.seguin.pmd.cpd.JavaLanguage;
0070:        import org.acm.seguin.pmd.cpd.Mark;
0071:        import org.acm.seguin.pmd.cpd.Match;
0072:        import org.acm.seguin.pmd.cpd.PHPLanguage;
0073:        import org.acm.seguin.tools.RefactoryInstaller;
0074:        import org.acm.seguin.util.FileSettings;
0075:
0076:        import org.gjt.sp.jedit.Buffer;
0077:        import org.gjt.sp.jedit.EBComponent;
0078:        import org.gjt.sp.jedit.EBMessage;
0079:        import org.gjt.sp.jedit.EBPlugin;
0080:        import org.gjt.sp.jedit.EditBus;
0081:        import org.gjt.sp.jedit.GUIUtilities;
0082:        import org.gjt.sp.jedit.View;
0083:        import org.gjt.sp.jedit.browser.VFSBrowser;
0084:        import org.gjt.sp.jedit.io.VFS;
0085:        import org.gjt.sp.jedit.io.VFSManager;
0086:        import org.gjt.sp.jedit.jEdit;
0087:        import org.gjt.sp.jedit.msg.*;
0088:        import org.gjt.sp.jedit.textarea.JEditTextArea;
0089:        import org.gjt.sp.jedit.textarea.Selection;
0090:        import org.gjt.sp.util.Log;
0091:
0092:        /**
0093:         *  A plugin for pretty printing the current jEdit buffer, using the PrettyPrinter of the JREFactory suite.
0094:         *
0095:         * @author     Mike Atkinson (<a href="mailto:javastyle@ladyshot.demon.co.uk"> Mike@ladyshot.demon.co.uk</a> )
0096:         * @author     Dirk Moebius (<a href="mailto:dmoebius@gmx.net"> dmoebius@gmx.net </a> )
0097:         * @since      1.0
0098:         * @created    14 July 2003
0099:         * @version    $Version: $
0100:         */
0101:        public class JavaStylePlugin extends EBPlugin implements  IDEInterface {
0102:            /**
0103:             *  Description of the Field
0104:             *
0105:             * @since    v 1.0
0106:             */
0107:            public final static String OPTION_RULES_PREFIX = "options.pmd.rules.";
0108:            /**
0109:             *  Description of the Field
0110:             *
0111:             * @since    v 1.0
0112:             */
0113:            public final static String OPTION_UI_DIRECTORY_POPUP = "pmd.ui.directorypopup";
0114:            /**
0115:             *  Description of the Field
0116:             *
0117:             * @since    v 1.0
0118:             */
0119:            public final static String DEFAULT_TILE_MINSIZE_PROPERTY = "pmd.cpd.defMinTileSize";
0120:            /**
0121:             *  Description of the Field
0122:             *
0123:             * @since    v 1.0
0124:             */
0125:            public final static String NAME = "javastyle";
0126:            /**
0127:             *  Description of the Field
0128:             *
0129:             * @since    v 1.0
0130:             */
0131:            public final static String JAVASTYLE_DIR = jEdit
0132:                    .getSettingsDirectory()
0133:                    + File.separator + "javastyle";
0134:
0135:            /**
0136:             *  Description of the Field
0137:             *
0138:             * @since    v 1.0
0139:             */
0140:            public final static File PRETTY_SETTINGS_FILE = new File(
0141:                    JAVASTYLE_DIR + File.separator + ".Refactory",
0142:                    "pretty.settings");
0143:
0144:            /**
0145:             *  Description of the Field
0146:             *
0147:             * @since    v 1.0
0148:             */
0149:            public static JavaStylePlugin jsPlugin = null;
0150:            private static DefaultErrorSource errorSource = null;
0151:            private static PropertiesFile properties = null;
0152:            private static Properties ideProperties = new Properties();
0153:            private static Map propertiesMap = new HashMap();
0154:
0155:            private static List navigators = new ArrayList();
0156:
0157:            /**
0158:             *  Description of the Method
0159:             *
0160:             * @param  view    Description of Parameter
0161:             * @param  buffer  The new Selection value
0162:             * @param  start   The new Selection value
0163:             * @param  end     The new Selection value
0164:             * @since          v 1.0
0165:             */
0166:            public void setSelection(Frame view, Object buffer, int start,
0167:                    int end) {
0168:                ((View) view).getTextArea().setSelection(
0169:                        new Selection.Range(start, end - 1));
0170:            }
0171:
0172:            /**
0173:             *  Description of the Method
0174:             *
0175:             * @param  view    Description of Parameter
0176:             * @param  buffer  The new Buffer value
0177:             * @since          v 1.0
0178:             */
0179:            public void setBuffer(Frame view, Object buffer) {
0180:                ((View) view).setBuffer((Buffer) buffer);
0181:            }
0182:
0183:            /**
0184:             *  Sets the string in the IDE
0185:             *
0186:             * @param  view    The frame containing the IDE.
0187:             * @param  buffer  Description of Parameter
0188:             * @param  value   The new file contained in a string
0189:             * @since          v 1.0
0190:             */
0191:            public void setText(Frame view, Object buffer, String value) {
0192:                Buffer buf = (Buffer) buffer;
0193:                if (buf != null && value != null && buf.isEditable()) {
0194:                    buf.writeLock();
0195:                    buf.beginCompoundEdit();
0196:                    buf.remove(0, buf.getLength());
0197:                    buf.insert(0, value);
0198:                    buf.endCompoundEdit();
0199:                    buf.writeUnlock();
0200:                }
0201:            }
0202:
0203:            /**
0204:             *  Sets the line number
0205:             *
0206:             * @param  view        The new lineNumber value
0207:             * @param  buffer      The new lineNumber value
0208:             * @param  lineNumber  The new lineNumber value
0209:             * @since              2.9.12
0210:             */
0211:            public void setLineNumber(Frame view, Object buffer, int lineNumber) {
0212:                JEditTextArea textArea = ((View) view).getTextArea();
0213:                try {
0214:                    textArea.setCaretPosition(textArea
0215:                            .getLineStartOffset(lineNumber - 1));
0216:                } catch (Exception e) {
0217:                    textArea.getToolkit().beep();
0218:                }
0219:            }
0220:
0221:            /**
0222:             *  Gets the IDEProperty attribute of the JavaStylePlugin object
0223:             *
0224:             * @param  prop  Description of Parameter
0225:             * @return       The IDEProperty value
0226:             * @since        v 1.0
0227:             */
0228:            public String getIDEProperty(String prop) {
0229:                String value = null;
0230:                try {
0231:                    value = jEdit.getProperty(prop);
0232:                    if (value == null || value.equals("")) {
0233:                        value = ideProperties.getProperty(prop);
0234:                    }
0235:                } catch (Exception e) {
0236:                    Log.log(Log.ERROR, JavaStylePlugin.class,
0237:                            "can't find IDE property " + prop);
0238:                    value = ideProperties.getProperty(prop);
0239:                }
0240:                return (value == null) ? "<none>" : value;
0241:            }
0242:
0243:            /**
0244:             *  Gets the IDEProperty attribute of the JavaStylePlugin object
0245:             *
0246:             * @param  prop   Description of Parameter
0247:             * @param  deflt  Description of Parameter
0248:             * @return        The IDEProperty value
0249:             * @since         v 1.0
0250:             */
0251:            public String getIDEProperty(String prop, String deflt) {
0252:                if (prop == null) {
0253:                    Log.log(Log.ERROR, JavaStylePlugin.class,
0254:                            "IDE property == null");
0255:                    return null;
0256:                }
0257:                String value = null;
0258:                try {
0259:                    value = jEdit.getProperty(prop);
0260:                    if (value == null || value.equals("")) {
0261:                        value = ideProperties.getProperty(prop);
0262:                    }
0263:                } catch (Exception e) {
0264:                    Log.log(Log.ERROR, JavaStylePlugin.class,
0265:                            "can't find IDE property " + prop);
0266:                    value = ideProperties.getProperty(prop);
0267:                }
0268:                return (value == null) ? deflt : value;
0269:            }
0270:
0271:            /**
0272:             *  Description of the Method
0273:             *
0274:             * @param  buffer  Description of Parameter
0275:             * @return         The File path for this buffer
0276:             * @since          v 1.0
0277:             */
0278:            public String getFilePathForBuffer(Object buffer) {
0279:                return ((Buffer) buffer).getPath();
0280:            }
0281:
0282:            /**
0283:             *  Description of the Method
0284:             *
0285:             * @param  parent  Description of Parameter
0286:             * @return         The IDEProjects value
0287:             * @since          v 1.0
0288:             */
0289:            public String[] getIDEProjects(java.awt.Frame parent) {
0290:                try {
0291:                    Class clazz = Class.forName("projectviewer.ProjectViewer");
0292:                    //projectviewer.ProjectViewer viewer = projectviewer.ProjectViewer.getViewer((View) parent);
0293:                    projectviewer.ProjectManager manager = projectviewer.ProjectManager
0294:                            .getInstance();
0295:                    List projs = new ArrayList();
0296:
0297:                    projs.add("default");
0298:                    for (Iterator i = manager.getProjects(); i.hasNext();) {
0299:                        projectviewer.vpt.VPTProject proj = (projectviewer.vpt.VPTProject) i
0300:                                .next();
0301:                        String name = proj.getName();
0302:
0303:                        projs.add(name);
0304:                    }
0305:                    return (String[]) projs.toArray(new String[projs.size()]);
0306:                } catch (ClassNotFoundException e) {
0307:                }
0308:                return new String[0];
0309:            }
0310:
0311:            /**
0312:             *  Gets the CPDDuplicateCodeViewer attribute of the JavaStylePlugin object
0313:             *
0314:             * @param  view  Description of Parameter
0315:             * @return       The CPDDuplicateCodeViewer value
0316:             * @since        v 1.0
0317:             */
0318:            public CPDDuplicateCodeViewer getCPDDuplicateCodeViewer(View view) {
0319:                view.getDockableWindowManager().showDockableWindow("javastyle");
0320:
0321:                JRefactory refactory = (JRefactory) view
0322:                        .getDockableWindowManager().getDockableWindow(
0323:                                "javastyle");
0324:
0325:                return refactory.getCPDDuplicateCodeViewer();
0326:            }
0327:
0328:            /**
0329:             *  Gets the Properties attribute of the JavaStylePlugin class
0330:             *
0331:             * @param  type     Description of Parameter
0332:             * @param  project  Description of Parameter
0333:             * @return          The Properties value
0334:             * @since           v 1.0
0335:             */
0336:            public PropertiesFile getProperties(String type, String project) {
0337:                //System.out.println("getProperties(" + type+","+project + ")");
0338:                String key = ("default".equals(project)) ? type + "::null"
0339:                        : type + "::" + project;
0340:                PropertiesFile projectProperties = (PropertiesFile) propertiesMap
0341:                        .get(key);
0342:
0343:                //System.out.println("  key="+key+" ->projectProperties="+projectProperties);
0344:                if (projectProperties == null) {
0345:                    //System.out.println("  getting Properties(FileSettings.getSettings("+project+", \"Refactory\", "+type+")");
0346:                    projectProperties = new PropertiesFile(
0347:                            org.acm.seguin.util.FileSettings.getSettings(
0348:                                    project, "Refactory", type));
0349:                    propertiesMap.put(key, projectProperties);
0350:                }
0351:                return projectProperties;
0352:            }
0353:
0354:            /**
0355:             *  Description of the Method
0356:             *
0357:             * @param  buffer  Description of Parameter
0358:             * @param  begin   Description of Parameter
0359:             * @return         The BeginLine value
0360:             * @since          v 1.0
0361:             */
0362:            public int getLineStartOffset(Object buffer, int begin) {
0363:                return ((Buffer) buffer).getLineStartOffset(begin);
0364:            }
0365:
0366:            /**
0367:             *  Description of the Method
0368:             *
0369:             * @param  buffer  Description of Parameter
0370:             * @param  end     Description of Parameter
0371:             * @return         The LineEndOffset value
0372:             * @since          v 1.0
0373:             */
0374:            public int getLineEndOffset(Object buffer, int end) {
0375:                return ((Buffer) buffer).getLineEndOffset(end);
0376:            }
0377:
0378:            /**
0379:             *  Description of the Method
0380:             *
0381:             * @param  view    Description of Parameter
0382:             * @param  buffer  Description of Parameter
0383:             * @return         The Text value
0384:             * @since          v 1.0
0385:             */
0386:            public String getText(Frame view, Object buffer) {
0387:                Buffer buffer2 = (buffer == null) ? ((View) view).getBuffer()
0388:                        : (Buffer) buffer;
0389:                System.out.println("getText(" + buffer + ")");
0390:                return buffer2.getText(0, buffer2.getLength());
0391:            }
0392:
0393:            /**
0394:             *  Description of the Method
0395:             *
0396:             * @param  buffer  Description of Parameter
0397:             * @return         The LineCount value
0398:             * @since          v 1.0
0399:             */
0400:            public int getLineCount(Object buffer) {
0401:                return ((Buffer) buffer).getLineCount();
0402:            }
0403:
0404:            /**
0405:             *  Description of the Method
0406:             *
0407:             * @param  view    Description of Parameter
0408:             * @param  buffer  Description of Parameter
0409:             * @return         The ProjectName value
0410:             * @since          v 1.0
0411:             */
0412:            public String getProjectName(Frame view, Object buffer) {
0413:                return getProjectName((View) view, (Buffer) buffer);
0414:            }
0415:
0416:            /**
0417:             *  Returns the frame that contains the editor. If this is not available or you want dialog boxes to be centered on
0418:             *  the screen return null from this operation.
0419:             *
0420:             * @return    the frame
0421:             * @since     v 1.0
0422:             */
0423:            public Frame getEditorFrame() {
0424:                return jEdit.getActiveView();
0425:            }
0426:
0427:            /**
0428:             *  Get the current (atcive) buffer.
0429:             *
0430:             * @param  view  The frame containing the IDE.
0431:             * @return       The active buffer or null if no active buffer.
0432:             * @since        v 1.0
0433:             */
0434:            public Object getCurrentBuffer(Frame view) {
0435:                return (view == null) ? null : ((View) view).getBuffer();
0436:            }
0437:
0438:            /**
0439:             *  Get the line number of the cursor within the current buffer.
0440:             *
0441:             * @param  view    Description of Parameter
0442:             * @param  buffer  Description of Parameter
0443:             * @return         The ine number of the cursor in the current buffer, or -1 if no current buffer.
0444:             * @since          v 1.0
0445:             */
0446:            public int getLineNumber(Frame view, Object buffer) {
0447:                if (view != null) {
0448:                    JEditTextArea textArea = ((View) view).getTextArea();
0449:                    if (textArea != null) {
0450:                        System.out
0451:                                .println("JavaStylePlugin.getLineNumber() -> "
0452:                                        + textArea.getCaretLine());
0453:                        return textArea.getCaretLine();
0454:                    }
0455:                }
0456:                return -1;
0457:            }
0458:
0459:            /**
0460:             *  Gets the file that is being edited
0461:             *
0462:             * @param  view    Description of Parameter
0463:             * @param  buffer  Description of Parameter
0464:             * @return         The File value
0465:             * @since          v 1.0
0466:             */
0467:            public File getFile(Frame view, Object buffer) {
0468:                return (buffer == null) ? null : new File(((Buffer) buffer)
0469:                        .getPath());
0470:            }
0471:
0472:            /**
0473:             *  Indicates that a buffer has been parsed and that an Abstract Syntax Tree is available.
0474:             *
0475:             * @param  view             The frame containing the IDE.
0476:             * @param  buffer           The buffer (containing Java Source) that has been parsed.
0477:             * @param  compilationUnit  The root node of the AST.
0478:             * @since                   2.9.12
0479:             */
0480:            public void bufferParsed(Frame view, Object buffer,
0481:                    Node compilationUnit) {
0482:                EditBus
0483:                        .send(new JavaAST(this , (Buffer) buffer,
0484:                                compilationUnit));
0485:            }
0486:
0487:            /**
0488:             *  Indicates that a buffer has been parsed and that a navigator tree of the source is available.
0489:             *
0490:             * @param  view    The frame containing the IDE.
0491:             * @param  buffer  The buffer (containing Java Source) that has been parsed.
0492:             * @param  node    The root node of the tree.
0493:             * @since          2.9.12
0494:             */
0495:            public void bufferNavigatorTree(Frame view, Object buffer,
0496:                    TreeNode node) {
0497:                EditBus.send(new JavaTree(this , (Buffer) buffer, node));
0498:            }
0499:
0500:            /**
0501:             *  Load an icon from the IDE
0502:             *
0503:             * @param  name  The name of the icon.
0504:             * @return       An icon (or null if the icon cannot be found).
0505:             * @since        v 1.0
0506:             */
0507:            public Icon loadIcon(String name) {
0508:                Icon icon = GUIUtilities.loadIcon(name);
0509:                if (icon == null) {
0510:                    ClassLoader classLoader = this .getClass().getClassLoader();
0511:                    icon = new ImageIcon(classLoader.getResource(name));
0512:                }
0513:                System.out.println("icon=" + icon);
0514:                return icon;
0515:            }
0516:
0517:            /**
0518:             *  Does the buffer contain Java source code.
0519:             *
0520:             * @param  view    The frame containing the IDE.
0521:             * @param  buffer  Description of Parameter
0522:             * @return         <code>true</code> if the buffer contains Java source code, <code>false</code> otherwise.
0523:             * @since          v 1.0
0524:             */
0525:            public boolean bufferContainsJavaSource(Frame view, Object buffer) {
0526:                return (buffer == null) ? false : ((Buffer) buffer).getName()
0527:                        .endsWith(".java");
0528:            }
0529:
0530:            /**
0531:             *  Description of the Method
0532:             *
0533:             * @param  message  Description of Parameter
0534:             * @since           v 1.0
0535:             */
0536:            public void handleMessage(EBMessage message) {
0537:                GreyOutMenuFrig.checkMenus();
0538:                if (message instanceof  ViewUpdate
0539:                        || message instanceof  BufferUpdate
0540:                        || message instanceof  EditPaneUpdate) {
0541:                    synchronized (navigators) {
0542:                        for (Iterator i = navigators.iterator(); i.hasNext();) {
0543:                            Navigator nav = (Navigator) i.next();
0544:                            nav.handleMessage(message);
0545:                        }
0546:                    }
0547:                }
0548:
0549:                if (message instanceof  BufferUpdate) {
0550:                    BufferUpdate update = (BufferUpdate) message;
0551:
0552:                    String name = update.getBuffer().getName();
0553:                    if (update.getWhat() == BufferUpdate.SAVING) {
0554:                        if (name.endsWith(".java")) {
0555:                            String project = getProjectName(update.getView(),
0556:                                    update.getBuffer());
0557:                            PropertiesFile props = getProperties("pretty",
0558:                                    project);
0559:                            if (props.getBoolean("formatOnSave", false)) {
0560:                                JavaStyleActions.beautify(update.getView(),
0561:                                        update.getBuffer(), true);
0562:                            } else if (props.getBoolean("checkOnSave", false)) {
0563:                                instanceCheck(update.getView(), update
0564:                                        .getBuffer(), true);
0565:                            } else {
0566:                                JavaStylePlugin.getErrorSource().clear();
0567:                            }
0568:                        } else if (name.endsWith(".jsp")) {
0569:                            String project = getProjectName(update.getView(),
0570:                                    update.getBuffer());
0571:                            PropertiesFile props = getProperties("pretty",
0572:                                    project);
0573:                            if (props.getBoolean("formatOnSave", false)) {
0574:                                JavaStyleActions.beautify(update.getView(),
0575:                                        update.getBuffer(), true);
0576:                            }
0577:                        }
0578:                    }
0579:                }
0580:            }
0581:
0582:            /**
0583:             *  Description of the Method
0584:             *
0585:             * @since    v 1.0
0586:             */
0587:            public void start() {
0588:                if (jEdit.getSettingsDirectory() == null) {
0589:                    // no settings directory. jEdit was invoked with the
0590:                    // 'nosettings' option. The action will not be added,
0591:                    // meaning it will be disabled in the Plugins menu.
0592:                    Log.log(Log.DEBUG, this ,
0593:                            "javastyle action disabled because "
0594:                                    + "settings dir not found!");
0595:                    return;
0596:                }
0597:
0598:                // check whether JavaStyle is invoked for the first time
0599:                boolean firstTime = !PRETTY_SETTINGS_FILE.exists();
0600:
0601:                // point PrettyPrinter to the location of the settings file
0602:                FileSettings.setSettingsRoot(JAVASTYLE_DIR);
0603:                // install the setting files (update new properties if already there)
0604:                (new RefactoryInstaller(false)).run();
0605:
0606:                properties = getProperties("pretty", null);
0607:                try {
0608:                    ideProperties.load(getClass().getResourceAsStream(
0609:                            "/ui/JavaStyle.props"));
0610:                } catch (java.io.IOException e) {
0611:                    e.printStackTrace();
0612:                }
0613:
0614:                // if JavaStyle is invoked for the first time, we need to
0615:                // correct some default values:
0616:                if (firstTime) {
0617:                    setDefaultValues();
0618:                }
0619:
0620:                org.acm.seguin.ide.common.IDEPlugin.setPlugin(this );
0621:                //JavaParser.setTargetJDK("1.4.0");
0622:
0623:                jsPlugin = this ;
0624:
0625:                errorSource = new DefaultErrorSource(NAME);
0626:                ErrorSource.registerErrorSource(errorSource);
0627:
0628:                // print some version info
0629:                String jversion = new JRefactoryVersion().toString();
0630:                String fversion = properties.getString("version");
0631:
0632:                Log.log(Log.NOTICE, this , "JRefactory version: " + jversion);
0633:                Log.log(Log.NOTICE, this , "pretty settings file version: "
0634:                        + fversion);
0635:                GreyOutMenuFrig.checkMenus();
0636:            }
0637:
0638:            /**
0639:             *  Description of the Method
0640:             *
0641:             * @param  parent  Description of Parameter
0642:             * @since          v 1.0
0643:             */
0644:            public void showWaitCursor(java.awt.Frame parent) {
0645:                ((View) parent).showWaitCursor();
0646:            }
0647:
0648:            /**
0649:             *  Description of the Method
0650:             *
0651:             * @param  parent  Description of Parameter
0652:             * @since          v 1.0
0653:             */
0654:            public void hideWaitCursor(java.awt.Frame parent) {
0655:                ((View) parent).hideWaitCursor();
0656:            }
0657:
0658:            /**
0659:             *  Description of the Method
0660:             *
0661:             * @param  urgency  Description of Parameter
0662:             * @param  source   Description of Parameter
0663:             * @param  message  Description of Parameter
0664:             * @since           v 1.0
0665:             */
0666:            public void log(int urgency, Object source, Object message) {
0667:                Log.log(urgency, source, message);
0668:            }
0669:
0670:            /**
0671:             *  check current buffer
0672:             *
0673:             * @param  view    Description of Parameter
0674:             * @param  buffer  Description of Parameter
0675:             * @param  silent  Description of Parameter
0676:             * @since          v 1.0
0677:             */
0678:            public void instanceCheck(View view, Buffer buffer, boolean silent) {
0679:                errorSource.clear();
0680:                String name = buffer.getName();
0681:                //System.out.println("buffer.getName()=" + name);
0682:                if (name != null && name.endsWith(".java")) {
0683:                    JRefactory refactory = (JRefactory) view
0684:                            .getDockableWindowManager().getDockableWindow(
0685:                                    "javastyle");
0686:                    RuleContext ctx = null;
0687:                    if (refactory == null) {
0688:                        ctx = checkBuffer(view, buffer);
0689:                    } else {
0690:                        CodingStandardsViewer csViewer = refactory
0691:                                .getCodingStandardsViewer();
0692:                        ctx = csViewer.check(view, buffer, true);
0693:                    }
0694:                    if (!silent && ctx.getReport().isEmpty()) {
0695:                        JOptionPane.showMessageDialog(jEdit.getFirstView(),
0696:                                "No problems found", NAME,
0697:                                JOptionPane.INFORMATION_MESSAGE);
0698:                    } else {
0699:                        String path = buffer.getPath();
0700:                        for (Iterator i = ctx.getReport().iterator(); i
0701:                                .hasNext();) {
0702:                            RuleViolation ruleViolation = (RuleViolation) i
0703:                                    .next();
0704:                            errorSource.addError(ErrorSource.WARNING, path,
0705:                                    ruleViolation.getLine() - 1, 0, 0,
0706:                                    ruleViolation.getDescription());
0707:                        }
0708:                    }
0709:                }
0710:            }
0711:
0712:            /**
0713:             *  Description of the Method
0714:             *
0715:             * @param  view       Description of Parameter
0716:             * @param  recursive  Description of Parameter
0717:             * @since             v 1.0
0718:             */
0719:            public void instanceCheckDirectory(View view, boolean recursive) {
0720:                process(getFileList(view, recursive), view);
0721:            }
0722:
0723:            /**
0724:             *  check all open buffers
0725:             *
0726:             * @param  view  Description of Parameter
0727:             * @since        v 1.0
0728:             * @paramview    Description of Parameter
0729:             * @paramview    Description of Parameter
0730:             */
0731:            public void instanceCheckAllOpenBuffers(View view) {
0732:                // I'm putting the files in a Set to work around some
0733:                // odd behavior in jEdit - the buffer.getNext()
0734:                // seems to iterate over the files twice.
0735:                Set fileSet = new HashSet();
0736:                Buffer buffer = jEdit.getFirstBuffer();
0737:
0738:                while (buffer != null) {
0739:                    if (buffer.getName().endsWith(".java")) {
0740:                        fileSet.add(buffer.getFile());
0741:                    }
0742:                    buffer = buffer.getNext();
0743:                }
0744:
0745:                List files = new ArrayList();
0746:
0747:                files.addAll(fileSet);
0748:                process(files, view);
0749:            }
0750:
0751:            /**
0752:             *  clear error list
0753:             *
0754:             * @since    v 1.0
0755:             */
0756:            public void instanceClearErrorList() {
0757:                errorSource.clear();
0758:            }
0759:
0760:            /**
0761:             *  Description of the Method
0762:             *
0763:             * @param  view   Description of Parameter
0764:             * @param  entry  Description of Parameter
0765:             * @since         v 1.0
0766:             */
0767:            public void checkFile(View view, VFS.DirectoryEntry entry[]) {
0768:                if (view != null && entry != null) {
0769:                    List files = new ArrayList();
0770:
0771:                    for (int i = 0; i < entry.length; i++) {
0772:                        if (entry[i].type == VFS.DirectoryEntry.FILE) {
0773:                            files.add(new File(entry[i].path));
0774:                        }
0775:                    }
0776:
0777:                    //System.out.println("See final files to process " + files);
0778:                }
0779:            }
0780:
0781:            /**
0782:             *  Description of the Method
0783:             *
0784:             * @param  view             Description of Parameter
0785:             * @param  buffer           Description of Parameter
0786:             * @exception  IOException  Description of Exception
0787:             * @since                   v 1.0
0788:             */
0789:            public void cpdBuffer(Frame view, Object buffer) throws IOException {
0790:                JavaStylePlugin.cpdCurrentFile((View) view);
0791:            }
0792:
0793:            /**
0794:             *  Description of the Method
0795:             *
0796:             * @param  view             Description of Parameter
0797:             * @exception  IOException  Description of Exception
0798:             * @since                   v 1.0
0799:             */
0800:            public void cpdAllOpenBuffers(Frame view) throws IOException {
0801:                JavaStylePlugin.cpdAllOpenBuffers((View) view, true);
0802:            }
0803:
0804:            /**
0805:             *  Description of the Method
0806:             *
0807:             * @param  view             Description of Parameter
0808:             * @param  recursive        Description of Parameter
0809:             * @exception  IOException  Description of Exception
0810:             * @since                   v 1.0
0811:             */
0812:            public void cpdDir(Frame view, boolean recursive)
0813:                    throws IOException {
0814:                JavaStylePlugin.cpdDir((View) view, recursive);
0815:            }
0816:
0817:            /**
0818:             *  Description of the Method
0819:             *
0820:             * @param  view             Description of Parameter
0821:             * @param  fileName         Description of Parameter
0822:             * @return                  Description of the Returned Value
0823:             * @exception  IOException  Description of Exception
0824:             * @since                   v 1.0
0825:             */
0826:            public Object openFile(Frame view, String fileName)
0827:                    throws IOException {
0828:                if (fileName == null || fileName.equals("")) {
0829:                    fileName = ((View) view).getBuffer().getPath();
0830:                }
0831:                return jEdit.openFile((View) view, fileName);
0832:            }
0833:
0834:            /**
0835:             *  Description of the Method
0836:             *
0837:             * @param  view    Description of Parameter
0838:             * @param  buffer  Description of Parameter
0839:             * @param  start   Description of Parameter
0840:             * @since          v 1.0
0841:             */
0842:            public void moveCaretPosition(Frame view, Object buffer, int start) {
0843:                ((View) view).getTextArea().moveCaretPosition(start);
0844:            }
0845:
0846:            /**
0847:             *  Description of the Method
0848:             *
0849:             * @param  runnable  Description of Parameter
0850:             * @since            v 1.0
0851:             */
0852:            public void runInAWTThread(Runnable runnable) {
0853:                VFSManager.runInAWTThread(runnable);
0854:            }
0855:
0856:            /**
0857:             *  Description of the Method
0858:             *
0859:             * @param  view    Description of Parameter
0860:             * @param  buffer  Description of Parameter
0861:             * @since          v 1.0
0862:             */
0863:            public void checkBuffer(Frame view, Object buffer) {
0864:                //org.acm.seguin.ide.jedit.JavaStyleActions.check((View)view, ((View)view).getBuffer());
0865:                instanceCheck((View) view, ((View) view).getBuffer(), false);
0866:            }
0867:
0868:            /**
0869:             *  Description of the Method
0870:             *
0871:             * @param  view    Description of Parameter
0872:             * @param  buffer  Description of Parameter
0873:             * @since          v 1.0
0874:             */
0875:            public void check(View view, Buffer buffer) {
0876:                //org.acm.seguin.ide.jedit.JavaStyleActions.check((View) view, ((View) view).getBuffer());
0877:                instanceCheck(view, buffer, false);
0878:            }
0879:
0880:            /**
0881:             *  Description of the Method
0882:             *
0883:             * @param  view  Description of Parameter
0884:             * @since        v 1.0
0885:             */
0886:            public void checkAllOpenBuffers(Frame view) {
0887:                //org.acm.seguin.ide.jedit.JavaStyleActions.checkAllOpenBuffers((View)view);
0888:                instanceCheckAllOpenBuffers((View) view);
0889:            }
0890:
0891:            /**
0892:             *  Description of the Method
0893:             *
0894:             * @param  view       Description of Parameter
0895:             * @param  recursive  Description of Parameter
0896:             * @since             v 1.0
0897:             */
0898:            public void checkDirectory(Frame view, boolean recursive) {
0899:                //org.acm.seguin.ide.jedit.JavaStyleActions.checkDirectory((View)view);
0900:                instanceCheckDirectory((View) view, recursive);
0901:            }
0902:
0903:            /**
0904:             * @param  view      the view; may be null, if there is no current view
0905:             * @param  buffer    the buffer containing the java source code
0906:             * @param  silently  if true, no error dialogs are shown
0907:             * @since            v 1.0
0908:             */
0909:            public void instanceBeautify(View view, Buffer buffer,
0910:                    boolean silently) {
0911:                try {
0912:                    // does the current buffer contains Java source code?
0913:                    String bufferFilename = buffer.getName().toLowerCase();
0914:                    String bufferMode = buffer.getMode().getName();
0915:                    if (bufferFilename.endsWith(".jsp")
0916:                            || bufferMode.equals("jsp")) {
0917:                        setUpForBeautify(view, buffer, silently);
0918:                        // run the format routine synchronously on the AWT thread:
0919:                        VFSManager.runInAWTThread(new JEditJSPPrettyPrinter(
0920:                                JavaStylePlugin.jsPlugin, view, buffer));
0921:                    } else if (bufferFilename.endsWith(".java")
0922:                            || bufferMode.equals("java")) {
0923:                        setUpForBeautify(view, buffer, silently);
0924:                        // run the format routine synchronously on the AWT thread:
0925:                        VFSManager.runInAWTThread(new JEditPrettyPrinter(
0926:                                JavaStylePlugin.jsPlugin, view, buffer));
0927:                    } else {
0928:                        if (!silently) {
0929:                            GUIUtilities.error(view,
0930:                                    "javastyle.error.noJavaBuffer", null);
0931:                        }
0932:                        return;
0933:                    }
0934:                } catch (Throwable e) {
0935:                    e.printStackTrace();
0936:                }
0937:            }
0938:
0939:            /**
0940:             *  Description of the Method
0941:             *
0942:             * @param  view    Description of Parameter
0943:             * @param  buffer  Description of Parameter
0944:             * @since          v 1.0
0945:             */
0946:            public void goToBuffer(Frame view, Object buffer) {
0947:                ((View) view).goToBuffer((Buffer) buffer);
0948:            }
0949:
0950:            /**
0951:             *  write new settings
0952:             *
0953:             * @since    v 1.0
0954:             */
0955:            public void saveProperties() {
0956:                try {
0957:                    jEdit.propertiesChanged();
0958:                    jEdit.saveSettings();
0959:                    properties.save(PRETTY_SETTINGS_FILE);
0960:                } catch (IOException ioex) {
0961:                    Log.log(Log.ERROR, JavaStylePlugin.class,
0962:                            "Error saving file " + PRETTY_SETTINGS_FILE + ": "
0963:                                    + ioex);
0964:                }
0965:
0966:                for (Iterator i = propertiesMap.keySet().iterator(); i
0967:                        .hasNext();) {
0968:                    PropertiesFile projectProperties = (PropertiesFile) propertiesMap
0969:                            .get(i.next());
0970:                    projectProperties.save();
0971:                }
0972:            }
0973:
0974:            /**
0975:             * @param  view      Description of the Parameter
0976:             * @param  fileName  Description of Parameter
0977:             * @since            v 2.9.12
0978:             */
0979:            public void loadUML(View view, String fileName) {
0980:                JRefactory viewer = JRefactory.getViewer(view);
0981:                (new LoadPackageAction(fileName))
0982:                        .actionPerformed(new ActionEvent(viewer, -1, "load"));
0983:            }
0984:
0985:            /**
0986:             * @param  view      Description of the Parameter
0987:             * @param  fileName  Description of Parameter
0988:             * @since            v 2.9.12
0989:             */
0990:            public void openUML(View view, String fileName) {
0991:                try {
0992:                    Buffer buffer = null;
0993:                    if (fileName != null) {
0994:                        buffer = (Buffer) openFile(view, fileName);
0995:                    }
0996:                    if (buffer == null) {
0997:                        buffer = view.getBuffer();
0998:                    }
0999:                    if (buffer != null && buffer.getPath().endsWith(".java")) {
1000:                        JRefactory viewer = JRefactory.getViewer(view);
1001:                        (new LoadPackageAction(buffer.getPath()))
1002:                                .actionPerformed(new ActionEvent(viewer, -1,
1003:                                        "load"));
1004:                    }
1005:                } catch (IOException e) {
1006:                }
1007:            }
1008:
1009:            /**
1010:             * @param  view    Description of the Parameter
1011:             * @param  buffer  Description of Parameter
1012:             * @since          v 1.0
1013:             */
1014:            public void renameClass(View view, Buffer buffer) {
1015:                System.out.println("JavaStylePlugin.renameClass(view," + buffer
1016:                        + ")");
1017:                System.out.flush();
1018:                RenameClassAction renameClassAction = new RenameClassAction(
1019:                        new JEditSelectedFileSet(view, buffer));
1020:                renameClassAction
1021:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1022:                                -1, "renameClass"));
1023:                System.out.println("JavaStylePlugin.renameClass(view," + buffer
1024:                        + ") - end");
1025:                System.out.flush();
1026:            }
1027:
1028:            /**
1029:             * @param  view    Description of the Parameter
1030:             * @param  buffer  Description of Parameter
1031:             * @since          v 1.0
1032:             */
1033:            public void moveClassTo(View view, Buffer buffer) {
1034:                System.out.println("JavaStylePlugin.moveClassTo(view," + buffer
1035:                        + ")");
1036:                MoveClassAction moveClassAction = new MoveClassAction(
1037:                        new JEditSelectedFileSet(view, buffer));
1038:                moveClassAction.actionPerformed(new java.awt.event.ActionEvent(
1039:                        buffer, -1, "moveClass"));
1040:            }
1041:
1042:            /**
1043:             * @param  view    Description of the Parameter
1044:             * @param  buffer  The feature to be added to the abstractParentClass attribute
1045:             * @since          v 1.0
1046:             */
1047:            public void addAbstractParentClass(View view, Buffer buffer) {
1048:                System.out
1049:                        .println("JavaStylePlugin.addAbstractParentClass(view,"
1050:                                + buffer + ")");
1051:                AddParentClassAction addAbstractParentClassAction = new AddParentClassAction(
1052:                        new JEditSelectedFileSet(view, buffer));
1053:                addAbstractParentClassAction
1054:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1055:                                -1, "addAbstractParentClass"));
1056:            }
1057:
1058:            /**
1059:             * @param  view    Description of the Parameter
1060:             * @param  buffer  Description of Parameter
1061:             * @since          v 1.0
1062:             */
1063:            public void removeClass(View view, Buffer buffer) {
1064:                System.out.println("JavaStylePlugin.removeClass(view," + buffer
1065:                        + ")");
1066:                RemoveClassAction removeClassAction = new RemoveClassAction(
1067:                        new JEditSelectedFileSet(view, buffer));
1068:                removeClassAction
1069:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1070:                                -1, "removeClass"));
1071:            }
1072:
1073:            /**
1074:             * @param  view    Description of the Parameter
1075:             * @param  buffer  The feature to be added to the childClass attribute
1076:             * @since          v 1.0
1077:             */
1078:            public void addChildClass(View view, Buffer buffer) {
1079:                System.out.println("JavaStylePlugin.addChildClass(view,"
1080:                        + buffer + ")");
1081:                AddChildClassAction addChildClassAction = new AddChildClassAction(
1082:                        new JEditSelectedFileSet(view, buffer));
1083:                addChildClassAction
1084:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1085:                                -1, "addChildClass"));
1086:            }
1087:
1088:            /**
1089:             * @param  view    Description of the Parameter
1090:             * @param  buffer  Description of Parameter
1091:             * @since          v 1.0
1092:             */
1093:            public void extractInterface(View view, Buffer buffer) {
1094:                System.out.println("JavaStylePlugin.extractInterface(view,"
1095:                        + buffer + ")");
1096:                ExtractInterfaceAction extractInterfaceAction = new ExtractInterfaceAction(
1097:                        new JEditSelectedFileSet(view, buffer));
1098:                extractInterfaceAction
1099:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1100:                                -1, "extractInterface"));
1101:            }
1102:
1103:            /**
1104:             * @param  view    Description of the Parameter
1105:             * @param  buffer  Description of Parameter
1106:             * @since          v 1.0
1107:             */
1108:            public void renameVariablesUsingHungarian(View view, Buffer buffer) {
1109:                System.out
1110:                        .println("JavaStylePlugin.renameVariablesUsingHungarian(view,"
1111:                                + buffer + ")");
1112:            }
1113:
1114:            /**
1115:             * @param  view    Description of the Parameter
1116:             * @param  buffer  Description of Parameter
1117:             * @since          v 1.0
1118:             */
1119:            public void pushUpMethod(View view, Buffer buffer) {
1120:                System.out.println("JavaStylePlugin.pushUpMethod(view,"
1121:                        + buffer + ")");
1122:                PushUpMethodAction pushUpMethodAction = new PushUpMethodAction();
1123:                pushUpMethodAction
1124:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1125:                                -1, "pushUpMethod"));
1126:            }
1127:
1128:            /**
1129:             * @param  view    Description of the Parameter
1130:             * @param  buffer  Description of Parameter
1131:             * @since          v 1.0
1132:             */
1133:            public void pushUpAbstractMethod(View view, Buffer buffer) {
1134:                System.out.println("JavaStylePlugin.pushUpAbstractMethod(view,"
1135:                        + buffer + ")");
1136:                PushUpAbstractMethodAction pushUpAbstractMethodAction = new PushUpAbstractMethodAction();
1137:                pushUpAbstractMethodAction
1138:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1139:                                -1, "pushUpAbstractMethod"));
1140:            }
1141:
1142:            /**
1143:             * @param  view    Description of the Parameter
1144:             * @param  buffer  Description of Parameter
1145:             * @since          v 1.0
1146:             */
1147:            public void renameMethod(View view, Buffer buffer) {
1148:                System.out.println("JavaStylePlugin.renameMethod(view,"
1149:                        + buffer + ")");
1150:                RenameMethodAction renameMethodAction = new RenameMethodAction();
1151:                renameMethodAction
1152:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1153:                                -1, "renameMethod"));
1154:            }
1155:
1156:            /**
1157:             * @param  view    Description of the Parameter
1158:             * @param  buffer  Description of Parameter
1159:             * @since          v 1.0
1160:             */
1161:            public void pushDownMethod(View view, Buffer buffer) {
1162:                System.out.println("JavaStylePlugin.pushDownMethod(view,"
1163:                        + buffer + ")");
1164:                PushDownMethodAction pushDownMethodAction = new PushDownMethodAction();
1165:                pushDownMethodAction
1166:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1167:                                -1, "pushDownMethod"));
1168:            }
1169:
1170:            /**
1171:             * @param  view    Description of the Parameter
1172:             * @param  buffer  Description of Parameter
1173:             * @since          v 1.0
1174:             */
1175:            public void moveMethod(View view, Buffer buffer) {
1176:                System.out.println("JavaStylePlugin.moveMethod(view," + buffer
1177:                        + ")");
1178:                MoveMethodAction moveMethodAction = new MoveMethodAction();
1179:                moveMethodAction
1180:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1181:                                -1, "moveMethod"));
1182:            }
1183:
1184:            /**
1185:             * @param  view    Description of the Parameter
1186:             * @param  buffer  Description of Parameter
1187:             * @since          v 1.0
1188:             */
1189:            public void renameMethodParameters(View view, Buffer buffer) {
1190:                System.out
1191:                        .println("JavaStylePlugin.renameMethodParameters(view,"
1192:                                + buffer + ")");
1193:                RenameParameterAction renameMethodParametersAction = new RenameParameterAction();
1194:                renameMethodParametersAction
1195:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1196:                                -1, "renameMethodParametersAction"));
1197:            }
1198:
1199:            /**
1200:             * @param  view    Description of the Parameter
1201:             * @param  buffer  Description of Parameter
1202:             * @since          v 1.0
1203:             */
1204:            public void renameField(View view, Buffer buffer) {
1205:                System.out.println("JavaStylePlugin.renameField(view," + buffer
1206:                        + ")");
1207:                RenameFieldAction renameFieldAction = new RenameFieldAction();
1208:                renameFieldAction
1209:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1210:                                -1, "renameField"));
1211:            }
1212:
1213:            /**
1214:             * @param  view    Description of the Parameter
1215:             * @param  buffer  Description of Parameter
1216:             * @since          v 1.0
1217:             */
1218:            public void pushUpField(View view, Buffer buffer) {
1219:                System.out.println("JavaStylePlugin.pushUpField(view," + buffer
1220:                        + ")");
1221:                PushUpFieldAction pushUpFieldAction = new PushUpFieldAction();
1222:                pushUpFieldAction
1223:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1224:                                -1, "pushUpField"));
1225:            }
1226:
1227:            /**
1228:             * @param  view    Description of the Parameter
1229:             * @param  buffer  Description of Parameter
1230:             * @since          v 1.0
1231:             */
1232:            public void pushDownField(View view, Buffer buffer) {
1233:                System.out.println("JavaStylePlugin.pushDownField(view,"
1234:                        + buffer + ")");
1235:                PushDownFieldAction pushDownFieldAction = new PushDownFieldAction();
1236:                pushDownFieldAction
1237:                        .actionPerformed(new java.awt.event.ActionEvent(buffer,
1238:                                -1, "pushDownField"));
1239:            }
1240:
1241:            /**
1242:             *  Sets the upForBeautify attribute of the JavaStylePlugin object
1243:             *
1244:             * @param  view      The new upForBeautify value
1245:             * @param  buffer    The new upForBeautify value
1246:             * @param  silently  The new upForBeautify value
1247:             * @since            v 1.0
1248:             */
1249:            private void setUpForBeautify(View view, Buffer buffer,
1250:                    boolean silently) {
1251:                int charStreamType = net.sourceforge.jrefactory.io.CharStream.UNICODE;
1252:                try {
1253:                    FileSettings bundle = FileSettings
1254:                            .getRefactoryPrettySettings();
1255:                    charStreamType = bundle.getInteger("char.stream.type");
1256:                    JavaParser.setTargetJDK(bundle.getString("jdk"));
1257:                } catch (Exception e) {
1258:                    JavaParser.setTargetJDK("1.4.2");
1259:                }
1260:                net.sourceforge.jrefactory.io.CharStream
1261:                        .setCharStreamType(charStreamType);
1262:                // is the current buffer editable?
1263:                if (buffer.isReadOnly()) {
1264:                    Log.log(Log.DEBUG, JavaStylePlugin.class,
1265:                            "the buffer is read-only: " + buffer);
1266:                    if (!silently) {
1267:                        GUIUtilities.error(view,
1268:                                "javastyle.error.isNotEditable", null);
1269:                    }
1270:                    return;
1271:                }
1272:            }
1273:
1274:            /**
1275:             *  Sets the DefaultValues attribute of the JavaStylePlugin object
1276:             *
1277:             * @since    v 1.0
1278:             */
1279:            private void setDefaultValues() {
1280:                // these default settings need to be corrected:
1281:                setProperty("end.line", "NL");
1282:                // jEdit requires this
1283:                setProperty("space.before.javadoc", "true");
1284:                // default (false) looks odd
1285:
1286:            }
1287:
1288:            /**
1289:             *  Gets the FileList attribute of the JavaStylePlugin object
1290:             *
1291:             * @param  view       Description of Parameter
1292:             * @param  recursive  Description of Parameter
1293:             * @return            The FileList value
1294:             * @since             v 1.0
1295:             */
1296:            private List getFileList(View view, boolean recursive) {
1297:                try {
1298:                    String file = getBrowserDirectory(view);
1299:                    if (file != null) {
1300:                        jEdit.setProperty("pmd.cpd.lastDirectory", file);
1301:                        return findFiles(file, recursive);
1302:                    } else {
1303:                        JFileChooser chooser = new JFileChooser(jEdit
1304:                                .getProperty("pmd.cpd.lastDirectory"));
1305:                        chooser
1306:                                .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1307:
1308:                        if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) {
1309:                            File dir = chooser.getSelectedFile();
1310:                            if (dir != null) {
1311:                                if (!dir.exists() || !dir.isDirectory()) {
1312:                                    JOptionPane.showMessageDialog(jEdit
1313:                                            .getFirstView(), dir
1314:                                            + " is not a valid directory name",
1315:                                            NAME, JOptionPane.ERROR_MESSAGE);
1316:                                    return new ArrayList();
1317:                                }
1318:                                jEdit.setProperty("pmd.cpd.lastDirectory", dir
1319:                                        .getCanonicalPath());
1320:                                return findFiles(dir.getCanonicalPath(),
1321:                                        recursive);
1322:                            }
1323:                        } else {
1324:                            return new ArrayList();
1325:                        }
1326:                    }
1327:                } catch (java.io.IOException e) {
1328:                    e.printStackTrace();
1329:                }
1330:                return new ArrayList();
1331:            }
1332:
1333:            /**
1334:             *  Description of the Method
1335:             *
1336:             * @param  view    Description of Parameter
1337:             * @param  buffer  Description of Parameter
1338:             * @return         Description of the Returned Value
1339:             * @since          v 1.0
1340:             */
1341:            private RuleContext checkBuffer(View view, Buffer buffer) {
1342:                //System.out.println("checkBuffer(view, " + buffer + ")");
1343:                RuleContext ctx = new RuleContext();
1344:                ctx.setReport(new Report());
1345:                ctx.setSourceCodeFilename("");
1346:
1347:                try {
1348:                    PMD pmd = new PMD();
1349:                    SelectedRules selectedRuleSets = new SelectedRules(
1350:                            getProjectName(view, buffer), view);
1351:                    pmd.processFile(new java.io.StringReader(getText(view,
1352:                            buffer)), selectedRuleSets.getSelectedRules(), ctx);
1353:                } catch (RuleSetNotFoundException rsne) {
1354:                    rsne.printStackTrace();
1355:                } catch (PMDException pmde) {
1356:                    pmde.printStackTrace();
1357:                    JOptionPane.showMessageDialog(view,
1358:                            "Error while processing " + "<no path>");
1359:                }
1360:                return ctx;
1361:            }
1362:
1363:            /**
1364:             *  Description of the Method
1365:             *
1366:             * @param  files  Description of Parameter
1367:             * @param  view   Description of Parameter
1368:             * @since         v 1.0
1369:             */
1370:            private void process(final List files, final View view) {
1371:                new Thread(new Runnable() {
1372:                    public void run() {
1373:                        processFiles(files, view);
1374:                    }
1375:                }).start();
1376:            }
1377:
1378:            /**
1379:             *  Description of the Method
1380:             *
1381:             * @param  dir      Description of Parameter
1382:             * @param  recurse  Description of Parameter
1383:             * @return          Description of the Returned Value
1384:             * @since           v 1.0
1385:             */
1386:            private List findFiles(String dir, boolean recurse) {
1387:                FileFinder finder = new FileFinder();
1388:                return finder.findFilesFrom(dir,
1389:                        new JavaLanguage.JavaFileOrDirectoryFilter(), recurse);
1390:            }
1391:
1392:            /**
1393:             *  Description of the Method
1394:             *
1395:             * @param  files  Description of Parameter
1396:             * @param  view   Description of Parameter
1397:             * @since         v 1.0
1398:             */
1399:            private void processFiles(List files, View view) {
1400:                errorSource.clear();
1401:                JRefactory refactory = (JRefactory) view
1402:                        .getDockableWindowManager().getDockableWindow(
1403:                                "javastyle");
1404:                CodingStandardsViewer csViewer = refactory
1405:                        .getCodingStandardsViewer();
1406:                boolean foundProblems = false;
1407:                List contexts = csViewer.checkFiles(files, view, view
1408:                        .getBuffer());
1409:                for (Iterator i = contexts.iterator(); i.hasNext();) {
1410:                    RuleContext ctx = (RuleContext) i.next();
1411:                    for (Iterator j = ctx.getReport().iterator(); j.hasNext();) {
1412:                        foundProblems = true;
1413:                        RuleViolation ruleViolation = (RuleViolation) j.next();
1414:                        errorSource.addError(ErrorSource.WARNING, ctx
1415:                                .getSourceCodeFilename(), ruleViolation
1416:                                .getLine() - 1, 0, 0, ruleViolation
1417:                                .getDescription());
1418:                    }
1419:                }
1420:                if (!foundProblems) {
1421:                    JOptionPane.showMessageDialog(jEdit.getFirstView(),
1422:                            "No problems found", NAME,
1423:                            JOptionPane.INFORMATION_MESSAGE);
1424:                    errorSource.clear();
1425:                }
1426:            }
1427:
1428:            /**
1429:             *  Description of the Method
1430:             *
1431:             * @param  cpd   Description of Parameter
1432:             * @param  view  Description of Parameter
1433:             * @since        v 1.0
1434:             */
1435:            private void processDuplicates(CPD cpd, View view) {
1436:                CPDDuplicateCodeViewer cpdViewer = getCPDDuplicateCodeViewer(view);
1437:                if (cpdViewer != null) {
1438:                    cpdViewer.processDuplicates(cpd, view);
1439:                }
1440:                /*
1441:                cpdViewer.clearDuplicates();
1442:                for (Iterator i = cpd.getMatches(); i.hasNext(); ) {
1443:                   Match match = (Match)i.next();
1444:                   CPDDuplicateCodeViewer.Duplicates duplicates = cpdViewer.new Duplicates(match.getLineCount() + " duplicate lines", match.getSourceCodeSlice());
1445:                   for (Iterator occurrences = match.iterator(); occurrences.hasNext(); ) {
1446:                      Mark mark = (Mark)occurrences.next();
1447:                      int lastLine = mark.getBeginLine() + match.getLineCount();
1448:                      CPDDuplicateCodeViewer.Duplicate duplicate = cpdViewer.new Duplicate(mark.getTokenSrcID(), mark.getBeginLine(), lastLine);
1449:                      duplicates.addDuplicate(duplicate);
1450:                   }
1451:                   cpdViewer.addDuplicates(duplicates);
1452:                }
1453:                cpdViewer.refreshTree();
1454:                cpdViewer.expandAll();
1455:                 */
1456:            }
1457:
1458:            /**
1459:             *  Sets the Property attribute of the JavaStylePlugin class
1460:             *
1461:             * @param  key    The new Property value
1462:             * @param  value  The new Property value
1463:             * @since         v 1.0
1464:             */
1465:            public static void setProperty(String key, String value) {
1466:                properties.setString(key, value);
1467:            }
1468:
1469:            /**
1470:             *  Gets the ErrorSource attribute of the JavaStylePlugin class
1471:             *
1472:             * @return    The ErrorSource value
1473:             * @since     v 1.0
1474:             */
1475:            public static DefaultErrorSource getErrorSource() {
1476:                return errorSource;
1477:            }
1478:
1479:            /**
1480:             *  Sets the projectData attribute of the JEditPrettyPrinter object
1481:             *
1482:             * @param  view    Description of Parameter
1483:             * @param  buffer  Description of Parameter
1484:             * @return         The projectName value
1485:             * @since          v 1.0
1486:             */
1487:            public static String getProjectName(View view, Buffer buffer) {
1488:                try {
1489:                    String path = buffer.getPath();
1490:                    Class clazz = Class.forName("projectviewer.ProjectViewer");
1491:                    //projectviewer.ProjectViewer viewer = projectviewer.ProjectViewer.getViewer(view);
1492:                    projectviewer.ProjectManager manager = projectviewer.ProjectManager
1493:                            .getInstance();
1494:
1495:                    for (Iterator i = manager.getProjects(); i.hasNext();) {
1496:                        projectviewer.vpt.VPTProject proj = (projectviewer.vpt.VPTProject) i
1497:                                .next();
1498:                        if (proj.isProjectFile(path)) {
1499:                            return proj.getName();
1500:                        }
1501:                    }
1502:                } catch (ClassNotFoundException e) {
1503:                }
1504:                return "";
1505:            }
1506:
1507:            /**
1508:             *  Adds a feature to the navigator attribute of the JavaStylePlugin class
1509:             *
1510:             * @param  nav  The feature to be added to the navigator attribute
1511:             * @since       v 1.0
1512:             */
1513:            public static void addNavigator(Navigator nav) {
1514:                synchronized (navigators) {
1515:                    navigators.add(nav);
1516:                }
1517:            }
1518:
1519:            /**
1520:             *  Description of the Method
1521:             *
1522:             * @param  nav  Description of Parameter
1523:             * @since       v 1.0
1524:             */
1525:            public static void removeNavigator(Navigator nav) {
1526:                synchronized (navigators) {
1527:                    navigators.remove(nav);
1528:                }
1529:            }
1530:
1531:            /**
1532:             *  Description of the Method
1533:             *
1534:             * @param  key  Description of Parameter
1535:             * @since       v 1.0
1536:             */
1537:            public static void deleteProperty(String key) {
1538:                properties.deleteKey(key);
1539:            }
1540:
1541:            /**
1542:             *  Description of the Method
1543:             *
1544:             * @since    v 1.0
1545:             */
1546:            public static void initJSPlugin() {
1547:                if (jsPlugin == null) {
1548:                    jsPlugin = new JavaStylePlugin();
1549:                    jsPlugin.start();
1550:                }
1551:            }
1552:
1553:            /**
1554:             *  Description of the Method
1555:             *
1556:             * @param  view             Description of Parameter
1557:             * @exception  IOException  Description of Exception
1558:             * @since                   v 1.0
1559:             */
1560:            public static void cpdCurrentFile(View view) throws IOException {
1561:                initJSPlugin();
1562:                jsPlugin.errorSource.clear();
1563:
1564:                CPD cpd = null;
1565:                String modeName = view.getBuffer().getMode().getName();
1566:
1567:                if (modeName.equals("java")) {
1568:                    cpd = new CPD(jEdit.getIntegerProperty(
1569:                            DEFAULT_TILE_MINSIZE_PROPERTY, 100),
1570:                            new JavaLanguage());
1571:                } else if (modeName.equals("php")) {
1572:                    cpd = new CPD(jEdit.getIntegerProperty(
1573:                            DEFAULT_TILE_MINSIZE_PROPERTY, 100),
1574:                            new PHPLanguage());
1575:                } else if (modeName.equals("c") || modeName.equals("c++")) {
1576:                    cpd = new CPD(jEdit.getIntegerProperty(
1577:                            DEFAULT_TILE_MINSIZE_PROPERTY, 100),
1578:                            new CPPLanguage());
1579:                } else {
1580:                    JOptionPane
1581:                            .showMessageDialog(
1582:                                    view,
1583:                                    "Copy/Paste detection can only be performed on Java,C/C++,PHP code.",
1584:                                    "Copy/Paste Detector",
1585:                                    JOptionPane.INFORMATION_MESSAGE);
1586:                    return;
1587:                }
1588:
1589:                cpd.add(new File(view.getBuffer().getPath()));
1590:                cpd.go();
1591:                jsPlugin.processDuplicates(cpd, view);
1592:            }
1593:
1594:            /**
1595:             *  Description of the Method
1596:             *
1597:             * @param  view             Description of Parameter
1598:             * @param  all              Description of Parameter
1599:             * @exception  IOException  Description of Exception
1600:             * @since                   v 1.0
1601:             */
1602:            public static void cpdAllOpenBuffers(View view, boolean all)
1603:                    throws IOException {
1604:                initJSPlugin();
1605:                jsPlugin.errorSource.clear();
1606:
1607:                boolean found = false;
1608:                CPD cpd = cpd = new CPD(jEdit.getIntegerProperty(
1609:                        DEFAULT_TILE_MINSIZE_PROPERTY, 100), new JavaLanguage());
1610:
1611:                Buffer buffer = jEdit.getFirstBuffer();
1612:
1613:                while (buffer != null) {
1614:                    String modeName = buffer.getMode().getName();
1615:
1616:                    if (modeName.equals("java")) {
1617:                        cpd.add(new File(buffer.getPath()));
1618:                        found = true;
1619:                    }
1620:
1621:                    buffer = buffer.getNext();
1622:                }
1623:                if (found) {
1624:                    cpd.go();
1625:                    jsPlugin.processDuplicates(cpd, view);
1626:                }
1627:            }
1628:
1629:            /**
1630:             *  Description of the Method
1631:             *
1632:             * @param  view             Description of Parameter
1633:             * @param  recursive        Description of Parameter
1634:             * @exception  IOException  Description of Exception
1635:             * @since                   v 1.0
1636:             */
1637:            public static void cpdDir(View view, boolean recursive)
1638:                    throws IOException {
1639:                String file = getBrowserDirectory(view);
1640:                JFileChooser chooser = new JFileChooser((file == null) ? jEdit
1641:                        .getProperty("pmd.cpd.lastDirectory") : file);
1642:
1643:                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1644:
1645:                JPanel pnlAccessory = new JPanel();
1646:
1647:                pnlAccessory.add(new JLabel("Minimum Tile size :"));
1648:
1649:                JTextField txttilesize = new JTextField("100");
1650:
1651:                pnlAccessory.add(txttilesize);
1652:                chooser.setAccessory(pnlAccessory);
1653:
1654:                int returnVal = chooser.showOpenDialog(view);
1655:                File selectedFile = null;
1656:
1657:                if (returnVal == JFileChooser.APPROVE_OPTION) {
1658:                    selectedFile = chooser.getSelectedFile();
1659:                    if (!selectedFile.isDirectory()) {
1660:                        JOptionPane.showMessageDialog(view,
1661:                                "Selection not a directory.", NAME,
1662:                                JOptionPane.ERROR_MESSAGE);
1663:                        return;
1664:                    }
1665:                } else {
1666:                    return;
1667:                }
1668:                // In case the user presses cancel or escape.
1669:
1670:                jEdit.setProperty("pmd.cpd.lastDirectory", selectedFile
1671:                        .getCanonicalPath());
1672:                initJSPlugin();
1673:                jsPlugin.errorSource.clear();
1674:
1675:                int tilesize = 100;
1676:
1677:                try {
1678:                    tilesize = Integer.parseInt(txttilesize.getText());
1679:                } catch (NumberFormatException e) {
1680:                    //use the default.
1681:                    tilesize = jEdit.getIntegerProperty(
1682:                            DEFAULT_TILE_MINSIZE_PROPERTY, 100);
1683:                }
1684:
1685:                CPD cpd = new CPD(tilesize, new JavaLanguage());
1686:
1687:                if (recursive) {
1688:                    cpd.addRecursively(selectedFile.getCanonicalPath());
1689:                } else {
1690:                    cpd.addAllInDirectory(selectedFile.getCanonicalPath());
1691:                }
1692:
1693:                cpd.go();
1694:                jsPlugin.processDuplicates(cpd, view);
1695:            }
1696:
1697:            /**
1698:             *  Description of the Method
1699:             *
1700:             * @param  view     Description of Parameter
1701:             * @param  browser  Description of Parameter
1702:             * @since           v 1.0
1703:             */
1704:            public static void checkFile(View view, VFSBrowser browser) {
1705:                initJSPlugin();
1706:                jsPlugin.checkFile(view, browser.getSelectedFiles());
1707:            }
1708:
1709:            /**
1710:             *  Description of the Method
1711:             *
1712:             * @param  view       Description of Parameter
1713:             * @param  browser    Description of Parameter
1714:             * @param  recursive  Description of Parameter
1715:             * @since             v 1.0
1716:             */
1717:            public static void checkDirectory(View view, VFSBrowser browser,
1718:                    boolean recursive) {
1719:                VFS.DirectoryEntry entry[] = browser.getSelectedFiles();
1720:
1721:                if (entry == null || entry.length == 0
1722:                        || entry[0].type != VFS.DirectoryEntry.DIRECTORY) {
1723:                    JOptionPane.showMessageDialog(view,
1724:                            "Selection must be a directory", NAME,
1725:                            JOptionPane.ERROR_MESSAGE);
1726:                    return;
1727:                }
1728:                initJSPlugin();
1729:                jsPlugin.process(jsPlugin.findFiles(entry[0].path, recursive),
1730:                        view);
1731:            }
1732:
1733:            /**
1734:             *  Gets the BrowserDirectory attribute of the JavaStylePlugin object
1735:             *
1736:             * @param  view  Description of Parameter
1737:             * @return       The BrowserDirectory value
1738:             * @since        v 1.0
1739:             */
1740:            private static String getBrowserDirectory(View view) {
1741:                VFSBrowser browser = (VFSBrowser) view
1742:                        .getDockableWindowManager().getDockable("vfs.browser");
1743:                if (jEdit.getBooleanProperty(OPTION_UI_DIRECTORY_POPUP)
1744:                        || browser == null) {
1745:                    return null;
1746:                }
1747:                return browser.getDirectory();
1748:            }
1749:
1750:            /**
1751:             *  Description of the Class
1752:             *
1753:             * @author    Mike Atkinson
1754:             * @since     2.9.12
1755:             */
1756:            public final class JavaAST extends EBMessage {
1757:                private Node node;
1758:                private Buffer buffer;
1759:
1760:                /**
1761:                 *  Constructor for the JavaAST object
1762:                 *
1763:                 * @param  component  Description of Parameter
1764:                 * @param  buffer     Description of Parameter
1765:                 * @param  node       Description of Parameter
1766:                 * @since             2.9.12
1767:                 */
1768:                public JavaAST(EBComponent component, Buffer buffer, Node node) {
1769:                    super (component);
1770:                    this .buffer = buffer;
1771:                    this .node = node;
1772:                }
1773:
1774:                /**
1775:                 *  Gets the rootNode attribute of the JavaAST object
1776:                 *
1777:                 * @return    The rootNode value
1778:                 * @since     2.9.12
1779:                 */
1780:                public Node getRootNode() {
1781:                    return node;
1782:                }
1783:            }
1784:
1785:            /**
1786:             *  Description of the Class
1787:             *
1788:             * @author    Mike Atkinson
1789:             * @since     2.9.12
1790:             */
1791:            public final class JavaTree extends EBMessage {
1792:                private TreeNode node;
1793:                private Buffer buffer;
1794:
1795:                /**
1796:                 *  Constructor for the JavaTree object
1797:                 *
1798:                 * @param  component  Description of Parameter
1799:                 * @param  buffer     Description of Parameter
1800:                 * @param  node       Description of Parameter
1801:                 * @since             2.9.12
1802:                 */
1803:                public JavaTree(EBComponent component, Buffer buffer,
1804:                        TreeNode node) {
1805:                    super (component);
1806:                    this .buffer = buffer;
1807:                    this .node = node;
1808:                }
1809:
1810:                /**
1811:                 *  Gets the rootNode attribute of the JavaTree object
1812:                 *
1813:                 * @return    The rootNode value
1814:                 * @since     2.9.12
1815:                 */
1816:                public TreeNode getRootNode() {
1817:                    return node;
1818:                }
1819:            }
1820:
1821:            /**
1822:             * Adds an annotation to an ide buffer.
1823:             *
1824:             * @param  view         The frame containing the IDE.
1825:             * @param  buffer       The buffer (containing Java Source) that has been parsed.
1826:             * @param  type         either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
1827:             * @param  lineNo       The line number of the annotation.
1828:             * @param  description  The annotation
1829:             */
1830:            public void addAnnotation(Frame view, Object buffer, int type,
1831:                    int lineNo, String description) {
1832:                //Log.log(Log.NOTICE, this, "NOT IMPLEMENTED: addAnnotation()");
1833:            }
1834:
1835:            /**
1836:             * Clears all annotation for an ide buffer.
1837:             *
1838:             * @param  view         The frame containing the IDE.
1839:             * @param  buffer       The buffer (containing Java Source) that has been parsed.
1840:             * @param  type         either CODING_STANDARDS or CUT_AND_PASTE_DETECTION
1841:             */
1842:            public void clearAnnotations(Frame view, Object buffer, int type) {
1843:                //Log.log(Log.NOTICE, this, "NOT IMPLEMENTED: clearAnnotations()");
1844:            }
1845:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.