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


001:        /* {{{ MarkersSaveRequest.java - I/O request
002:         * :tabSize=8:indentSize=8:noTabs=false:
003:         * :folding=explicit:collapseFolds=1:
004:         *
005:         * based on jEdit.buffer.BufferSaveRequest (Copyright (C) 2000, 2005 Slava Pestov)
006:         * Copyright (C) 2005 Martin Raspe 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         * GNU General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020:         * }}} */
021:
022:        package org.gjt.sp.jedit.bufferio;
023:
024:        //{{{ Imports
025:        import java.io.*;
026:        import java.util.List;
027:
028:        import org.gjt.sp.jedit.*;
029:        import org.gjt.sp.jedit.io.*;
030:        import org.gjt.sp.util.*;
031:
032:        //}}}
033:
034:        /**
035:         * A save request for markers. Factored out from BufferSaveRequest.java
036:         * 
037:         * @author     Martin Raspe
038:         * @created    May 20, 2005
039:         * @modified   $Date: 2006/03/10 12:49:17 $ by $Author: hertzhaft $
040:         */
041:
042:        public class MarkersSaveRequest extends WorkRequest {
043:            //{{{ Constants
044:            public static final String ERROR_OCCURRED = "MarkersSaveRequest__error";
045:
046:            //}}}
047:
048:            //{{{ MarkersSaveRequest constructor
049:            /**
050:             * Creates a new I/O request for markers.
051:             * @param view The view
052:             * @param buffer The buffer
053:             * @param session The VFS session
054:             * @param vfs The VFS
055:             * @param path The path
056:             */
057:            public MarkersSaveRequest(View view, Buffer buffer, Object session,
058:                    VFS vfs, String path) {
059:                this .view = view;
060:                this .buffer = buffer;
061:                this .session = session;
062:                this .vfs = vfs;
063:                this .path = path;
064:                this .markersPath = Buffer.getMarkersPath(vfs, path);
065:
066:            } //}}}
067:
068:            //{{{ run() method
069:            public void run() {
070:                OutputStream out = null;
071:
072:                try {
073:                    // the entire save operation can be aborted...
074:                    setAbortable(true);
075:                    try {
076:                        // We only save markers to VFS's that support deletion.
077:                        // Otherwise, we will accumilate stale marks files.
078:                        if ((vfs.getCapabilities() & VFS.DELETE_CAP) != 0) {
079:                            if (buffer.getMarkers().isEmpty())
080:                                vfs._delete(session, markersPath, view);
081:                            else {
082:                                String[] args = { vfs.getFileName(path) };
083:                                setStatus(jEdit.getProperty(
084:                                        "vfs.status.save-markers", args));
085:                                setValue(0);
086:                                out = vfs._createOutputStream(session,
087:                                        markersPath, view);
088:                                if (out != null)
089:                                    writeMarkers(out);
090:                            }
091:                        }
092:                    } catch (IOException io) {
093:                        Log.log(Log.ERROR, this , io);
094:                        buffer.setBooleanProperty(ERROR_OCCURRED, true);
095:                    }
096:                } catch (WorkThread.Abort a) {
097:                    IOUtilities.closeQuietly(out);
098:                    buffer.setBooleanProperty(ERROR_OCCURRED, true);
099:                }
100:            } //}}}
101:
102:            //{{{ writeMarkers() method
103:            private void writeMarkers(OutputStream out) throws IOException {
104:                Writer o = new BufferedWriter(new OutputStreamWriter(out));
105:                try {
106:                    List<Marker> markers = buffer.getMarkers();
107:                    for (int i = 0; i < markers.size(); i++) {
108:                        Marker marker = markers.get(i);
109:                        o.write('!');
110:                        o.write(marker.getShortcut());
111:                        o.write(';');
112:
113:                        String pos = String.valueOf(marker.getPosition());
114:                        o.write(pos);
115:                        o.write(';');
116:                        o.write(pos);
117:                        o.write('\n');
118:                    }
119:                } finally {
120:                    o.close();
121:                }
122:            } //}}}
123:
124:            //{{{ Instance variables
125:            protected View view;
126:            protected Buffer buffer;
127:            protected Object session;
128:            protected VFS vfs;
129:            protected String path;
130:            protected String markersPath;
131:            //}}}
132:
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.