Source Code Cross Referenced for PreferenceLinkArea.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » dialogs » 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.dialogs 
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.ui.dialogs;
011:
012:        import com.ibm.icu.text.MessageFormat;
013:        import java.util.Iterator;
014:
015:        import org.eclipse.jface.preference.IPreferenceNode;
016:        import org.eclipse.jface.preference.PreferenceManager;
017:        import org.eclipse.osgi.util.NLS;
018:        import org.eclipse.swt.events.SelectionAdapter;
019:        import org.eclipse.swt.events.SelectionEvent;
020:        import org.eclipse.swt.widgets.Composite;
021:        import org.eclipse.swt.widgets.Control;
022:        import org.eclipse.swt.widgets.Link;
023:        import org.eclipse.ui.PlatformUI;
024:        import org.eclipse.ui.internal.WorkbenchMessages;
025:        import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
026:
027:        /**
028:         * The PreferenceLinkArea is the link area used to open a specific preference
029:         * page.
030:         * 
031:         * @since 3.1
032:         */
033:        public class PreferenceLinkArea extends Object {
034:
035:            private Link pageLink;
036:
037:            /**
038:             * Create a new instance of the receiver
039:             * 
040:             * @param parent
041:             *            the parent Composite
042:             * @param style
043:             *            the SWT style
044:             * @param pageId
045:             *            the page id
046:             * @param message
047:             *            the message to use as text. If this message has {0} in 
048:             *            its value it will be bound with the displayed name of 
049:             *            the preference page. This message must be well formed
050:             *            html if you wish to link to another page.
051:             * @param pageContainer -
052:             *            The container another page will be opened in.
053:             * @param pageData -
054:             *            The data to apply to the page.
055:             */
056:            public PreferenceLinkArea(Composite parent, int style,
057:                    final String pageId, String message,
058:                    final IWorkbenchPreferenceContainer pageContainer,
059:                    final Object pageData) {
060:                pageLink = new Link(parent, style);
061:
062:                IPreferenceNode node = getPreferenceNode(pageId);
063:                String result;
064:                if (node == null) {
065:                    result = NLS.bind(
066:                            WorkbenchMessages.PreferenceNode_NotFound, pageId);
067:                } else {
068:                    result = MessageFormat.format(message, new String[] { node
069:                            .getLabelText() });
070:
071:                    //Only add the selection listener if the node is found
072:                    pageLink.addSelectionListener(new SelectionAdapter() {
073:                        /*
074:                         * (non-Javadoc)
075:                         * 
076:                         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
077:                         */
078:                        public void widgetSelected(SelectionEvent e) {
079:                            pageContainer.openPage(pageId, pageData);
080:                        }
081:                    });
082:                }
083:                pageLink.setText(result);
084:
085:            }
086:
087:            /**
088:             * Get the preference node with pageId.
089:             * 
090:             * @param pageId
091:             * @return IPreferenceNode
092:             */
093:            private IPreferenceNode getPreferenceNode(String pageId) {
094:                Iterator iterator = PlatformUI.getWorkbench()
095:                        .getPreferenceManager().getElements(
096:                                PreferenceManager.PRE_ORDER).iterator();
097:                while (iterator.hasNext()) {
098:                    IPreferenceNode next = (IPreferenceNode) iterator.next();
099:                    if (next.getId().equals(pageId)) {
100:                        return next;
101:                    }
102:                }
103:                return null;
104:            }
105:
106:            /**
107:             * Return the control for the receiver.
108:             * 
109:             * @return Control
110:             */
111:            public Control getControl() {
112:                return pageLink;
113:            }
114:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.