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

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


001:        /*
002:         * JSIndentOptionPane.java - JavaStyle indenting options panel
003:         * Copyright (C) 2001 Dirk Moebius
004:         *
005:         * jEdit buffer options:
006:         * :tabSize=4:indentSize=4:noTabs=false:maxLineLen=0:
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:        package org.acm.seguin.ide.common.options;
023:
024:        import java.awt.event.ActionEvent;
025:        import java.awt.event.ActionListener;
026:        import javax.swing.JCheckBox;
027:        import javax.swing.JLabel;
028:        import javax.swing.JTextField;
029:        import javax.swing.JRadioButton;
030:        import javax.swing.ButtonGroup;
031:
032:        /**
033:         *@author     Mike Atkinson (<a href="mailto:javastyle@ladyshot.demon.co.uk">
034:         *      Mike@ladyshot.demon.co.uk</a> )
035:         *@author     Dirk Moebius (<a href="mailto:dmoebius@gmx.net">dmoebius@gmx.net
036:         *      </a>)
037:         *@created    03 September 2003
038:         *@version    $Version: $
039:         *@since      1.0
040:         */
041:        public class JSIndentOptionPane extends JSHelpOptionPane {
042:
043:            private final static String[] bracketModes = { "C", "PASCAL",
044:                    "EMACS" };
045:
046:            private JRadioButton forceBlocks;
047:            private JRadioButton removeBlocks;
048:            private JTextField caseIndent;
049:
050:            private SelectedPanel elseStartLine_sp;
051:            private SelectedPanel catchStartLine_sp;
052:            private SelectedPanel throwsStartLine_sp;
053:            private SelectedPanel forceBlocks_sp;
054:            private SelectedPanel removeBlocks_sp;
055:            private SelectedPanel emptyBlocks_sp;
056:            private SelectedPanel indentCont_sp;
057:            private SelectedPanel cbrackets_sp;
058:            private SelectedPanel mbrackets_sp;
059:            private SelectedPanel brackets_sp;
060:            private SelectedPanel caseIndent_sp;
061:
062:            /**
063:             *  Constructor for the JSIndentOptionPane object
064:             *
065:             *@param  project  Description of the Parameter
066:             */
067:            public JSIndentOptionPane(String project) {
068:                super ("javastyle.indenting", "pretty", project);
069:            }
070:
071:            /**
072:             *  Description of the Method
073:             */
074:            public void _init() {
075:                ActionHandler ah = new ActionHandler();
076:
077:                // "'else' starts on a new line"
078:                elseStartLine_sp = addComponent("else.start.line",
079:                        "elseStartLine", new JCheckBox());
080:
081:                // "'catch' starts on a new line"
082:                catchStartLine_sp = addComponent("catch.start.line",
083:                        "catchStartLine", new JCheckBox());
084:
085:                // "'throws' starts on a new line"
086:                throwsStartLine_sp = addComponent("throws.newline",
087:                        "throwsStartLine", new JCheckBox());
088:
089:                // "Indent continued lines"
090:                String[] indentContModes = { "single", "double", "param" };
091:                //indentCont = new JMouseComboBox(indentContModes);
092:                indentCont_sp = addComponent("surprise.return",
093:                        "indentContinuedLines", new JMouseComboBox(
094:                                indentContModes));
095:
096:                // "Brackets { } :"
097:                addComponent(new JLabel(getIdeJavaStyleOption("brackets")));
098:
099:                // "Class brackets are on lines by themselves"
100:                cbrackets_sp = addComponent("class.block.style",
101:                        "brackets.classes", new JMouseComboBox(bracketModes));
102:
103:                /*
104:                // // REVISIT: enum blocks currently use the class brackets style.
105:                // // "Enum brackets are on lines by themselves"
106:                //ebrackets = new JMouseComboBox(bracketModes);
107:                //ebrackets.setEditable(false);
108:                //ebrackets.setSelectedItem(props.getString("enum.block.style"));
109:                //addHelpFor(ebrackets, "brackets.enums");
110:                //addComponent(getIdeJavaStyleOption("brackets.enums"), ebrackets);
111:                 */
112:                // "Method brackets are on lines by themselves"
113:                mbrackets_sp = addComponent("method.block.style",
114:                        "brackets.methods", new JMouseComboBox(bracketModes));
115:
116:                // "Other brackets (if,while,for etc.) are on lines by themselves"
117:                brackets_sp = addComponent("block.style", "brackets.other",
118:                        new JMouseComboBox(bracketModes));
119:
120:                // "Create brackets around single-line blocks"
121:                forceBlocks = new JRadioButton();
122:                forceBlocks_sp = addComponent("force.block", "forceBlocks",
123:                        forceBlocks);
124:
125:                // "Remove brackets around single-line blocks"
126:                removeBlocks = new JRadioButton();
127:                removeBlocks.addActionListener(ah);
128:                removeBlocks_sp = addComponent("remove.excess.blocks",
129:                        "removeBlocks", removeBlocks);
130:
131:                ButtonGroup group = new ButtonGroup();
132:                group.add(forceBlocks);
133:                group.add(removeBlocks);
134:
135:                // "Put empty methods and constructors on a single line"
136:                emptyBlocks_sp = addComponent("empty.block.single.line",
137:                        "emptyBlocks", new JCheckBox());
138:
139:                // "Indent case statements: nnn"
140:                caseIndent = new JTextField();
141:                caseIndent_sp = addComponent("case.indent", "caseIndent",
142:                        caseIndent);
143:
144:                addHelpArea();
145:            }
146:
147:            /**
148:             *  Called when the options dialog's `OK' button is pressed. This should
149:             *  save any properties saved in this option pane.
150:             */
151:            public void _save() {
152:                elseStartLine_sp.save();
153:                catchStartLine_sp.save();
154:                throwsStartLine_sp.save();
155:                forceBlocks_sp.save();
156:                removeBlocks_sp.save();
157:                emptyBlocks_sp.save();
158:                indentCont_sp.save();
159:                cbrackets_sp.save();
160:                mbrackets_sp.save();
161:                brackets_sp.save();
162:                caseIndent_sp.saveInt(4, 0);
163:
164:            }
165:
166:            /**
167:             *  Description of the Class
168:             *
169:             *@author     Mike
170:             *@created    03 September 2003
171:             */
172:            private class ActionHandler implements  ActionListener {
173:                /**
174:                 *  Description of the Method
175:                 *
176:                 *@param  evt  Description of the Parameter
177:                 */
178:                public void actionPerformed(ActionEvent evt) {
179:                    if (evt.getSource() == forceBlocks) {
180:                        if (forceBlocks.isSelected()) {
181:                            removeBlocks.setSelected(false);
182:                        }
183:                    } else if (evt.getSource() == removeBlocks) {
184:                        if (removeBlocks.isSelected()) {
185:                            forceBlocks.setSelected(false);
186:                        }
187:                    }
188:                }
189:            }
190:
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.