Source Code Cross Referenced for EnabledSubmission.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » contexts » 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.contexts 
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.contexts;
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 enabled a context. An
019:         * enabled submission specifies a list of conditions under which it would be
020:         * appropriate for a particular context to be enabled. These conditions include
021:         * things like the active part or the active shell. So, it is possible to say
022:         * things like: "when the java editor is active, please consider enabling the
023:         * 'editing java' context".
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 IWorkbenchContextSupport
038:         * @deprecated Please use <code>IContextService.activateContext</code>
039:         *             instead.
040:         * @see org.eclipse.ui.contexts.IContextService
041:         */
042:        public final class EnabledSubmission implements  Comparable {
043:
044:            /**
045:             * The identifier of the part in which this context should be enabled. If
046:             * this value is <code>null</code>, this means it should be active in any
047:             * part.
048:             */
049:            private final String activePartId;
050:
051:            /**
052:             * The shell in which this context should be enabled. If this value is
053:             * <code>null</code>, this means it should be active in any shell.
054:             */
055:            private final Shell activeShell;
056:
057:            /**
058:             * The part site in which this context should be enabled. If this value is
059:             * <code>null</code>, this means it should be active in any part site.
060:             */
061:            private final IWorkbenchPartSite activeWorkbenchPartSite;
062:
063:            /**
064:             * The identifier for the context that should be enabled by this
065:             * submissions. This value should never be <code>null</code>.
066:             */
067:            private final String contextId;
068:
069:            /**
070:             * The cached string representation of this instance. This value is computed
071:             * lazily on the first call to retrieve the string representation, and the
072:             * cache is used for all future calls. If this value is <code>null</code>,
073:             * then the value has not yet been computed.
074:             */
075:            private transient String string = null;
076:
077:            /**
078:             * Creates a new instance of this class.
079:             * 
080:             * @param activePartId
081:             *            the identifier of the part that must be active for this
082:             *            request to be considered. May be <code>null</code>.
083:             * @param activeShell
084:             *            the shell that must be active for this request to be
085:             *            considered. May be <code>null</code>.
086:             * @param activeWorkbenchPartSite
087:             *            the workbench part site of the part that must be active for
088:             *            this request to be considered. May be <code>null</code>.
089:             * @param contextId
090:             *            the identifier of the context to be enabled. Must not be
091:             *            <code>null</code>.
092:             */
093:            public EnabledSubmission(String activePartId, Shell activeShell,
094:                    IWorkbenchPartSite activeWorkbenchPartSite, String contextId) {
095:                if (contextId == null) {
096:                    throw new NullPointerException();
097:                }
098:
099:                this .activePartId = activePartId;
100:                this .activeShell = activeShell;
101:                this .activeWorkbenchPartSite = activeWorkbenchPartSite;
102:                this .contextId = contextId;
103:            }
104:
105:            /**
106:             * @see Comparable#compareTo(java.lang.Object)
107:             */
108:            public int compareTo(Object object) {
109:                EnabledSubmission castedObject = (EnabledSubmission) object;
110:                int compareTo = Util.compare(activeWorkbenchPartSite,
111:                        castedObject.activeWorkbenchPartSite);
112:
113:                if (compareTo == 0) {
114:                    compareTo = Util.compare(activePartId,
115:                            castedObject.activePartId);
116:
117:                    if (compareTo == 0) {
118:                        compareTo = Util.compare(activeShell,
119:                                castedObject.activeShell);
120:
121:                        if (compareTo == 0) {
122:                            compareTo = Util.compare(contextId,
123:                                    castedObject.contextId);
124:                        }
125:                    }
126:                }
127:
128:                return compareTo;
129:            }
130:
131:            /**
132:             * Returns the identifier of the part that must be active for this request
133:             * to be considered.
134:             * 
135:             * @return the identifier of the part that must be active for this request
136:             *         to be considered. May be <code>null</code>.
137:             */
138:            public String getActivePartId() {
139:                return activePartId;
140:            }
141:
142:            /**
143:             * Returns the shell that must be active for this request to be considered.
144:             * 
145:             * @return the shell that must be active for this request to be considered.
146:             *         May be <code>null</code>.
147:             */
148:            public Shell getActiveShell() {
149:                return activeShell;
150:            }
151:
152:            /**
153:             * Returns the workbench part site of the part that must be active for this
154:             * request to be considered.
155:             * 
156:             * @return the workbench part site of the part that must be active for this
157:             *         request to be considered. May be <code>null</code>.
158:             */
159:            public IWorkbenchPartSite getActiveWorkbenchPartSite() {
160:                return activeWorkbenchPartSite;
161:            }
162:
163:            /**
164:             * Returns the identifier of the context to be enabled.
165:             * 
166:             * @return the identifier of the context to be enabled. Guaranteed not to be
167:             *         <code>null</code>.
168:             */
169:            public String getContextId() {
170:                return contextId;
171:            }
172:
173:            /**
174:             * @see Object#toString()
175:             */
176:            public String toString() {
177:                if (string == null) {
178:                    final StringBuffer stringBuffer = new StringBuffer();
179:                    stringBuffer.append("[activePartId="); //$NON-NLS-1$
180:                    stringBuffer.append(activePartId);
181:                    stringBuffer.append(",activeShell="); //$NON-NLS-1$
182:                    stringBuffer.append(activeShell);
183:                    stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
184:                    stringBuffer.append(activeWorkbenchPartSite);
185:                    stringBuffer.append(",contextId="); //$NON-NLS-1$
186:                    stringBuffer.append(contextId);
187:                    stringBuffer.append(']');
188:                    string = stringBuffer.toString();
189:                }
190:
191:                return string;
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.