Source Code Cross Referenced for UpdateMarkersOperation.java in  » IDE-Eclipse » ui-ide » org » eclipse » ui » ide » undo » 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 » IDE Eclipse » ui ide » org.eclipse.ui.ide.undo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.ide.undo;
011:
012:        import java.util.Map;
013:
014:        import org.eclipse.core.resources.IMarker;
015:        import org.eclipse.core.runtime.CoreException;
016:        import org.eclipse.core.runtime.IAdaptable;
017:        import org.eclipse.core.runtime.IProgressMonitor;
018:        import org.eclipse.core.runtime.IStatus;
019:        import org.eclipse.core.runtime.NullProgressMonitor;
020:        import org.eclipse.ui.internal.ide.undo.UndoMessages;
021:
022:        /**
023:         * An UpdateMarkersOperation represents an undoable operation for updating one
024:         * or more markers in the workspace with one or more sets of attributes. Clients
025:         * may call the public API from a background thread.
026:         * 
027:         * This class is intended to be instantiated and used by clients. It is not
028:         * intended to be subclassed by clients.
029:         * 
030:         * @since 3.3
031:         * 
032:         */
033:        public class UpdateMarkersOperation extends AbstractMarkersOperation {
034:
035:            // Whether attributes should be merged with existing attributes when
036:            // updated, or considered to be complete replacements.
037:            private boolean mergeAttributes;
038:
039:            /**
040:             * Create an undoable operation that can update the specified marker with
041:             * the specified attributes.
042:             * 
043:             * @param marker
044:             *            the marker to be updated
045:             * @param attributes
046:             *            the map of attributes to be assigned to the marker. This map
047:             *            does not replace the attribute map of the marker, but instead,
048:             *            each attribute in the map is added or updated with the current
049:             *            value in the map. In other words
050:             * @param name
051:             *            the name used to describe this operation
052:             * @param mergeAttributes
053:             *            <code>true</code> if the specified map of attributes for the
054:             *            marker is to be merged with the attributes already specified
055:             *            for the marker, or <code>false</code> if the specified map
056:             *            of attributes is to be considered a complete replacement of
057:             *            all attributes of the marker
058:             */
059:            public UpdateMarkersOperation(IMarker marker, Map attributes,
060:                    String name, boolean mergeAttributes) {
061:                super (new IMarker[] { marker }, null, attributes, name);
062:                this .mergeAttributes = mergeAttributes;
063:            }
064:
065:            /**
066:             * Create an undoable operation that updates many markers to have the same
067:             * set of attributes.
068:             * 
069:             * @param markers
070:             *            the markers to be updated
071:             * @param attributes
072:             *            the map of attributes to be assigned to each marker
073:             * @param name
074:             *            the name used to describe this operation
075:             * @param mergeAttributes
076:             *            <code>true</code> if the specified map of attributes for
077:             *            each marker is to be merged with the attributes already
078:             *            specified for that marker, or <code>false</code> if the
079:             *            specified map of attributes is to be considered a complete
080:             *            replacement of all attributes for each marker
081:             */
082:            public UpdateMarkersOperation(IMarker[] markers, Map attributes,
083:                    String name, boolean mergeAttributes) {
084:                super (markers, null, attributes, name);
085:                this .mergeAttributes = mergeAttributes;
086:            }
087:
088:            /*
089:             * (non-Javadoc)
090:             * 
091:             * Map execution to updating the markers.
092:             * 
093:             * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor,
094:             *      org.eclipse.core.runtime.IAdaptable)
095:             */
096:            protected void doExecute(IProgressMonitor monitor, IAdaptable info)
097:                    throws CoreException {
098:                if (monitor == null) {
099:                    monitor = new NullProgressMonitor();
100:                }
101:                monitor.beginTask("", 100); //$NON-NLS-1$
102:                monitor
103:                        .setTaskName(UndoMessages.MarkerOperation_UpdateProgress);
104:                updateMarkers(100, monitor, mergeAttributes);
105:                monitor.done();
106:            }
107:
108:            /*
109:             * (non-Javadoc)
110:             * 
111:             * Map undo to execute (since both operations update the markers).
112:             * 
113:             * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#doUndo(org.eclipse.core.runtime.IProgressMonitor,
114:             *      org.eclipse.core.runtime.IAdaptable)
115:             */
116:            protected void doUndo(IProgressMonitor monitor, IAdaptable info)
117:                    throws CoreException {
118:                // doExecute simply swaps the current and remembered attributes,
119:                // so it can also be used for undo
120:                doExecute(monitor, info);
121:            }
122:
123:            /*
124:             * (non-Javadoc)
125:             * 
126:             * Map undo status to marker update status.
127:             * 
128:             * @see org.eclipse.ui.ide.undo.AbstractMarkersOperation#getBasicUndoStatus()
129:             */
130:            protected IStatus getBasicUndoStatus() {
131:                return getMarkerUpdateStatus();
132:            }
133:
134:            /*
135:             * (non-Javadoc)
136:             * 
137:             * Map redo status to marker update status.
138:             * 
139:             * @see org.eclipse.ui.ide.undo.AbstractMarkersOperation#getBasicRedoStatus()
140:             */
141:            protected IStatus getBasicRedoStatus() {
142:                return getMarkerUpdateStatus();
143:            }
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.