Source Code Cross Referenced for AbstractNewPluginTemplateWizard.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » ui » templates » 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.ui.templates 
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.pde.ui.templates;
011:
012:        import java.util.ArrayList;
013:
014:        import org.eclipse.core.resources.IProject;
015:        import org.eclipse.core.runtime.CoreException;
016:        import org.eclipse.core.runtime.IProgressMonitor;
017:        import org.eclipse.core.runtime.SubProgressMonitor;
018:        import org.eclipse.jface.wizard.Wizard;
019:        import org.eclipse.pde.core.plugin.IPluginModelBase;
020:        import org.eclipse.pde.core.plugin.IPluginReference;
021:        import org.eclipse.pde.internal.ui.PDEPlugin;
022:        import org.eclipse.pde.internal.ui.PDEPluginImages;
023:        import org.eclipse.pde.internal.ui.PDEUIMessages;
024:        import org.eclipse.pde.ui.IBundleContentWizard;
025:        import org.eclipse.pde.ui.IFieldData;
026:
027:        /**
028:         * This class is used as a common base for plug-in content wizards that are
029:         * implemented using PDE template support. The assumption is that one or more
030:         * templates will be used to generate plug-in content. Dependencies, new files
031:         * and wizard pages are all computed based on the templates.
032:         * 
033:         * @since 2.0
034:         */
035:        public abstract class AbstractNewPluginTemplateWizard extends Wizard
036:                implements  IBundleContentWizard {
037:            private IFieldData data;
038:
039:            /**
040:             * Creates a new template wizard.
041:             */
042:            public AbstractNewPluginTemplateWizard() {
043:                super ();
044:                setDialogSettings(PDEPlugin.getDefault().getDialogSettings());
045:                setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWEXPRJ_WIZ);
046:                setNeedsProgressMonitor(true);
047:            }
048:
049:            /**
050:             * @see org.eclipse.pde.ui.IPluginContentWizard#init(IFieldData)
051:             */
052:            public void init(IFieldData data) {
053:                this .data = data;
054:                setWindowTitle(PDEUIMessages.PluginCodeGeneratorWizard_title);
055:            }
056:
057:            /**
058:             * Returns the field data passed to the wizard during the initialization.
059:             * 
060:             * @return the parent wizard field data
061:             */
062:            public IFieldData getData() {
063:                return data;
064:            }
065:
066:            /**
067:             * This wizard adds a mandatory first page. Subclasses implement this method
068:             * to add additional pages to the wizard.
069:             */
070:            protected abstract void addAdditionalPages();
071:
072:            /**
073:             * Implements wizard method. Subclasses cannot override it.
074:             */
075:            public final void addPages() {
076:                addAdditionalPages();
077:            }
078:
079:            /**
080:             * @see org.eclipse.jface.wizard.Wizard#performFinish()
081:             */
082:            public boolean performFinish() {
083:                // do nothing - all the work is in the other 'performFinish'
084:                return true;
085:            }
086:
087:            /**
088:             * Implements the interface method by looping through template sections and
089:             * executing them sequentially.
090:             * 
091:             * @param project
092:             *            the project
093:             * @param model
094:             *            the plug-in model
095:             * @param monitor
096:             *            the progress monitor to track the execution progress as part
097:             *            of the overall new project creation operation
098:             * @return <code>true</code> if the wizard completed the operation with
099:             *         success, <code>false</code> otherwise.
100:             */
101:            public boolean performFinish(IProject project,
102:                    IPluginModelBase model, IProgressMonitor monitor) {
103:                try {
104:                    ITemplateSection[] sections = getTemplateSections();
105:                    monitor.beginTask("", sections.length); //$NON-NLS-1$
106:                    for (int i = 0; i < sections.length; i++) {
107:                        sections[i].execute(project, model,
108:                                new SubProgressMonitor(monitor, 1));
109:                    }
110:                    //No reason to do this any more with the new editors
111:                    //saveTemplateFile(project, null);
112:                } catch (CoreException e) {
113:                    PDEPlugin.logException(e);
114:                    return false;
115:                } finally {
116:                    monitor.done();
117:                }
118:                return true;
119:            }
120:
121:            /**
122:             * Returns the template sections used in this wizard.
123:             * 
124:             * @return the array of template sections
125:             */
126:            public abstract ITemplateSection[] getTemplateSections();
127:
128:            /**
129:             * @see org.eclipse.pde.ui.IPluginContentWizard#getDependencies(String)
130:             */
131:            public IPluginReference[] getDependencies(String schemaVersion) {
132:                ArrayList result = new ArrayList();
133:                ITemplateSection[] sections = getTemplateSections();
134:                for (int i = 0; i < sections.length; i++) {
135:                    IPluginReference[] refs = sections[i]
136:                            .getDependencies(schemaVersion);
137:                    for (int j = 0; j < refs.length; j++) {
138:                        if (!result.contains(refs[j]))
139:                            result.add(refs[j]);
140:                    }
141:                }
142:                return (IPluginReference[]) result
143:                        .toArray(new IPluginReference[result.size()]);
144:            }
145:
146:            /**
147:             * @see org.eclipse.pde.ui.IPluginContentWizard#getNewFiles()
148:             */
149:            public String[] getNewFiles() {
150:                ArrayList result = new ArrayList();
151:                ITemplateSection[] sections = getTemplateSections();
152:                for (int i = 0; i < sections.length; i++) {
153:                    String[] newFiles = sections[i].getNewFiles();
154:                    for (int j = 0; j < newFiles.length; j++) {
155:                        if (!result.contains(newFiles[j]))
156:                            result.add(newFiles[j]);
157:                    }
158:                }
159:                return (String[]) result.toArray(new String[result.size()]);
160:            }
161:
162:            /* (non-Javadoc)
163:             * @see org.eclipse.pde.ui.IPluginContentWizard#hasPages()
164:             */
165:            public boolean hasPages() {
166:                return getTemplateSections().length > 0;
167:            }
168:
169:            public String[] getImportPackages() {
170:                return new String[0];
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.