Source Code Cross Referenced for ErrorListDialog.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » gui » 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 » Swing Library » jEdit » org.gjt.sp.jedit.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ErrorListDialog.java - Used to list I/O and plugin load errors
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 2001 Slava Pestov
007:         *
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or any later version.
012:         *
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:
023:        package org.gjt.sp.jedit.gui;
024:
025:        //{{{ Imports
026:        import java.awt.*;
027:        import java.awt.event.*;
028:        import java.util.Vector;
029:        import javax.swing.*;
030:        import javax.swing.border.*;
031:        import org.gjt.sp.jedit.*;
032:        import org.gjt.sp.jedit.pluginmgr.PluginManager;
033:        import org.gjt.sp.util.Log;
034:
035:        //}}}
036:
037:        public class ErrorListDialog extends EnhancedDialog {
038:            //{{{ ErrorEntry class
039:            public static class ErrorEntry {
040:                String path;
041:                String[] messages;
042:
043:                public ErrorEntry(String path, String messageProp, Object[] args) {
044:                    this .path = path;
045:
046:                    String message = jEdit.getProperty(messageProp, args);
047:                    if (message == null)
048:                        message = "Undefined property: " + messageProp;
049:
050:                    Log.log(Log.ERROR, this , path + ":");
051:                    Log.log(Log.ERROR, this , message);
052:
053:                    Vector tokenizedMessage = new Vector();
054:                    int lastIndex = -1;
055:                    for (int i = 0; i < message.length(); i++) {
056:                        if (message.charAt(i) == '\n') {
057:                            tokenizedMessage.addElement(message.substring(
058:                                    lastIndex + 1, i));
059:                            lastIndex = i;
060:                        }
061:                    }
062:
063:                    if (lastIndex != message.length()) {
064:                        tokenizedMessage.addElement(message
065:                                .substring(lastIndex + 1));
066:                    }
067:
068:                    messages = new String[tokenizedMessage.size()];
069:                    tokenizedMessage.copyInto(messages);
070:                }
071:
072:                public boolean equals(Object o) {
073:                    if (o instanceof  ErrorEntry) {
074:                        ErrorEntry e = (ErrorEntry) o;
075:                        return e.path.equals(path);
076:                    } else
077:                        return false;
078:                }
079:            } //}}}
080:
081:            //{{{ ErrorListDialog constructor
082:            public ErrorListDialog(Frame frame, String title, String caption,
083:                    Vector messages, boolean pluginError) {
084:                super (frame, title, !pluginError);
085:
086:                JPanel content = new JPanel(new BorderLayout(12, 12));
087:                content.setBorder(new EmptyBorder(12, 12, 12, 12));
088:                setContentPane(content);
089:
090:                Box iconBox = new Box(BoxLayout.Y_AXIS);
091:                iconBox.add(new JLabel(UIManager
092:                        .getIcon("OptionPane.errorIcon")));
093:                iconBox.add(Box.createGlue());
094:                content.add(BorderLayout.WEST, iconBox);
095:
096:                JPanel centerPanel = new JPanel(new BorderLayout());
097:
098:                JLabel label = new JLabel(caption);
099:                label.setBorder(new EmptyBorder(0, 0, 6, 0));
100:                centerPanel.add(BorderLayout.NORTH, label);
101:
102:                JList errors = new JList(messages);
103:                errors.setCellRenderer(new ErrorListCellRenderer());
104:                errors.setVisibleRowCount(Math.min(messages.size(), 4));
105:
106:                // need this bullshit scroll bar policy for the preferred size
107:                // hack to work
108:                JScrollPane scrollPane = new JScrollPane(errors,
109:                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
110:                        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
111:                Dimension size = scrollPane.getPreferredSize();
112:                size.width = Math.min(size.width, 400);
113:                scrollPane.setPreferredSize(size);
114:
115:                centerPanel.add(BorderLayout.CENTER, scrollPane);
116:
117:                content.add(BorderLayout.CENTER, centerPanel);
118:
119:                Box buttons = new Box(BoxLayout.X_AXIS);
120:                buttons.add(Box.createGlue());
121:
122:                ok = new JButton(jEdit.getProperty("common.ok"));
123:                ok.addActionListener(new ActionHandler());
124:
125:                if (pluginError) {
126:                    pluginMgr = new JButton(jEdit
127:                            .getProperty("error-list.plugin-manager"));
128:                    pluginMgr.addActionListener(new ActionHandler());
129:                    buttons.add(pluginMgr);
130:                    buttons.add(Box.createHorizontalStrut(6));
131:                }
132:
133:                buttons.add(ok);
134:
135:                buttons.add(Box.createGlue());
136:                content.add(BorderLayout.SOUTH, buttons);
137:
138:                getRootPane().setDefaultButton(ok);
139:
140:                pack();
141:                setLocationRelativeTo(frame);
142:                setVisible(true);
143:            } //}}}
144:
145:            //{{{ ok() method
146:            public void ok() {
147:                dispose();
148:            } //}}}
149:
150:            //{{{ cancel() method
151:            public void cancel() {
152:                dispose();
153:            } //}}}
154:
155:            //{{{ Private members
156:            private JButton ok, pluginMgr;
157:
158:            //}}}
159:
160:            //{{{ ActionHandler class
161:            class ActionHandler implements  ActionListener {
162:                //{{{ actionPerformed() method
163:                public void actionPerformed(ActionEvent evt) {
164:                    if (evt.getSource() == ok)
165:                        dispose();
166:                    else if (evt.getSource() == pluginMgr) {
167:                        PluginManager.showPluginManager(JOptionPane
168:                                .getFrameForComponent(ErrorListDialog.this ));
169:                    }
170:                } //}}}
171:            } //}}}
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.