Source Code Cross Referenced for CreateMarkersOperation.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.IResource;
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.MarkerDescription;
021:        import org.eclipse.ui.internal.ide.undo.UndoMessages;
022:
023:        /**
024:         * A CreateMarkersOperation represents an undoable operation for creating one or
025:         * more markers on one or more resources in the workspace. Clients may call the
026:         * public API from a background thread.
027:         * 
028:         * This class is intended to be instantiated and used by clients. It is not
029:         * intended to be subclassed by clients.
030:         * 
031:         * @since 3.3
032:         * 
033:         */
034:        public class CreateMarkersOperation extends AbstractMarkersOperation {
035:
036:            /**
037:             * Create an undoable operation that can create a marker of a specific type
038:             * on a resource.
039:             * 
040:             * @param type
041:             *            the type of marker to be created
042:             * @param attributes
043:             *            the map of attributes that should be assigned to the marker
044:             * @param resource
045:             *            the resource on which the marker should be created
046:             * @param name
047:             *            the name used to describe the operation that creates the
048:             *            marker
049:             * 
050:             * @see org.eclipse.core.resources.IMarker
051:             */
052:            public CreateMarkersOperation(String type, Map attributes,
053:                    IResource resource, String name) {
054:                super (null, new MarkerDescription[] { new MarkerDescription(
055:                        type, attributes, resource) }, null, name);
056:            }
057:
058:            /**
059:             * Create an undoable operation that can create multiple markers of various
060:             * types on multiple resources.
061:             * 
062:             * @param types
063:             *            an array describing the types of markers to be created
064:             * @param attributes
065:             *            an array of maps of attributes that should be assigned to each
066:             *            created marker, corresponding to each marker type described
067:             * @param resources
068:             *            an array of resources describing the resource on which the
069:             *            corresponding marker type should be created
070:             * @param name
071:             *            the name used to describe the operation that creates the
072:             *            markers
073:             */
074:            public CreateMarkersOperation(String[] types, Map[] attributes,
075:                    IResource[] resources, String name) {
076:                super (null, null, null, name);
077:                MarkerDescription[] markersToCreate = new MarkerDescription[attributes.length];
078:                for (int i = 0; i < markersToCreate.length; i++) {
079:                    markersToCreate[i] = new MarkerDescription(types[i],
080:                            attributes[i], resources[i]);
081:                }
082:                setMarkerDescriptions(markersToCreate);
083:            }
084:
085:            /**
086:             * Create an undoable operation that can create multiple markers of a single
087:             * type on multiple resources.
088:             * 
089:             * @param type
090:             *            the type of markers to be created
091:             * @param attributes
092:             *            an array of maps of attributes that should be assigned to each
093:             *            created marker
094:             * @param resources
095:             *            an array of resources describing the resource on which the
096:             *            marker with the corresponding attributes should be created
097:             * @param name
098:             *            the name used to describe the operation that creates the
099:             *            markers
100:             */
101:            public CreateMarkersOperation(String type, Map[] attributes,
102:                    IResource[] resources, String name) {
103:                super (null, null, null, name);
104:                MarkerDescription[] markersToCreate = new MarkerDescription[attributes.length];
105:                for (int i = 0; i < markersToCreate.length; i++) {
106:                    markersToCreate[i] = new MarkerDescription(type,
107:                            attributes[i], resources[i]);
108:                }
109:                setMarkerDescriptions(markersToCreate);
110:            }
111:
112:            /*
113:             * (non-Javadoc)
114:             * 
115:             * This implementation creates markers
116:             * 
117:             * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor,
118:             *      org.eclipse.core.runtime.IAdaptable)
119:             */
120:            protected void doExecute(IProgressMonitor monitor, IAdaptable info)
121:                    throws CoreException {
122:                if (monitor == null) {
123:                    monitor = new NullProgressMonitor();
124:                }
125:                monitor.beginTask("", 100); //$NON-NLS-1$
126:                monitor
127:                        .setTaskName(UndoMessages.MarkerOperation_CreateProgress);
128:                createMarkers(100, monitor);
129:                monitor.done();
130:            }
131:
132:            /*
133:             * (non-Javadoc)
134:             * 
135:             * This implementation deletes markers
136:             * 
137:             * @see org.eclipse.ui.ide.undo.AbstractWorkspaceOperation#doUndo(org.eclipse.core.runtime.IProgressMonitor,
138:             *      org.eclipse.core.runtime.IAdaptable)
139:             */
140:            protected void doUndo(IProgressMonitor monitor, IAdaptable info)
141:                    throws CoreException {
142:                if (monitor == null) {
143:                    monitor = new NullProgressMonitor();
144:                }
145:                monitor.beginTask("", 100); //$NON-NLS-1$
146:                monitor
147:                        .setTaskName(UndoMessages.MarkerOperation_DeleteProgress);
148:                deleteMarkers(100, monitor);
149:                monitor.done();
150:            }
151:
152:            /*
153:             * (non-Javadoc)
154:             * 
155:             * This implementation maps the undo status to the deletion status.
156:             * 
157:             * @see org.eclipse.ui.ide.undo.AbstractMarkersOperation#getBasicUndoStatus()
158:             */
159:            protected IStatus getBasicUndoStatus() {
160:                return getMarkerDeletionStatus();
161:            }
162:
163:            /*
164:             * (non-Javadoc)
165:             * 
166:             * This implementation maps the redo status to the creation status.
167:             * 
168:             * @see org.eclipse.ui.ide.undo.AbstractMarkersOperation#getBasicRedoStatus()
169:             */
170:            protected IStatus getBasicRedoStatus() {
171:                return getMarkerCreationStatus();
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.