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


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 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.jface.bindings;
011:
012:        import java.util.Collection;
013:        import java.util.Map;
014:
015:        import org.eclipse.core.commands.ParameterizedCommand;
016:        import org.eclipse.core.commands.common.AbstractBitSetEvent;
017:        import org.eclipse.jface.util.Util;
018:
019:        /**
020:         * An instance of this class describes changes to an instance of
021:         * <code>BindingManager</code>.
022:         * <p>
023:         * This class is not intended to be extended by clients.
024:         * </p>
025:         * 
026:         * @since 3.1
027:         * @see IBindingManagerListener#bindingManagerChanged(BindingManagerEvent)
028:         */
029:        public final class BindingManagerEvent extends AbstractBitSetEvent {
030:
031:            /**
032:             * The bit used to represent whether the map of active bindings has changed.
033:             */
034:            private static final int CHANGED_ACTIVE_BINDINGS = 1;
035:
036:            /**
037:             * The bit used to represent whether the active scheme has changed.
038:             */
039:            private static final int CHANGED_ACTIVE_SCHEME = 1 << 1;
040:
041:            /**
042:             * The bit used to represent whether the active locale has changed.
043:             */
044:            private static final int CHANGED_LOCALE = 1 << 2;
045:
046:            /**
047:             * The bit used to represent whether the active platform has changed.
048:             */
049:            private static final int CHANGED_PLATFORM = 1 << 3;
050:
051:            /**
052:             * The bit used to represent whether the scheme's defined state has changed.
053:             */
054:            private static final int CHANGED_SCHEME_DEFINED = 1 << 4;
055:
056:            /**
057:             * The binding manager that has changed; this value is never
058:             * <code>null</code>.
059:             */
060:            private final BindingManager manager;
061:
062:            /**
063:             * The map of triggers (<code>Collection</code> of
064:             * <code>TriggerSequence</code>) by parameterized command (<code>ParameterizedCommand</code>)
065:             * before the change occurred. This map may be empty and it may be
066:             * <code>null</code>.
067:             */
068:            private final Map previousTriggersByParameterizedCommand;
069:
070:            /**
071:             * The scheme that became defined or undefined. This value may be
072:             * <code>null</code> if no scheme changed its defined state.
073:             */
074:            private final Scheme scheme;
075:
076:            /**
077:             * Creates a new instance of this class.
078:             * 
079:             * @param manager
080:             *            the instance of the binding manager that changed; must not be
081:             *            <code>null</code>.
082:             * @param activeBindingsChanged
083:             *            Whether the active bindings have changed.
084:             * @param previousTriggersByParameterizedCommand
085:             *            The map of triggers (<code>TriggerSequence</code>) by
086:             *            fully-parameterized command (<code>ParameterizedCommand</code>)
087:             *            before the change occured. This map may be <code>null</code>
088:             *            or empty.
089:             * @param activeSchemeChanged
090:             *            true, iff the active scheme changed.
091:             * @param scheme
092:             *            The scheme that became defined or undefined; <code>null</code>
093:             *            if no scheme changed state.
094:             * @param schemeDefined
095:             *            <code>true</code> if the given scheme became defined;
096:             *            <code>false</code> otherwise.
097:             * @param localeChanged
098:             *            <code>true</code> iff the active locale changed
099:             * @param platformChanged
100:             *            <code>true</code> iff the active platform changed
101:             */
102:            public BindingManagerEvent(final BindingManager manager,
103:                    final boolean activeBindingsChanged,
104:                    final Map previousTriggersByParameterizedCommand,
105:                    final boolean activeSchemeChanged, final Scheme scheme,
106:                    final boolean schemeDefined, final boolean localeChanged,
107:                    final boolean platformChanged) {
108:                if (manager == null) {
109:                    throw new NullPointerException(
110:                            "A binding manager event needs a binding manager"); //$NON-NLS-1$
111:                }
112:                this .manager = manager;
113:
114:                if (schemeDefined && (scheme == null)) {
115:                    throw new NullPointerException(
116:                            "If a scheme changed defined state, then there should be a scheme identifier"); //$NON-NLS-1$
117:                }
118:                this .scheme = scheme;
119:
120:                this .previousTriggersByParameterizedCommand = previousTriggersByParameterizedCommand;
121:
122:                if (activeBindingsChanged) {
123:                    changedValues |= CHANGED_ACTIVE_BINDINGS;
124:                }
125:                if (activeSchemeChanged) {
126:                    changedValues |= CHANGED_ACTIVE_SCHEME;
127:                }
128:                if (localeChanged) {
129:                    changedValues |= CHANGED_LOCALE;
130:                }
131:                if (platformChanged) {
132:                    changedValues |= CHANGED_PLATFORM;
133:                }
134:                if (schemeDefined) {
135:                    changedValues |= CHANGED_SCHEME_DEFINED;
136:                }
137:            }
138:
139:            /**
140:             * Returns the instance of the manager that changed.
141:             * 
142:             * @return the instance of the manager that changed. Guaranteed not to be
143:             *         <code>null</code>.
144:             */
145:            public final BindingManager getManager() {
146:                return manager;
147:            }
148:
149:            /**
150:             * Returns the scheme that changed.
151:             * 
152:             * @return The changed scheme
153:             */
154:            public final Scheme getScheme() {
155:                return scheme;
156:            }
157:
158:            /**
159:             * Returns whether the active bindings have changed.
160:             * 
161:             * @return <code>true</code> if the active bindings have changed;
162:             *         <code>false</code> otherwise.
163:             */
164:            public final boolean isActiveBindingsChanged() {
165:                return ((changedValues & CHANGED_ACTIVE_BINDINGS) != 0);
166:            }
167:
168:            /**
169:             * Computes whether the active bindings have changed for a given command
170:             * identifier.
171:             * 
172:             * @param parameterizedCommand
173:             *            The fully-parameterized command whose bindings might have
174:             *            changed; must not be <code>null</code>.
175:             * @return <code>true</code> if the active bindings have changed for the
176:             *         given command identifier; <code>false</code> otherwise.
177:             */
178:            public final boolean isActiveBindingsChangedFor(
179:                    final ParameterizedCommand parameterizedCommand) {
180:                final TriggerSequence[] currentBindings = manager
181:                        .getActiveBindingsFor(parameterizedCommand);
182:                final TriggerSequence[] previousBindings;
183:                if (previousTriggersByParameterizedCommand != null) {
184:                    final Collection previousBindingCollection = (Collection) previousTriggersByParameterizedCommand
185:                            .get(parameterizedCommand);
186:                    if (previousBindingCollection == null) {
187:                        previousBindings = null;
188:                    } else {
189:                        previousBindings = (TriggerSequence[]) previousBindingCollection
190:                                .toArray(new TriggerSequence[previousBindingCollection
191:                                        .size()]);
192:                    }
193:                } else {
194:                    previousBindings = null;
195:                }
196:
197:                return !Util.equals(currentBindings, previousBindings);
198:            }
199:
200:            /**
201:             * Returns whether or not the active scheme changed.
202:             * 
203:             * @return true, iff the active scheme property changed.
204:             */
205:            public final boolean isActiveSchemeChanged() {
206:                return ((changedValues & CHANGED_ACTIVE_SCHEME) != 0);
207:            }
208:
209:            /**
210:             * Returns whether the locale has changed
211:             * 
212:             * @return <code>true</code> if the locale changed; <code>false</code>
213:             *         otherwise.
214:             */
215:            public boolean isLocaleChanged() {
216:                return ((changedValues & CHANGED_LOCALE) != 0);
217:            }
218:
219:            /**
220:             * Returns whether the platform has changed
221:             * 
222:             * @return <code>true</code> if the platform changed; <code>false</code>
223:             *         otherwise.
224:             */
225:            public boolean isPlatformChanged() {
226:                return ((changedValues & CHANGED_PLATFORM) != 0);
227:            }
228:
229:            /**
230:             * Returns whether the list of defined scheme identifiers has changed.
231:             * 
232:             * @return <code>true</code> if the list of scheme identifiers has
233:             *         changed; <code>false</code> otherwise.
234:             */
235:            public final boolean isSchemeChanged() {
236:                return (scheme != null);
237:            }
238:
239:            /**
240:             * Returns whether or not the scheme became defined
241:             * 
242:             * @return <code>true</code> if the scheme became defined.
243:             */
244:            public final boolean isSchemeDefined() {
245:                return (((changedValues & CHANGED_SCHEME_DEFINED) != 0) && (scheme != null));
246:            }
247:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.