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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 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.views.markers.internal;
011:
012:        import com.ibm.icu.text.CollationKey;
013:        import com.ibm.icu.text.Collator;
014:
015:        import org.eclipse.core.resources.IMarker;
016:        import org.eclipse.core.resources.IResource;
017:        import org.eclipse.core.runtime.CoreException;
018:
019:        /**
020:         * This is a concrete class that stores the same type of information as the IMarkers
021:         * used by the IDE. This class exists as an optimization. The various get* methods
022:         * on IMarker are extremely slow, which makes it very slow to sort markers (for example,
023:         * in the problems view). This marker class stores the fields in the most efficient form
024:         * for sorting and display, but necessarily removes some generality from IMarker.
025:         */
026:        public class ConcreteMarker extends MarkerNode {
027:
028:            private String description;
029:
030:            private String resourceName;
031:
032:            private String inFolder;
033:
034:            private CollationKey descriptionKey;
035:
036:            private CollationKey resourceNameKey;
037:
038:            private int line;
039:
040:            private String locationString;
041:
042:            private long creationTime;
043:
044:            private String type;
045:
046:            private IMarker marker;
047:
048:            /**
049:             * Cache for the marker ID.
050:             */
051:            private long id = -1L;
052:
053:            private MarkerNode markerCategory;
054:
055:            private String shortFolder;
056:
057:            private Object group;
058:
059:            public ConcreteMarker(IMarker toCopy) {
060:                marker = toCopy;
061:                refresh();
062:            }
063:
064:            /**
065:             * Clears any cached information. This frees up some memory, but will slow down
066:             * the next comparison operation. It is a good idea to call this on a set of markers
067:             * after sorting them, in order to reduce their memory cost. 
068:             */
069:            public void clearCache() {
070:                resourceNameKey = null;
071:                descriptionKey = null;
072:            }
073:
074:            /**
075:             * Refresh the properties of this marker from the underlying IMarker instance
076:             */
077:            public void refresh() {
078:                clearCache();
079:
080:                description = Util.getProperty(IMarker.MESSAGE, marker);
081:                resourceName = Util.getResourceName(marker);
082:                inFolder = Util.getContainerName(marker);
083:                shortFolder = null;
084:                line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
085:                locationString = marker.getAttribute(IMarker.LOCATION,
086:                        Util.EMPTY_STRING);
087:
088:                try {
089:                    creationTime = marker.getCreationTime();
090:                } catch (CoreException e) {
091:                    creationTime = 0;
092:                }
093:
094:                try {
095:                    type = marker.getType();
096:                } catch (CoreException e1) {
097:                    type = Util.EMPTY_STRING;
098:                }
099:
100:                // store the marker ID locally
101:                id = marker.getId();
102:            }
103:
104:            public IResource getResource() {
105:                return marker.getResource();
106:            }
107:
108:            public String getType() {
109:                return type;
110:            }
111:
112:            /* (non-Javadoc)
113:             * @see org.eclipse.ui.views.markers.internal.MarkerNode#getDescription()
114:             */
115:            public String getDescription() {
116:                return description;
117:            }
118:
119:            public CollationKey getDescriptionKey() {
120:                if (descriptionKey == null) {
121:                    descriptionKey = Collator.getInstance().getCollationKey(
122:                            description);
123:                }
124:
125:                return descriptionKey;
126:            }
127:
128:            public String getResourceName() {
129:                return resourceName;
130:            }
131:
132:            public CollationKey getResourceNameKey() {
133:                if (resourceNameKey == null) {
134:                    resourceNameKey = Collator.getInstance().getCollationKey(
135:                            resourceName);
136:                }
137:                return resourceNameKey;
138:            }
139:
140:            public int getLine() {
141:                return line;
142:            }
143:
144:            public String getFolder() {
145:                return inFolder;
146:            }
147:
148:            public long getCreationTime() {
149:                return creationTime;
150:            }
151:
152:            /**
153:             * The underlying marker ID value.
154:             * @return the marker's ID.
155:             */
156:            public long getId() {
157:                return id;
158:            }
159:
160:            public IMarker getMarker() {
161:                return marker;
162:            }
163:
164:            public boolean equals(Object object) {
165:                if (!(object instanceof  ConcreteMarker)) {
166:                    return false;
167:                }
168:
169:                ConcreteMarker other = (ConcreteMarker) object;
170:
171:                return other.getMarker().equals(getMarker());
172:            }
173:
174:            public int hashCode() {
175:                return getMarker().hashCode();
176:            }
177:
178:            /**
179:             * Set the category the receiver is in.
180:             * @param category
181:             */
182:            public void setCategory(MarkerNode category) {
183:                markerCategory = category;
184:
185:            }
186:
187:            /* (non-Javadoc)
188:             * @see org.eclipse.ui.views.markers.internal.MarkerNode#getChildren()
189:             */
190:            public MarkerNode[] getChildren() {
191:                return Util.EMPTY_MARKER_ARRAY;
192:            }
193:
194:            /* (non-Javadoc)
195:             * @see org.eclipse.ui.views.markers.internal.MarkerNode#getParent()
196:             */
197:            public MarkerNode getParent() {
198:                return markerCategory;
199:            }
200:
201:            /* (non-Javadoc)
202:             * @see org.eclipse.ui.views.markers.internal.MarkerNode#isConcrete()
203:             */
204:            public boolean isConcrete() {
205:                return true;
206:            }
207:
208:            /**
209:             * Return the short name for the folder.
210:             * @return String
211:             */
212:            public String getShortFolder() {
213:                if (shortFolder == null) {
214:                    shortFolder = Util.getShortContainerName(marker);
215:                }
216:                return shortFolder;
217:            }
218:
219:            /**
220:             * Get the location string. If the {@link IMarker#LOCATION }
221:             * attribute was not set then return an empty String.
222:             * @return String
223:             */
224:            public String getLocationString() {
225:                return locationString;
226:            }
227:
228:            /**
229:             * Get the group for the reciever.
230:             * @return Returns the group.
231:             */
232:            public Object getGroup() {
233:                return group;
234:            }
235:
236:            /**
237:             * Set the group name.
238:             * @param group the group name
239:             */
240:            public void setGroup(Object group) {
241:                this .group = group;
242:            }
243:
244:            /* (non-Javadoc)
245:             * @see org.eclipse.ui.views.markers.internal.MarkerNode#getConcreteRepresentative()
246:             */
247:            public ConcreteMarker getConcreteRepresentative() {
248:                return this;
249:            }
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.