Source Code Cross Referenced for HandlerSubmission.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » commands » 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.commands 
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.commands;
011:
012:        import org.eclipse.swt.widgets.Shell;
013:        import org.eclipse.ui.IWorkbenchPartSite;
014:        import org.eclipse.ui.internal.util.Util;
015:
016:        /**
017:         * </p>
018:         * An instance of this class represents a request to handle a command. A handler
019:         * submission specifies a list of conditions under which it would be appropriate
020:         * for a particular command to have a particular handler. These conditions
021:         * include things like the active part or the active shell. So, it is possible
022:         * to say things like: "when my part is active, please consider calling these
023:         * classes when you want to perform a cut, copy or paste".
024:         * </p>
025:         * <p>
026:         * The workbench considers all of the submissions it has received and choses the
027:         * ones it views as the best possible match.
028:         * </p>
029:         * <p>
030:         * This class is not intended to be extended by clients.
031:         * </p>
032:         * <p>
033:         * Note: this class has a natural ordering that is inconsistent with equals.
034:         * </p>
035:         * 
036:         * @since 3.0
037:         * @see org.eclipse.ui.commands.IWorkbenchCommandSupport
038:         * @deprecated Please use <code>IHandlerService.activateHandler</code>
039:         *             instead.
040:         * @see org.eclipse.ui.handlers.IHandlerService
041:         */
042:        public final class HandlerSubmission implements  Comparable {
043:
044:            /**
045:             * The part identifier for the part that should be active before this
046:             * submission can be considered.  This value can be <code>null</code>, which
047:             * indicates that it should match any part.
048:             */
049:            private final String activePartId;
050:
051:            /**
052:             * The shell that must be active before this submission can be considered.
053:             * This value can be <code>null</code>, which indicates that it should match
054:             * any shell.
055:             */
056:            private final Shell activeShell;
057:
058:            /**
059:             * The workbench site that must be active before this submission can be
060:             * considered.  This value can be <code>null</code>, which indicates that it
061:             * should match an workbench part site.
062:             */
063:            private final IWorkbenchPartSite activeWorkbenchPartSite;
064:
065:            /**
066:             * The identifier for the command which the submitted handler handles.  This
067:             * value cannot be <code>null</code>.
068:             */
069:            private final String commandId;
070:
071:            /**
072:             * The handler being submitted.  This value cannot be <code>null</code>.  
073:             */
074:            private final IHandler handler;
075:
076:            /**
077:             * The priority for this submission.  In the event of all other factors
078:             * being equal, the priority will be considered in an attempt to resolve
079:             * conflicts.  This value cannot be <code>null</code>.
080:             */
081:            private final Priority priority;
082:
083:            /**
084:             * A lazily computed cache of the string representation of this submission.
085:             * This value is computed once; before it is computed, it is
086:             * <code>null</code>.
087:             */
088:            private transient String string;
089:
090:            /**
091:             * Creates a new instance of this class.
092:             * 
093:             * @param activePartId
094:             *            the identifier of the part that must be active for this
095:             *            request to be considered. May be <code>null</code>.
096:             * @param activeShell
097:             *            the shell that must be active for this request to be
098:             *            considered. May be <code>null</code>.
099:             * @param activeWorkbenchPartSite
100:             *            the workbench part site of the part that must be active for
101:             *            this request to be considered. May be <code>null</code>.
102:             * @param commandId
103:             *            the identifier of the command to be handled. Must not be
104:             *            <code>null</code>.
105:             * @param handler
106:             *            the handler. Must not be <code>null</code>.
107:             * @param priority
108:             *            the priority. Must not be <code>null</code>.
109:             */
110:            public HandlerSubmission(String activePartId, Shell activeShell,
111:                    IWorkbenchPartSite activeWorkbenchPartSite,
112:                    String commandId, IHandler handler, Priority priority) {
113:                if (commandId == null || handler == null || priority == null) {
114:                    throw new NullPointerException();
115:                }
116:
117:                this .activePartId = activePartId;
118:                this .activeShell = activeShell;
119:                this .activeWorkbenchPartSite = activeWorkbenchPartSite;
120:                this .commandId = commandId;
121:                this .handler = handler;
122:                this .priority = priority;
123:            }
124:
125:            /**
126:             * @see Comparable#compareTo(java.lang.Object)
127:             */
128:            public int compareTo(Object object) {
129:                HandlerSubmission castedObject = (HandlerSubmission) object;
130:                int compareTo = Util.compare(activeWorkbenchPartSite,
131:                        castedObject.activeWorkbenchPartSite);
132:
133:                if (compareTo == 0) {
134:                    compareTo = Util.compare(activePartId,
135:                            castedObject.activePartId);
136:
137:                    if (compareTo == 0) {
138:                        compareTo = Util.compare(activeShell,
139:                                castedObject.activeShell);
140:
141:                        if (compareTo == 0) {
142:                            compareTo = Util.compare(priority,
143:                                    castedObject.priority);
144:
145:                            if (compareTo == 0) {
146:                                compareTo = Util.compare(commandId,
147:                                        castedObject.commandId);
148:
149:                                if (compareTo == 0) {
150:                                    compareTo = Util.compare(handler,
151:                                            castedObject.handler);
152:                                }
153:                            }
154:                        }
155:                    }
156:                }
157:
158:                return compareTo;
159:            }
160:
161:            /**
162:             * Returns the identifier of the part that must be active for this request
163:             * to be considered.
164:             * 
165:             * @return the identifier of the part that must be active for this request
166:             *         to be considered. May be <code>null</code>.
167:             */
168:            public String getActivePartId() {
169:                return activePartId;
170:            }
171:
172:            /**
173:             * Returns the shell that must be active for this request to be considered.
174:             * 
175:             * @return the shell that must be active for this request to be considered.
176:             *         May be <code>null</code>.
177:             */
178:            public Shell getActiveShell() {
179:                return activeShell;
180:            }
181:
182:            /**
183:             * Returns the workbench part site of the part that must be active for this
184:             * request to be considered.
185:             * 
186:             * @return the workbench part site of the part that must be active for this
187:             *         request to be considered. May be <code>null</code>.
188:             */
189:            public IWorkbenchPartSite getActiveWorkbenchPartSite() {
190:                return activeWorkbenchPartSite;
191:            }
192:
193:            /**
194:             * Returns the identifier of the command to be handled.
195:             * 
196:             * @return the identifier of the command to be handled. Guaranteed not to be
197:             *         <code>null</code>.
198:             */
199:            public String getCommandId() {
200:                return commandId;
201:            }
202:
203:            /**
204:             * Returns the handler.
205:             * 
206:             * @return the handler. Guaranteed not to be <code>null</code>.
207:             */
208:            public IHandler getHandler() {
209:                return handler;
210:            }
211:
212:            /**
213:             * Returns the priority.
214:             * 
215:             * @return the priority. Guaranteed not to be <code>null</code>.
216:             */
217:            public Priority getPriority() {
218:                return priority;
219:            }
220:
221:            /**
222:             * @see Object#toString()
223:             */
224:            public String toString() {
225:                if (string == null) {
226:                    final StringBuffer stringBuffer = new StringBuffer();
227:                    stringBuffer.append("[activePartId="); //$NON-NLS-1$
228:                    stringBuffer.append(activePartId);
229:                    stringBuffer.append(",activeShell="); //$NON-NLS-1$
230:                    stringBuffer.append(activeShell);
231:                    stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
232:                    stringBuffer.append(activeWorkbenchPartSite);
233:                    stringBuffer.append(",commandId="); //$NON-NLS-1$
234:                    stringBuffer.append(commandId);
235:                    stringBuffer.append(",handler="); //$NON-NLS-1$
236:                    stringBuffer.append(handler);
237:                    stringBuffer.append(",priority="); //$NON-NLS-1$
238:                    stringBuffer.append(priority);
239:                    stringBuffer.append(']');
240:                    string = stringBuffer.toString();
241:                }
242:
243:                return string;
244:            }
245:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.