Source Code Cross Referenced for NewPluginProjectWizard.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » wizards » plugin » 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 » Eclipse plug in development » org.eclipse.pde.internal.ui.wizards.plugin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 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.pde.internal.ui.wizards.plugin;
011:
012:        import java.lang.reflect.InvocationTargetException;
013:
014:        import org.eclipse.core.resources.IProject;
015:        import org.eclipse.core.runtime.CoreException;
016:        import org.eclipse.core.runtime.IConfigurationElement;
017:        import org.eclipse.core.runtime.IExecutableExtension;
018:        import org.eclipse.core.runtime.IExtension;
019:        import org.eclipse.core.runtime.IExtensionPoint;
020:        import org.eclipse.core.runtime.IExtensionRegistry;
021:        import org.eclipse.core.runtime.IPath;
022:        import org.eclipse.core.runtime.Platform;
023:        import org.eclipse.jface.dialogs.IDialogSettings;
024:        import org.eclipse.jface.wizard.IWizardPage;
025:        import org.eclipse.pde.internal.ui.PDEPlugin;
026:        import org.eclipse.pde.internal.ui.PDEPluginImages;
027:        import org.eclipse.pde.internal.ui.PDEUIMessages;
028:        import org.eclipse.pde.internal.ui.elements.ElementList;
029:        import org.eclipse.pde.internal.ui.wizards.IProjectProvider;
030:        import org.eclipse.pde.internal.ui.wizards.NewWizard;
031:        import org.eclipse.pde.internal.ui.wizards.WizardElement;
032:        import org.eclipse.pde.ui.IPluginContentWizard;
033:        import org.eclipse.swt.graphics.Image;
034:        import org.eclipse.ui.IWorkingSet;
035:        import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
036:
037:        public class NewPluginProjectWizard extends NewWizard implements 
038:                IExecutableExtension {
039:            public static final String PLUGIN_POINT = "pluginContent"; //$NON-NLS-1$
040:            public static final String TAG_WIZARD = "wizard"; //$NON-NLS-1$
041:            public static final String DEF_PROJECT_NAME = "project_name"; //$NON-NLS-1$
042:            public static final String DEF_TEMPLATE_ID = "template-id"; //$NON-NLS-1$
043:
044:            private IConfigurationElement fConfig;
045:            private PluginFieldData fPluginData;
046:            private IProjectProvider fProjectProvider;
047:            private NewProjectCreationPage fMainPage;
048:            private PluginContentPage fContentPage;
049:            private TemplateListSelectionPage fWizardListPage;
050:            private boolean fPureOSGi;
051:
052:            public NewPluginProjectWizard() {
053:                setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWPPRJ_WIZ);
054:                setDialogSettings(PDEPlugin.getDefault().getDialogSettings());
055:                setWindowTitle(PDEUIMessages.NewProjectWizard_title);
056:                setNeedsProgressMonitor(true);
057:                PDEPlugin.getDefault().getLabelProvider().connect(this );
058:                fPluginData = new PluginFieldData();
059:            }
060:
061:            public NewPluginProjectWizard(String osgiFramework) {
062:                this ();
063:                fPluginData.setOSGiFramework(osgiFramework);
064:            }
065:
066:            /* (non-Javadoc)
067:             * @see org.eclipse.jface.wizard.Wizard#addPages()
068:             */
069:            public void addPages() {
070:                fMainPage = new NewProjectCreationPage(
071:                        "main", fPluginData, fPureOSGi, getSelection()); //$NON-NLS-1$
072:                fMainPage
073:                        .setTitle(PDEUIMessages.NewProjectWizard_MainPage_title);
074:                fMainPage
075:                        .setDescription(PDEUIMessages.NewProjectWizard_MainPage_desc);
076:                String pname = getDefaultValue(DEF_PROJECT_NAME);
077:                if (pname != null)
078:                    fMainPage.setInitialProjectName(pname);
079:                addPage(fMainPage);
080:
081:                fProjectProvider = new IProjectProvider() {
082:                    public String getProjectName() {
083:                        return fMainPage.getProjectName();
084:                    }
085:
086:                    public IProject getProject() {
087:                        return fMainPage.getProjectHandle();
088:                    }
089:
090:                    public IPath getLocationPath() {
091:                        return fMainPage.getLocationPath();
092:                    }
093:                };
094:
095:                fContentPage = new PluginContentPage(
096:                        "page2", fProjectProvider, fMainPage, fPluginData); //$NON-NLS-1$
097:
098:                fWizardListPage = new TemplateListSelectionPage(
099:                        getAvailableCodegenWizards(), fContentPage,
100:                        PDEUIMessages.WizardListSelectionPage_templates);
101:                String tid = getDefaultValue(DEF_TEMPLATE_ID);
102:                if (tid != null)
103:                    fWizardListPage.setInitialTemplateId(tid);
104:
105:                addPage(fContentPage);
106:                addPage(fWizardListPage);
107:            }
108:
109:            /* (non-Javadoc)
110:             * @see org.eclipse.jface.wizard.Wizard#canFinish()
111:             */
112:            public boolean canFinish() {
113:                IWizardPage page = getContainer().getCurrentPage();
114:                return super .canFinish() && page != fMainPage;
115:            }
116:
117:            /*
118:             * (non-Javadoc)
119:             * 
120:             * @see org.eclipse.pde.internal.ui.wizards.NewWizard#performFinish()
121:             */
122:            public boolean performFinish() {
123:                try {
124:                    fMainPage.updateData();
125:                    fContentPage.updateData();
126:                    IDialogSettings settings = getDialogSettings();
127:                    if (settings != null) {
128:                        fMainPage.saveSettings(settings);
129:                        fContentPage.saveSettings(settings);
130:                    }
131:                    BasicNewProjectResourceWizard.updatePerspective(fConfig);
132:                    IPluginContentWizard contentWizard = fWizardListPage
133:                            .getSelectedWizard();
134:                    getContainer().run(
135:                            false,
136:                            true,
137:                            new NewProjectCreationOperation(fPluginData,
138:                                    fProjectProvider, contentWizard));
139:
140:                    IWorkingSet[] workingSets = fMainPage
141:                            .getSelectedWorkingSets();
142:                    getWorkbench().getWorkingSetManager().addToWorkingSets(
143:                            fProjectProvider.getProject(), workingSets);
144:
145:                    return true;
146:                } catch (InvocationTargetException e) {
147:                    PDEPlugin.logException(e);
148:                } catch (InterruptedException e) {
149:                }
150:                return false;
151:            }
152:
153:            /* (non-Javadoc)
154:             * @see org.eclipse.jface.wizard.Wizard#dispose()
155:             */
156:            public void dispose() {
157:                super .dispose();
158:                PDEPlugin.getDefault().getLabelProvider().disconnect(this );
159:            }
160:
161:            /* (non-Javadoc)
162:             * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
163:             */
164:            public void setInitializationData(IConfigurationElement config,
165:                    String propertyName, Object data) throws CoreException {
166:                fConfig = config;
167:            }
168:
169:            protected WizardElement createWizardElement(
170:                    IConfigurationElement config) {
171:                String name = config.getAttribute(WizardElement.ATT_NAME);
172:                String id = config.getAttribute(WizardElement.ATT_ID);
173:                String className = config.getAttribute(WizardElement.ATT_CLASS);
174:                if (name == null || id == null || className == null)
175:                    return null;
176:                WizardElement element = new WizardElement(config);
177:                String imageName = config.getAttribute(WizardElement.ATT_ICON);
178:                if (imageName != null) {
179:                    String pluginID = config.getNamespaceIdentifier();
180:                    Image image = PDEPlugin.getDefault().getLabelProvider()
181:                            .getImageFromPlugin(pluginID, imageName);
182:                    element.setImage(image);
183:                }
184:                return element;
185:            }
186:
187:            public ElementList getAvailableCodegenWizards() {
188:                ElementList wizards = new ElementList("CodegenWizards"); //$NON-NLS-1$
189:                IExtensionRegistry registry = Platform.getExtensionRegistry();
190:                IExtensionPoint point = registry.getExtensionPoint(PDEPlugin
191:                        .getPluginId(), PLUGIN_POINT);
192:                if (point == null)
193:                    return wizards;
194:                IExtension[] extensions = point.getExtensions();
195:                for (int i = 0; i < extensions.length; i++) {
196:                    IConfigurationElement[] elements = extensions[i]
197:                            .getConfigurationElements();
198:                    for (int j = 0; j < elements.length; j++) {
199:                        if (elements[j].getName().equals(TAG_WIZARD)) {
200:                            WizardElement element = createWizardElement(elements[j]);
201:                            if (element != null) {
202:                                wizards.add(element);
203:                            }
204:                        }
205:                    }
206:                }
207:                return wizards;
208:            }
209:
210:            public String getPluginId() {
211:                return fPluginData.getId();
212:            }
213:
214:        }
w___ww.___j_a___v___a_2s.c___om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.