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


001:        /*******************************************************************************
002:         * Copyright (c) 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.internal.ui.templates.ide;
011:
012:        import org.eclipse.core.runtime.CoreException;
013:        import org.eclipse.core.runtime.IProgressMonitor;
014:        import org.eclipse.jface.wizard.Wizard;
015:        import org.eclipse.jface.wizard.WizardPage;
016:        import org.eclipse.pde.core.plugin.IPluginBase;
017:        import org.eclipse.pde.core.plugin.IPluginElement;
018:        import org.eclipse.pde.core.plugin.IPluginExtension;
019:        import org.eclipse.pde.core.plugin.IPluginModelBase;
020:        import org.eclipse.pde.core.plugin.IPluginModelFactory;
021:        import org.eclipse.pde.core.plugin.IPluginReference;
022:        import org.eclipse.pde.internal.ui.templates.IHelpContextIds;
023:        import org.eclipse.pde.internal.ui.templates.PDETemplateMessages;
024:        import org.eclipse.pde.internal.ui.templates.PDETemplateSection;
025:        import org.eclipse.pde.internal.ui.templates.PluginReference;
026:        import org.eclipse.pde.ui.IFieldData;
027:
028:        public class PerspectiveTemplate extends PDETemplateSection {
029:            public static final String PERSPECTIVE_CLASS_NAME = "perspectiveClassName"; //$NON-NLS-1$
030:            public static final String PERSPECTIVE_NAME = "perspectiveCategoryName"; //$NON-NLS-1$
031:
032:            public static final String BLN_PERSPECTIVE_SHORTS = "perspectiveShortcuts"; //$NON-NLS-1$
033:            public static final String BLN_NEW_WIZARD_SHORTS = "newWizardShortcuts"; //$NON-NLS-1$
034:            public static final String BLN_SHOW_VIEW_SHORTS = "showViewShortcuts"; //$NON-NLS-1$
035:            public static final String BLN_ACTION_SETS = "actionSets"; //$NON-NLS-1$
036:
037:            private WizardPage page;
038:
039:            /**
040:             * Constructor for PerspectiveTemplate.
041:             */
042:            public PerspectiveTemplate() {
043:                setPageCount(1);
044:                createOptions();
045:            }
046:
047:            /* (non-Javadoc)
048:             * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#getDependencies(java.lang.String)
049:             */
050:            public IPluginReference[] getDependencies(String schemaVersion) {
051:                // Additional dependencies required
052:                if (schemaVersion != null) {
053:                    IPluginReference[] dep = new IPluginReference[2];
054:                    dep[0] = new PluginReference(
055:                            "org.eclipse.ui.console", null, 0); //$NON-NLS-1$
056:                    dep[1] = new PluginReference("org.eclipse.jdt.ui", null, 0); //$NON-NLS-1$
057:                    return dep;
058:                }
059:                return super .getDependencies(schemaVersion);
060:            }
061:
062:            /* (non-Javadoc)
063:             * @see org.eclipse.pde.ui.templates.OptionTemplateSection#getSectionId()
064:             * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getDirectoryCandidates()
065:             */
066:            public String getSectionId() {
067:                return "perspective"; //$NON-NLS-1$
068:            }
069:
070:            /* (non-Javadoc)
071:             * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#getNumberOfWorkUnits()
072:             */
073:            public int getNumberOfWorkUnits() {
074:                return super .getNumberOfWorkUnits() + 1;
075:            }
076:
077:            /**
078:             * Creates the options to be displayed on the template wizard.
079:             * Various string options, blank fields and a multiple choice 
080:             * option are used.
081:             */
082:            private void createOptions() {
083:                addOption(KEY_PACKAGE_NAME,
084:                        PDETemplateMessages.PerspectiveTemplate_packageName,
085:                        (String) null, 0);
086:                addOption(
087:                        PERSPECTIVE_CLASS_NAME,
088:                        PDETemplateMessages.PerspectiveTemplate_perspectiveClass,
089:                        PDETemplateMessages.PerspectiveTemplate_perspectiveClassName,
090:                        0);
091:                addOption(
092:                        PERSPECTIVE_NAME,
093:                        PDETemplateMessages.PerspectiveTemplate_perspective,
094:                        PDETemplateMessages.PerspectiveTemplate_perspectiveName,
095:                        0);
096:
097:                addBlankField(0);
098:
099:                addOption(
100:                        BLN_PERSPECTIVE_SHORTS,
101:                        PDETemplateMessages.PerspectiveTemplate_perspectiveShortcuts,
102:                        true, 0);
103:                addOption(
104:                        BLN_SHOW_VIEW_SHORTS,
105:                        PDETemplateMessages.PerspectiveTemplate_showViewShortcuts,
106:                        true, 0);
107:                addOption(
108:                        BLN_NEW_WIZARD_SHORTS,
109:                        PDETemplateMessages.PerspectiveTemplate_newWizardShortcuts,
110:                        true, 0);
111:                addOption(BLN_ACTION_SETS,
112:                        PDETemplateMessages.PerspectiveTemplate_actionSets,
113:                        true, 0);
114:            }
115:
116:            /* (non-Javadoc)
117:             * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#addPages(org.eclipse.jface.wizard.Wizard)
118:             */
119:            public void addPages(Wizard wizard) {
120:                int pageIndex = 0;
121:
122:                page = createPage(pageIndex, IHelpContextIds.TEMPLATE_EDITOR);
123:                page.setTitle(PDETemplateMessages.PerspectiveTemplate_title);
124:                page
125:                        .setDescription(PDETemplateMessages.PerspectiveTemplate_desc);
126:
127:                wizard.addPage(page);
128:                markPagesAdded();
129:            }
130:
131:            /* (non-Javadoc)
132:             * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#isDependentOnParentWizard()
133:             */
134:            public boolean isDependentOnParentWizard() {
135:                return true;
136:            }
137:
138:            /* (non-Javadoc)
139:             * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#initializeFields(org.eclipse.pde.ui.IFieldData)
140:             */
141:            protected void initializeFields(IFieldData data) {
142:                // In a new project wizard, we don't know this yet - the
143:                // model has not been created
144:                String id = data.getId();
145:                initializeOption(KEY_PACKAGE_NAME, getFormattedPackageName(id));
146:            }
147:
148:            /* (non-Javadoc)
149:             * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#initializeFields(org.eclipse.pde.core.plugin.IPluginModelBase)
150:             */
151:            public void initializeFields(IPluginModelBase model) {
152:                // In the new extension wizard, the model exists so 
153:                // we can initialize directly from it
154:                String pluginId = model.getPluginBase().getId();
155:                initializeOption(KEY_PACKAGE_NAME,
156:                        getFormattedPackageName(pluginId));
157:            }
158:
159:            /* (non-Javadoc)
160:             * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#updateModel(org.eclipse.core.runtime.IProgressMonitor)
161:             */
162:            protected void updateModel(IProgressMonitor monitor)
163:                    throws CoreException {
164:                // This method creates the extension point structure through the use
165:                // of IPluginElement objects. The element attributes are set based on
166:                // user input from the wizard page as well as values required for the 
167:                // operation of the extension point.
168:                IPluginBase plugin = model.getPluginBase();
169:                IPluginExtension extension = createExtension(
170:                        getUsedExtensionPoint(), true);
171:                IPluginModelFactory factory = model.getPluginFactory();
172:
173:                IPluginElement perspectiveElement = factory
174:                        .createElement(extension);
175:                perspectiveElement.setName("perspective"); //$NON-NLS-1$
176:                perspectiveElement
177:                        .setAttribute(
178:                                "id", getStringOption(KEY_PACKAGE_NAME) + "." + getStringOption(PERSPECTIVE_CLASS_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
179:                perspectiveElement.setAttribute(
180:                        "name", getStringOption(PERSPECTIVE_NAME)); //$NON-NLS-1$
181:                perspectiveElement
182:                        .setAttribute(
183:                                "class", getStringOption(KEY_PACKAGE_NAME) + "." + getStringOption(PERSPECTIVE_CLASS_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
184:                perspectiveElement.setAttribute(
185:                        "icon", "icons/releng_gears.gif"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$
186:
187:                extension.add(perspectiveElement);
188:                if (!extension.isInTheModel())
189:                    plugin.add(extension);
190:            }
191:
192:            /* (non-Javadoc)
193:             * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getNewFiles()
194:             */
195:            public String[] getNewFiles() {
196:                return new String[] { "icons/" }; //$NON-NLS-1$
197:            }
198:
199:            /* (non-Javadoc)
200:             * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getFormattedPackageName(java.lang.String)
201:             */
202:            protected String getFormattedPackageName(String id) {
203:                // Package name addition to create a location for containing
204:                // any classes required by the decorator. 
205:                String packageName = super .getFormattedPackageName(id);
206:                if (packageName.length() != 0)
207:                    return packageName + ".perspectives"; //$NON-NLS-1$
208:                return "perspectives"; //$NON-NLS-1$
209:            }
210:
211:            /* (non-Javadoc)
212:             * @see org.eclipse.pde.ui.templates.ITemplateSection#getUsedExtensionPoint()
213:             */
214:            public String getUsedExtensionPoint() {
215:                return "org.eclipse.ui.perspectives"; //$NON-NLS-1$
216:            }
217:        }
ww__w__.___j_a__v___a___2___s___.__c__o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.