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


001:        /*
002:         * AutosaveBackupOptionPane.java - Autosave & backup options
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 2003 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.options;
024:
025:        //{{{ Imports
026:        import javax.swing.*;
027:        import java.awt.event.*;
028:        import java.awt.*;
029:        import org.gjt.sp.jedit.*;
030:        import org.gjt.sp.jedit.browser.VFSBrowser;
031:
032:        //}}}
033:
034:        /**
035:         * The Save and Backup option panel.
036:         * 
037:         * @author Slava Pestov
038:         * @author $Id: SaveBackupOptionPane.java 11123 2007-11-23 15:51:02Z k_satoda $
039:         */
040:        public class SaveBackupOptionPane extends AbstractOptionPane {
041:            //{{{ SaveBackupOptionPane constructor
042:            public SaveBackupOptionPane() {
043:                super ("save-back");
044:            } //}}}
045:
046:            //{{{ _init() method
047:            protected void _init() {
048:                /* Two-stage save */
049:                twoStageSave = new JCheckBox(jEdit
050:                        .getProperty("options.save-back.twoStageSave"));
051:                twoStageSave.setSelected(jEdit
052:                        .getBooleanProperty("twoStageSave"));
053:                addComponent(twoStageSave);
054:
055:                /* Confirm save all */
056:                confirmSaveAll = new JCheckBox(jEdit
057:                        .getProperty("options.save-back.confirmSaveAll"));
058:                confirmSaveAll.setSelected(jEdit
059:                        .getBooleanProperty("confirmSaveAll"));
060:                addComponent(confirmSaveAll);
061:
062:                /* Autosave interval */
063:                autosave = new JTextField(jEdit.getProperty("autosave"));
064:                addComponent(jEdit.getProperty("options.save-back.autosave"),
065:                        autosave);
066:
067:                /* Autosave untitled buffers */
068:                autosaveUntitled = new JCheckBox(jEdit
069:                        .getProperty("options.save-back.autosaveUntitled"));
070:                autosaveUntitled.setSelected(jEdit
071:                        .getBooleanProperty("autosaveUntitled"));
072:                addComponent(autosaveUntitled);
073:
074:                /* Backup count */
075:                backups = new JTextField(jEdit.getProperty("backups"));
076:                addComponent(jEdit.getProperty("options.save-back.backups"),
077:                        backups);
078:
079:                /* Backup directory */
080:                backupDirectory = new JTextField(jEdit
081:                        .getProperty("backup.directory"));
082:                JButton browseBackupDirectory = new JButton("...");
083:                browseBackupDirectory.addActionListener(new MyActionListener());
084:                JPanel panel = new JPanel(new BorderLayout());
085:                panel.add(backupDirectory);
086:                panel.add(browseBackupDirectory, BorderLayout.EAST);
087:                addComponent(jEdit
088:                        .getProperty("options.save-back.backupDirectory"),
089:                        panel);
090:
091:                /* Backup filename prefix */
092:                backupPrefix = new JTextField(jEdit
093:                        .getProperty("backup.prefix"));
094:                addComponent(jEdit
095:                        .getProperty("options.save-back.backupPrefix"),
096:                        backupPrefix);
097:
098:                /* Backup suffix */
099:                backupSuffix = new JTextField(jEdit
100:                        .getProperty("backup.suffix"));
101:                addComponent(jEdit
102:                        .getProperty("options.save-back.backupSuffix"),
103:                        backupSuffix);
104:
105:                /* Backup on every save */
106:                backupEverySave = new JCheckBox(jEdit
107:                        .getProperty("options.save-back.backupEverySave"));
108:                backupEverySave.setSelected(jEdit
109:                        .getBooleanProperty("backupEverySave"));
110:                addComponent(backupEverySave);
111:            } //}}}
112:
113:            //{{{ _save() method
114:            protected void _save() {
115:                jEdit.setBooleanProperty("twoStageSave", twoStageSave
116:                        .isSelected());
117:                jEdit.setBooleanProperty("confirmSaveAll", confirmSaveAll
118:                        .isSelected());
119:                jEdit.setProperty("autosave", this .autosave.getText());
120:                jEdit.setProperty("backups", backups.getText());
121:                jEdit
122:                        .setProperty("backup.directory", backupDirectory
123:                                .getText());
124:                jEdit.setProperty("backup.prefix", backupPrefix.getText());
125:                jEdit.setProperty("backup.suffix", backupSuffix.getText());
126:                jEdit.setBooleanProperty("backupEverySave", backupEverySave
127:                        .isSelected());
128:                boolean newAutosave = autosaveUntitled.isSelected();
129:                boolean oldAutosave = jEdit
130:                        .getBooleanProperty("autosaveUntitled");
131:                jEdit.setBooleanProperty("autosaveUntitled", newAutosave);
132:
133:                if ((!newAutosave || jEdit.getIntegerProperty("autosave", 0) == 0)
134:                        && oldAutosave) {
135:                    Buffer[] buffers = jEdit.getBuffers();
136:                    for (Buffer buffer : buffers) {
137:                        if (buffer.isUntitled()) {
138:                            buffer.removeAutosaveFile();
139:                        }
140:                    }
141:                }
142:            } //}}}
143:
144:            //{{{ Private members
145:            private JCheckBox twoStageSave;
146:            private JCheckBox confirmSaveAll;
147:            private JTextField autosave;
148:            private JCheckBox autosaveUntitled;
149:            private JTextField backups;
150:            private JTextField backupDirectory;
151:            private JTextField backupPrefix;
152:            private JTextField backupSuffix;
153:            private JCheckBox backupEverySave;
154:
155:            //}}}
156:
157:            //{{{ MyActionListener class
158:            private class MyActionListener implements  ActionListener {
159:                public void actionPerformed(ActionEvent e) {
160:                    String[] choosenFolder = GUIUtilities.showVFSFileDialog(
161:                            null, backupDirectory.getText(),
162:                            VFSBrowser.CHOOSE_DIRECTORY_DIALOG, false);
163:                    if (choosenFolder != null)
164:                        backupDirectory.setText(choosenFolder[0]);
165:                }
166:            } //}}}
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.