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


001:        /*******************************************************************************
002:         * Copyright (c) 2003, 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.internal.navigator.extensions;
011:
012:        import java.util.HashMap;
013:        import java.util.Map;
014:
015:        import org.eclipse.core.commands.common.EventManager;
016:        import org.eclipse.jface.util.IPropertyChangeListener;
017:        import org.eclipse.jface.util.PropertyChangeEvent;
018:        import org.eclipse.ui.navigator.IExtensionStateModel;
019:
020:        /**
021:         * 
022:         * 
023:         * @since 3.2
024:         * @see IExtensionStateModel
025:         */
026:        public class ExtensionStateModel extends EventManager implements 
027:                IExtensionStateModel {
028:
029:            private final String id;
030:
031:            private final String viewerId;
032:
033:            private final Map values = new HashMap();
034:
035:            /**
036:             * Create an extension state model for the given extension (anId) associated
037:             * with the given viewer (aViewerId).
038:             * 
039:             * @param anId
040:             *            The id of the extension this state model is used for.
041:             * @param aViewerId
042:             *            The id of the viewer this state model is associated with.
043:             */
044:            public ExtensionStateModel(String anId, String aViewerId) {
045:                id = anId;
046:                viewerId = aViewerId;
047:            }
048:
049:            public String getId() {
050:                return id;
051:            }
052:
053:            public String getViewerId() {
054:                return viewerId;
055:            }
056:
057:            public String getStringProperty(String aPropertyName) {
058:                return (String) values.get(aPropertyName);
059:            }
060:
061:            public boolean getBooleanProperty(String aPropertyName) {
062:
063:                Boolean b = (Boolean) values.get(aPropertyName);
064:                return b != null ? b.booleanValue() : false;
065:            }
066:
067:            public int getIntProperty(String aPropertyName) {
068:                Integer i = (Integer) values.get(aPropertyName);
069:                return i != null ? i.intValue() : -1;
070:            }
071:
072:            public void setStringProperty(String aPropertyName,
073:                    String aPropertyValue) {
074:                String oldValue = (String) values.get(aPropertyName);
075:                String newValue = aPropertyValue;
076:                if (hasPropertyChanged(oldValue, newValue)) {
077:                    values.put(aPropertyName, newValue);
078:                    firePropertyChangeEvent(new PropertyChangeEvent(this ,
079:                            aPropertyName, oldValue, newValue));
080:                }
081:            }
082:
083:            public void setBooleanProperty(String aPropertyName,
084:                    boolean aPropertyValue) {
085:                Boolean oldValue = (Boolean) values.get(aPropertyName);
086:                Boolean newValue = aPropertyValue ? Boolean.TRUE
087:                        : Boolean.FALSE;
088:                if (hasPropertyChanged(oldValue, newValue)) {
089:
090:                    values.put(aPropertyName, aPropertyValue ? Boolean.TRUE
091:                            : Boolean.FALSE);
092:                    firePropertyChangeEvent(new PropertyChangeEvent(this ,
093:                            aPropertyName, oldValue, newValue));
094:                }
095:            }
096:
097:            public void setIntProperty(String aPropertyName, int aPropertyValue) {
098:                Integer oldValue = (Integer) values.get(aPropertyName);
099:                Integer newValue = new Integer(aPropertyValue);
100:                if (hasPropertyChanged(oldValue, newValue)) {
101:                    values.put(aPropertyName, newValue);
102:                    firePropertyChangeEvent(new PropertyChangeEvent(this ,
103:                            aPropertyName, oldValue, newValue));
104:                }
105:            }
106:
107:            public void addPropertyChangeListener(
108:                    IPropertyChangeListener aListener) {
109:                addListenerObject(aListener);
110:            }
111:
112:            public void removePropertyChangeListener(
113:                    IPropertyChangeListener aListener) {
114:                removeListenerObject(aListener);
115:            }
116:
117:            public Object getProperty(String aPropertyName) {
118:                return values.get(aPropertyName);
119:            }
120:
121:            public void setProperty(String aPropertyName, Object aPropertyValue) {
122:
123:                Object oldValue = values.get(aPropertyName);
124:                Object newValue = aPropertyValue;
125:                if (hasPropertyChanged(oldValue, newValue)) {
126:                    values.put(aPropertyName, newValue);
127:                    firePropertyChangeEvent(new PropertyChangeEvent(this ,
128:                            aPropertyName, oldValue, newValue));
129:                }
130:            }
131:
132:            private boolean hasPropertyChanged(Object oldValue, Object newValue) {
133:                return oldValue == null || !oldValue.equals(newValue);
134:            }
135:
136:            protected void firePropertyChangeEvent(PropertyChangeEvent anEvent) {
137:                Object[] listeners = getListeners();
138:                for (int i = 0; i < listeners.length; ++i) {
139:                    ((IPropertyChangeListener) listeners[i])
140:                            .propertyChange(anEvent);
141:                }
142:            }
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.