Source Code Cross Referenced for ExtensionFactory.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » 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 
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;
011:
012:        import org.eclipse.core.runtime.CoreException;
013:        import org.eclipse.core.runtime.IConfigurationElement;
014:        import org.eclipse.core.runtime.IExecutableExtension;
015:        import org.eclipse.core.runtime.IExecutableExtensionFactory;
016:        import org.eclipse.core.runtime.IStatus;
017:        import org.eclipse.core.runtime.Status;
018:        import org.eclipse.ui.internal.dialogs.ContentTypesPreferencePage;
019:        import org.eclipse.ui.internal.dialogs.DecoratorsPreferencePage;
020:        import org.eclipse.ui.internal.dialogs.EditorsPreferencePage;
021:        import org.eclipse.ui.internal.dialogs.FileEditorsPreferencePage;
022:        import org.eclipse.ui.internal.dialogs.PerspectivesPreferencePage;
023:        import org.eclipse.ui.internal.dialogs.ViewsPreferencePage;
024:        import org.eclipse.ui.internal.dialogs.WorkbenchPreferencePage;
025:        import org.eclipse.ui.internal.keys.KeysPreferencePage;
026:        import org.eclipse.ui.internal.keys.NewKeysPreferencePage;
027:        import org.eclipse.ui.internal.progress.ProgressView;
028:        import org.eclipse.ui.internal.themes.ColorsAndFontsPreferencePage;
029:        import org.eclipse.ui.internal.wizards.preferences.PreferencesExportWizard;
030:        import org.eclipse.ui.internal.wizards.preferences.PreferencesImportWizard;
031:
032:        /**
033:         * Factory for the workbench's public extensions.
034:         * <p>
035:         * This allows the extensions to be made available for use by RCP applications
036:         * without exposing their concrete implementation classes.
037:         * </p>
038:         * 
039:         * @since 3.1
040:         */
041:        public class ExtensionFactory implements  IExecutableExtensionFactory,
042:                IExecutableExtension {
043:
044:            /**
045:             * Factory ID for the Appearance preference page.
046:             */
047:            public static final String APPEARANCE_PREFERENCE_PAGE = "appearancePreferencePage"; //$NON-NLS-1$
048:
049:            /**
050:             * Factory ID for the Colors and Fonts preference page.
051:             */
052:            public static final String COLORS_AND_FONTS_PREFERENCE_PAGE = "colorsAndFontsPreferencePage"; //$NON-NLS-1$
053:
054:            /**
055:             * Factory ID for the Decorators preference page.
056:             */
057:            public static final String DECORATORS_PREFERENCE_PAGE = "decoratorsPreferencePage"; //$NON-NLS-1$
058:
059:            /**
060:             * Factory ID for the Editors preference page.
061:             */
062:            public static final String EDITORS_PREFERENCE_PAGE = "editorsPreferencePage"; //$NON-NLS-1$
063:
064:            /**
065:             * Factory ID for the File Associations preference page.
066:             */
067:            public static final String FILE_ASSOCIATIONS_PREFERENCE_PAGE = "fileAssociationsPreferencePage"; //$NON-NLS-1$
068:
069:            /**
070:             * Factory ID for the Keys preference page.
071:             */
072:            public static final String KEYS_PREFERENCE_PAGE = "keysPreferencePage"; //$NON-NLS-1$
073:
074:            /**
075:             * Factory ID for the new (and improved) keys preference page.
076:             * 
077:             * @since 3.2
078:             */
079:            public static final String NEW_KEYS_PREFERENCE_PAGE = "newKeysPreferencePage"; //$NON-NLS-1$
080:
081:            /**
082:             * Factory ID for the Perspectives preference page.
083:             */
084:            public static final String PERSPECTIVES_PREFERENCE_PAGE = "perspectivesPreferencePage"; //$NON-NLS-1$
085:
086:            /**
087:             * Factory ID for the Preferences export wizard.
088:             */
089:            public static final String PREFERENCES_EXPORT_WIZARD = "preferencesExportWizard"; //$//$NON-NLS-1$
090:
091:            /**
092:             * Factory ID for the Preferences import wizard.
093:             */
094:            public static final String PREFERENCES_IMPORT_WIZARD = "preferencesImportWizard"; //$//$NON-NLS-1$
095:
096:            /**
097:             * Factory ID for the Progress view.
098:             */
099:            public static final String PROGRESS_VIEW = "progressView"; //$NON-NLS-1$
100:
101:            /**
102:             * Factory ID for the Workbench preference page.
103:             */
104:            public static final String WORKBENCH_PREFERENCE_PAGE = "workbenchPreferencePage"; //$NON-NLS-1$
105:
106:            /**
107:             * Factory ID for the ContentTypes preference page.
108:             */
109:            public static final String CONTENT_TYPES_PREFERENCE_PAGE = "contentTypesPreferencePage"; //$NON-NLS-1$
110:
111:            private IConfigurationElement config;
112:
113:            private String id;
114:
115:            private String propertyName;
116:
117:            /**
118:             * Constructs a new workbench extension factory.
119:             */
120:            public ExtensionFactory() {
121:                // do nothing
122:            }
123:
124:            private Object configure(Object obj) throws CoreException {
125:                if (obj instanceof  IExecutableExtension) {
126:                    ((IExecutableExtension) obj).setInitializationData(config,
127:                            propertyName, null);
128:                }
129:                return obj;
130:            }
131:
132:            /**
133:             * Creates the object referenced by the factory id obtained from the extension data.
134:             */
135:            public Object create() throws CoreException {
136:                if (APPEARANCE_PREFERENCE_PAGE.equals(id)) {
137:                    return configure(new ViewsPreferencePage());
138:                }
139:                if (COLORS_AND_FONTS_PREFERENCE_PAGE.equals(id)) {
140:                    return configure(new ColorsAndFontsPreferencePage());
141:                }
142:                if (DECORATORS_PREFERENCE_PAGE.equals(id)) {
143:                    return configure(new DecoratorsPreferencePage());
144:                }
145:                if (EDITORS_PREFERENCE_PAGE.equals(id)) {
146:                    return configure(new EditorsPreferencePage());
147:                }
148:                if (FILE_ASSOCIATIONS_PREFERENCE_PAGE.equals(id)) {
149:                    return configure(new FileEditorsPreferencePage());
150:                }
151:                if (KEYS_PREFERENCE_PAGE.equals(id)) {
152:                    return configure(new KeysPreferencePage());
153:                }
154:                if (NEW_KEYS_PREFERENCE_PAGE.equals(id)) {
155:                    return configure(new NewKeysPreferencePage());
156:                }
157:                if (PERSPECTIVES_PREFERENCE_PAGE.equals(id)) {
158:                    return configure(new PerspectivesPreferencePage());
159:                }
160:                if (PREFERENCES_EXPORT_WIZARD.equals(id)) {
161:                    return configure(new PreferencesExportWizard());
162:                }
163:                if (PREFERENCES_IMPORT_WIZARD.equals(id)) {
164:                    return configure(new PreferencesImportWizard());
165:                }
166:                if (PROGRESS_VIEW.equals(id)) {
167:                    return configure(new ProgressView());
168:                }
169:                if (WORKBENCH_PREFERENCE_PAGE.equals(id)) {
170:                    return configure(new WorkbenchPreferencePage());
171:                }
172:                if (CONTENT_TYPES_PREFERENCE_PAGE.equals(id)) {
173:                    return configure(new ContentTypesPreferencePage());
174:                }
175:
176:                throw new CoreException(new Status(IStatus.ERROR,
177:                        PlatformUI.PLUGIN_ID, 0,
178:                        "Unknown id in data argument for " + getClass(), null)); //$NON-NLS-1$
179:            }
180:
181:            /*
182:             * (non-Javadoc)
183:             * 
184:             * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
185:             *      java.lang.String, java.lang.Object)
186:             */
187:            public void setInitializationData(IConfigurationElement config,
188:                    String propertyName, Object data) throws CoreException {
189:                if (data instanceof  String) {
190:                    id = (String) data;
191:                } else {
192:                    throw new CoreException(
193:                            new Status(
194:                                    IStatus.ERROR,
195:                                    PlatformUI.PLUGIN_ID,
196:                                    0,
197:                                    "Data argument must be a String for " + getClass(), null)); //$NON-NLS-1$
198:                }
199:                this.config = config;
200:                this.propertyName = propertyName;
201:            }
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.