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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 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.help;
011:
012:        import java.util.ArrayList;
013:
014:        import org.eclipse.core.runtime.Assert;
015:        import org.eclipse.help.IContext;
016:        import org.eclipse.jface.dialogs.IDialogPage;
017:        import org.eclipse.swt.events.HelpEvent;
018:        import org.eclipse.swt.widgets.Control;
019:
020:        /**
021:         * For determining the help context for controls in a dialog page.
022:         * <p>
023:         * This class may be instantiated; it is not intended to be subclassed.
024:         * </p>
025:         * @deprecated nested contexts are no longer supported by the help support system
026:         */
027:        public class DialogPageContextComputer implements  IContextComputer {
028:            private IDialogPage page;
029:
030:            private ArrayList contextList;
031:
032:            private Object context;
033:
034:            /**
035:             * Creates a new context computer for the given dialog page and help context.
036:             *
037:             * @param page the dialog page
038:             * @param helpContext a single help context id (type <code>String</code>) or
039:             *  help context object (type <code>IContext</code>)
040:             */
041:            public DialogPageContextComputer(IDialogPage page,
042:                    Object helpContext) {
043:                Assert.isTrue(helpContext instanceof  String
044:                        || helpContext instanceof  IContext);
045:                this .page = page;
046:                context = helpContext;
047:            }
048:
049:            /**
050:             * Add the contexts to the context list.
051:             *
052:             * @param object the contexts (<code>Object[]</code> or <code>IContextComputer</code>)
053:             * @param event the help event 
054:             */
055:            private void addContexts(Object object, HelpEvent event) {
056:                Assert.isTrue(object instanceof  Object[]
057:                        || object instanceof  IContextComputer
058:                        || object instanceof  String);
059:
060:                if (object instanceof  String) {
061:                    contextList.add(object);
062:                    return;
063:                }
064:
065:                Object[] contexts;
066:                if (object instanceof  IContextComputer) {
067:                    // get local contexts
068:                    contexts = ((IContextComputer) object)
069:                            .getLocalContexts(event);
070:                } else {
071:                    contexts = (Object[]) object;
072:                }
073:
074:                // copy the contexts into our list	
075:                for (int i = 0; i < contexts.length; i++) {
076:                    contextList.add(contexts[i]);
077:                }
078:            }
079:
080:            /**
081:             * Add the contexts for the given control to the context list.
082:             *
083:             * @param control the control from which to obtain the contexts
084:             * @param event the help event 
085:             */
086:            private void addContextsForControl(Control control, HelpEvent event) {
087:                // See if there is are help contexts on the control
088:                Object object = WorkbenchHelp.getHelp(control);
089:
090:                if (object == null || object == this ) {
091:                    // We need to check for this in order to avoid recursion
092:                    return;
093:                }
094:
095:                addContexts(object, event);
096:            }
097:
098:            /* (non-Javadoc)
099:             * Method declared on IContextComputer.
100:             */
101:            public Object[] computeContexts(HelpEvent event) {
102:                contextList = new ArrayList();
103:
104:                // Add the local context
105:                contextList.add(context);
106:
107:                // Add the contexts for the page
108:                addContextsForControl(page.getControl(), event);
109:
110:                // Add the contexts for the container shell	
111:                addContextsForControl(page.getControl().getShell(), event);
112:
113:                // Return the contexts
114:                return contextList.toArray();
115:            }
116:
117:            /* (non-Javadoc)
118:             * Method declared on IContextComputer.
119:             */
120:            public Object[] getLocalContexts(HelpEvent event) {
121:                return new Object[] { context };
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.