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


001:        /*******************************************************************************
002:         * Copyright (c) 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.statushandlers;
011:
012:        import java.util.HashMap;
013:
014:        import org.eclipse.core.runtime.IAdaptable;
015:        import org.eclipse.core.runtime.IStatus;
016:        import org.eclipse.core.runtime.QualifiedName;
017:        import org.eclipse.ui.PlatformUI;
018:
019:        /**
020:         * <p>
021:         * The StatusAdapter wraps an instance of IStatus subclass and can hold
022:         * additional information either by using properties or by adding a new adapter. Used during
023:         * status handling process.
024:         * </p>
025:         * 
026:         * @since 3.3
027:         */
028:        public class StatusAdapter implements  IAdaptable {
029:
030:            /**
031:             * Common prefix for properties defined in this class.
032:             */
033:            static final String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID
034:                    + ".workbench.statusHandlers.adapters"; //$NON-NLS-1$
035:
036:            /**
037:             * This property is used to add title to the adapter. If the adapter is
038:             * shown in a dialog, this property is used to create title of the dialog.
039:             */
040:            public static final QualifiedName TITLE_PROPERTY = new QualifiedName(
041:                    PROPERTY_PREFIX, "title"); //$NON-NLS-1$
042:
043:            /**
044:             * This property is used to add timestamp to the adapter. If the adapter is
045:             * shown in the UI, this property can be used for sorting and showing
046:             * information about the time of status creation.
047:             */
048:            public static final QualifiedName TIMESTAMP_PROPERTY = new QualifiedName(
049:                    PROPERTY_PREFIX, "timestamp"); //$NON-NLS-1$
050:
051:            private IStatus status;
052:
053:            private HashMap properties;
054:
055:            private HashMap adapters;
056:
057:            /**
058:             * Creates an instance of this class.
059:             * 
060:             * @param status
061:             *            the status to wrap. May not be <code>null</code>.
062:             */
063:            public StatusAdapter(IStatus status) {
064:                this .status = status;
065:            }
066:
067:            /**
068:             * Associates new object which is an instance of the given class with this
069:             * adapter. object will be returned when {@link IAdaptable#getAdapter(Class)}
070:             * is called on the receiver with {@link Class} adapter as a parameter.
071:             * 
072:             * @param adapter
073:             *            the adapter class
074:             * @param object
075:             *            the adapter instance
076:             */
077:            public void addAdapter(Class adapter, Object object) {
078:                if (adapters == null) {
079:                    adapters = new HashMap();
080:                }
081:                adapters.put(adapter, object);
082:            }
083:
084:            /*
085:             * (non-Javadoc)
086:             * 
087:             * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
088:             */
089:            public Object getAdapter(Class adapter) {
090:                if (adapters == null) {
091:                    return null;
092:                }
093:                return adapters.get(adapter);
094:            }
095:
096:            /**
097:             * Returns the wrapped status.
098:             * 
099:             * @return the wrapped status set in the constructor or in
100:             *         <code>setStatus(IStatus)</code>. Will not be <code>null</code>.
101:             */
102:            public IStatus getStatus() {
103:                return status;
104:            }
105:
106:            /**
107:             * Sets a new status for this adapter.
108:             * 
109:             * @param status
110:             *            the status to set. May not be <code>null</code>.
111:             */
112:            public void setStatus(IStatus status) {
113:                this .status = status;
114:            }
115:
116:            /**
117:             * Returns the value of the adapter's property identified by the given key,
118:             * or <code>null</code> if this adapter has no such property.
119:             * 
120:             * @param key
121:             *            the qualified name of the property
122:             * @return the value of the property, or <code>null</code> if this adapter
123:             *         has no such property
124:             */
125:            public Object getProperty(QualifiedName key) {
126:                if (properties == null) {
127:                    return null;
128:                }
129:                return properties.get(key);
130:            }
131:
132:            /**
133:             * Sets the value of the receiver's property identified by the given key.
134:             * 
135:             * @param key
136:             *            the qualified name of the property
137:             * @param value
138:             *            the value of the property
139:             */
140:            public void setProperty(QualifiedName key, Object value) {
141:                if (properties == null) {
142:                    properties = new HashMap();
143:                }
144:                properties.put(key, value);
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.