Source Code Cross Referenced for PreferencesUtil.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) 2005, 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 org.eclipse.core.runtime.IAdaptable;
013:        import org.eclipse.jface.preference.IPreferencePage;
014:        import org.eclipse.jface.preference.PreferenceDialog;
015:        import org.eclipse.jface.preference.PreferenceManager;
016:        import org.eclipse.jface.preference.PreferencePage;
017:        import org.eclipse.swt.widgets.Shell;
018:        import org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog;
019:        import org.eclipse.ui.internal.dialogs.PropertyDialog;
020:        import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
021:
022:        /**
023:         * The PreferencesUtil class is the class that opens a properties or preference
024:         * dialog on a set of ids.
025:         * @since 3.1
026:         */
027:        public final class PreferencesUtil {
028:
029:            /**
030:             * Apply the data to the first page if there is any.
031:             * @param data The data to be applied
032:             * @param displayedIds  The ids to filter to.
033:             * @param dialog The dialog to apply to.
034:             */
035:            private static void applyOptions(Object data,
036:                    String[] displayedIds, FilteredPreferenceDialog dialog) {
037:                if (data != null) {
038:                    dialog.setPageData(data);
039:                    IPreferencePage page = dialog.getCurrentPage();
040:                    if (page instanceof  PreferencePage) {
041:                        ((PreferencePage) page).applyData(data);
042:                    }
043:                }
044:
045:                if (displayedIds != null) {
046:                    dialog.showOnly(displayedIds);
047:                }
048:            }
049:
050:            /**
051:             * Creates a workbench preference dialog and selects particular preference page.
052:             * If there is already a preference dialog open this dialog is used and its
053:             * selection is set to the page with id preferencePageId.
054:             * Show the other pages as filtered results using whatever filtering
055:             * criteria the search uses. It is the responsibility of the caller to then
056:             * call <code>open()</code>. The call to <code>open()</code> will not
057:             * return until the dialog closes, so this is the last chance to manipulate
058:             * the dialog.
059:             * 
060:             * @param shell
061:             * 			The Shell to parent the dialog off of if it is not
062:             * 			already created. May be <code>null</code>
063:             * 			in which case the active workbench window will be used
064:             * 			if available.
065:             * @param preferencePageId
066:             *            The identifier of the preference page to open; may be
067:             *            <code>null</code>. If it is <code>null</code>, then the
068:             *            preference page is not selected or modified in any way.
069:             * @param displayedIds
070:             *            The ids of the other pages to be displayed using the same
071:             *            filtering criterea as search. If this is <code>null</code>,
072:             *            then the all preference pages are shown.
073:             * @param data
074:             *            Data that will be passed to all of the preference pages to be
075:             *            applied as specified within the page as they are created. If
076:             *            the data is <code>null</code> nothing will be called.
077:             * 
078:             * @return a preference dialog.
079:             * @since 3.1
080:             * @see PreferenceDialog#PreferenceDialog(Shell, PreferenceManager)
081:             */
082:            public static final PreferenceDialog createPreferenceDialogOn(
083:                    Shell shell, String preferencePageId,
084:                    String[] displayedIds, Object data) {
085:                FilteredPreferenceDialog dialog = WorkbenchPreferenceDialog
086:                        .createDialogOn(shell, preferencePageId);
087:
088:                applyOptions(data, displayedIds, dialog);
089:
090:                return dialog;
091:            }
092:
093:            /**
094:             * Creates a workbench preference dialog to a particular preference page.
095:             * Show the other pages as filtered results using whatever filtering
096:             * criteria the search uses. It is the responsibility of the caller to then
097:             * call <code>open()</code>. The call to <code>open()</code> will not
098:             * return until the dialog closes, so this is the last chance to manipulate
099:             * the dialog.
100:             * 
101:             * @param shell
102:             * 			  The shell to use to parent the dialog if required.
103:             * @param propertyPageId
104:             *            The identifier of the preference page to open; may be
105:             *            <code>null</code>. If it is <code>null</code>, then the
106:             *            dialog is opened with no selected page.
107:             * @param element
108:             *            IAdaptable An adaptable element to open the dialog
109:             *            on.
110:             * @param displayedIds
111:             *            The ids of the other pages to be displayed using the same
112:             *            filtering criterea as search. If this is <code>null</code>,
113:             *            then the all preference pages are shown.
114:             * @param data
115:             *            Data that will be passed to all of the preference pages to be
116:             *            applied as specified within the page as they are created. If
117:             *            the data is <code>null</code> nothing will be called.
118:             * 
119:             * @return A preference dialog showing properties for the selection or
120:             *         <code>null</code> if it could not be created.
121:             * @since 3.1
122:             */
123:            public static final PreferenceDialog createPropertyDialogOn(
124:                    Shell shell, final IAdaptable element,
125:                    String propertyPageId, String[] displayedIds, Object data) {
126:
127:                FilteredPreferenceDialog dialog = PropertyDialog
128:                        .createDialogOn(shell, propertyPageId, element);
129:
130:                if (dialog == null) {
131:                    return null;
132:                }
133:
134:                applyOptions(data, displayedIds, dialog);
135:
136:                return dialog;
137:
138:            }
139:
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.