### Eclipse Workspace Patch 1.0
#P org.eclipse.pde.ui
Index: plugin.properties
===================================================================
RCS file: /home/eclipse/org.eclipse.pde.ui/plugin.properties,v
retrieving revision 1.156
diff -u -r1.156 plugin.properties
--- plugin.properties 3 Apr 2006 19:47:18 -0000 1.156
+++ plugin.properties 27 Apr 2006 13:26:00 -0000
@@ -162,6 +162,11 @@
template.universalWelcome.desc = This template creates a link in one of sections of the Universal Welcome. \
The product must be using Universal Welcome for this extension to work.
+template.perspective.name = Release Eng. Perspective
+template.perspective.desc = This template creates a release engineering themed perspective. \
+While most users will not be doing any release engineering, the theme allows for a very logical \
+layout of the perspective elements and demonstrates how to access the various team and CVS \
+components from within a perspective.
pluginContent.helloWorld.name = Hello, World
pluginContent.helloWorld.description=\
@@ -359,7 +364,8 @@
newExtension.templates.importWizard.name = File Import Wizard
newExtension.templates.importWizard.desc =
%template.importWizard.desc%
-
+newExtension.templates.perspective.name = Release Eng. Perspective
+newExtension.templates.perspective.desc = %template.perspective.desc%
org.eclipse.pde.ui.tools = PDE To&ols
MigrationAction.label = Migrate to 3.0...
Index: plugin.xml
===================================================================
RCS file: /home/eclipse/org.eclipse.pde.ui/plugin.xml,v
retrieving revision 1.347
diff -u -r1.347 plugin.xml
--- plugin.xml 11 Apr 2006 20:52:50 -0000 1.347
+++ plugin.xml 27 Apr 2006 13:26:00 -0000
@@ -567,6 +567,18 @@
%newExtension.templates.universalWelcome.desc
+
+
+ %newExtension.templates.perspective.desc
+
+
+
@@ -649,7 +661,7 @@
+
Index: src/org/eclipse/pde/internal/ui/pderesources.properties
===================================================================
RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v
retrieving revision 1.707
diff -u -r1.707 pderesources.properties
--- src/org/eclipse/pde/internal/ui/pderesources.properties 26 Apr 2006 13:25:55 -0000 1.707
+++ src/org/eclipse/pde/internal/ui/pderesources.properties 27 Apr 2006 13:26:00 -0000
@@ -1338,6 +1338,18 @@
ImportWizardTemplate_filterChoices = All,Show All File Types (*.*),Images,Show Image File Types (*.jpg;*.gif;*.bmp),Docs,Show Document File Types (*.doc;*.txt;*.pdf),Archives,Show Archive File Types (*.zip;*.tar;*.jar)
ImportWizardTemplate_wizardDescription = Import a file from the local file system into the workspace.
+PerspectiveTemplate_title = Perspective Options
+PerspectiveTemplate_desc = Choose the options for the release engineering perspective.
+PerspectiveTemplate_packageName = &Java Package:
+PerspectiveTemplate_perspectiveClass = Perspective &Class Name:
+PerspectiveTemplate_perspectiveClassName = RelEngPerspective
+PerspectiveTemplate_perspective = Perspective Name:
+PerspectiveTemplate_perspectiveName = Release Engineering
+PerspectiveTemplate_perspectiveShortcuts = Add Related Perspective Shortcuts
+PerspectiveTemplate_showViewShortcuts = Add Show View Shortcuts
+PerspectiveTemplate_newWizardShortcuts = Add New Wizard Shortcuts
+PerspectiveTemplate_actionSets = Add Menu and Toolbar Contributions (Action Sets)
+
####
PluginSelectionDialog_title = Plug-in Selection
Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java
===================================================================
RCS file: /home/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v
retrieving revision 1.171
diff -u -r1.171 PDEUIMessages.java
--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 25 Apr 2006 15:16:55 -0000 1.171
+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 27 Apr 2006 13:26:00 -0000
@@ -1212,6 +1212,17 @@
public static String ImportWizardTemplate_filters;
public static String ImportWizardTemplate_wizardDescription;
+ public static String PerspectiveTemplate_title;
+ public static String PerspectiveTemplate_desc;
+ public static String PerspectiveTemplate_packageName;
+ public static String PerspectiveTemplate_perspectiveClass;
+ public static String PerspectiveTemplate_perspectiveClassName;
+ public static String PerspectiveTemplate_perspective;
+ public static String PerspectiveTemplate_perspectiveName;
+ public static String PerspectiveTemplate_perspectiveShortcuts;
+ public static String PerspectiveTemplate_showViewShortcuts;
+ public static String PerspectiveTemplate_newWizardShortcuts;
+ public static String PerspectiveTemplate_actionSets;
//
Index: src/org/eclipse/pde/internal/ui/wizards/templates/PerspectiveTemplate.java
===================================================================
RCS file: src/org/eclipse/pde/internal/ui/wizards/templates/PerspectiveTemplate.java
diff -N src/org/eclipse/pde/internal/ui/wizards/templates/PerspectiveTemplate.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/pde/internal/ui/wizards/templates/PerspectiveTemplate.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,241 @@
+package org.eclipse.pde.internal.ui.wizards.templates;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.pde.core.plugin.IPluginBase;
+import org.eclipse.pde.core.plugin.IPluginElement;
+import org.eclipse.pde.core.plugin.IPluginExtension;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.IPluginModelFactory;
+import org.eclipse.pde.core.plugin.IPluginReference;
+import org.eclipse.pde.internal.ui.IHelpContextIds;
+import org.eclipse.pde.internal.ui.PDEUIMessages;
+import org.eclipse.pde.ui.IFieldData;
+import org.eclipse.pde.ui.templates.TemplateOption;
+
+public class PerspectiveTemplate extends PDETemplateSection {
+ public static final String PERSPECTIVE_CLASS_NAME = "perspectiveClassName"; //$NON-NLS-1$
+ public static final String PERSPECTIVE_NAME = "perspectiveCategoryName"; //$NON-NLS-1$
+
+ public static final String BLN_PERSPECTIVE_SHORTS = "perspectiveShortcuts"; //$NON-NLS-1$
+ public static final String BLN_NEW_WIZARD_SHORTS = "newWizardShortcuts"; //$NON-NLS-1$
+ public static final String BLN_SHOW_VIEW_SHORTS = "showViewShortcuts"; //$NON-NLS-1$
+ public static final String BLN_ACTION_SETS = "actionSets"; //$NON-NLS-1$
+
+ private WizardPage page;
+
+ /**
+ * Constructor for PerspectiveTemplate.
+ */
+ public PerspectiveTemplate() {
+ setPageCount(1);
+ createOptions();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#getDependencies(java.lang.String)
+ */
+ public IPluginReference[] getDependencies(String schemaVersion) {
+ // Additional dependencies required
+ if (schemaVersion != null) {
+ IPluginReference[] dep = new IPluginReference[2];
+ dep[0] = new PluginReference("org.eclipse.ui.console", null, 0); //$NON-NLS-1$
+ dep[1] = new PluginReference("org.eclipse.jdt.ui", null, 0); //$NON-NLS-1$
+ return dep;
+ }
+ return super.getDependencies(schemaVersion);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.OptionTemplateSection#getSectionId()
+ * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getDirectoryCandidates()
+ */
+ public String getSectionId() {
+ // Identifier used for the folder name within the templates_3.X
+ // hierarchy and as part of the lookup key for the template label
+ // variable.
+ return "perspective"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#getNumberOfWorkUnits()
+ */
+ public int getNumberOfWorkUnits() {
+ return super.getNumberOfWorkUnits() + 1;
+ }
+
+ /**
+ * Creates the options to be displayed on the template wizard.
+ * Various string options, blank fields and a multiple choice
+ * option are used.
+ */
+ private void createOptions() {
+ addOption(
+ KEY_PACKAGE_NAME,
+ PDEUIMessages.PerspectiveTemplate_packageName,
+ (String) null,
+ 0);
+ addOption(
+ PERSPECTIVE_CLASS_NAME,
+ PDEUIMessages.PerspectiveTemplate_perspectiveClass,
+ PDEUIMessages.PerspectiveTemplate_perspectiveClassName,
+ 0);
+ addOption(
+ PERSPECTIVE_NAME,
+ PDEUIMessages.PerspectiveTemplate_perspective,
+ PDEUIMessages.PerspectiveTemplate_perspectiveName,
+ 0);
+
+ addBlankField(0);
+
+
+ addOption(BLN_PERSPECTIVE_SHORTS,
+ PDEUIMessages.PerspectiveTemplate_perspectiveShortcuts,
+ true,
+ 0);
+ addOption(BLN_SHOW_VIEW_SHORTS,
+ PDEUIMessages.PerspectiveTemplate_showViewShortcuts,
+ true,
+ 0);
+ addOption(BLN_NEW_WIZARD_SHORTS,
+ PDEUIMessages.PerspectiveTemplate_newWizardShortcuts,
+ true,
+ 0);
+ addOption(BLN_ACTION_SETS,
+ PDEUIMessages.PerspectiveTemplate_actionSets,
+ true,
+ 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#addPages(org.eclipse.jface.wizard.Wizard)
+ */
+ public void addPages(Wizard wizard) {
+ int pageIndex = 0;
+
+ page = createPage(pageIndex, IHelpContextIds.TEMPLATE_EDITOR);
+ page.setTitle(PDEUIMessages.PerspectiveTemplate_title);
+ page.setDescription(PDEUIMessages.PerspectiveTemplate_desc);
+
+ wizard.addPage(page);
+ markPagesAdded();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#validateOptions(org.eclipse.pde.ui.templates.TemplateOption)
+ */
+ public void validateOptions(TemplateOption source) {
+ //Validate page upon change in option state and alter
+ //the page if the read-only boolean changes
+ if (source.isRequired() && source.isEmpty()) {
+ flagMissingRequiredOption(source);
+ } else {
+ validateContainerPage(source);
+ }
+ }
+
+ /**
+ * Given a required option whose value has been changed by the user,
+ * this method elects to check all options on the wizard page to
+ * confirm that none of the required options are empty.
+ *
+ * @param source
+ * the TemplateOption whose value has been changed by the user
+ */
+ private void validateContainerPage(TemplateOption source) {
+ TemplateOption[] allPageOptions = getOptions(0);
+ for (int i = 0; i < allPageOptions.length; i++) {
+ TemplateOption nextOption = allPageOptions[i];
+ if (nextOption.isRequired() && nextOption.isEmpty()) {
+ flagMissingRequiredOption(nextOption);
+ return;
+ }
+ }
+ resetPageState();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#isDependentOnParentWizard()
+ */
+ public boolean isDependentOnParentWizard() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#initializeFields(org.eclipse.pde.ui.IFieldData)
+ */
+ protected void initializeFields(IFieldData data) {
+ // In a new project wizard, we don't know this yet - the
+ // model has not been created
+ String id = data.getId();
+ initializeOption(KEY_PACKAGE_NAME, getFormattedPackageName(id));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.BaseOptionTemplateSection#initializeFields(org.eclipse.pde.core.plugin.IPluginModelBase)
+ */
+ public void initializeFields(IPluginModelBase model) {
+ // In the new extension wizard, the model exists so
+ // we can initialize directly from it
+ String pluginId = model.getPluginBase().getId();
+ initializeOption(KEY_PACKAGE_NAME, getFormattedPackageName(pluginId));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.AbstractTemplateSection#updateModel(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void updateModel(IProgressMonitor monitor) throws CoreException {
+ // This method creates the extension point structure through the use
+ // of IPluginElement objects. The element attributes are set based on
+ // user input from the wizard page as well as values required for the
+ // operation of the extension point.
+ IPluginBase plugin = model.getPluginBase();
+ IPluginExtension extension = createExtension(getUsedExtensionPoint(),true);
+ IPluginModelFactory factory = model.getPluginFactory();
+
+ IPluginElement perspectiveElement = factory.createElement(extension);
+ perspectiveElement.setName("perspective"); //$NON-NLS-1$
+ perspectiveElement.setAttribute(
+ "id", getStringOption(KEY_PACKAGE_NAME) + "." + getStringOption(PERSPECTIVE_CLASS_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
+ perspectiveElement.setAttribute(
+ "name", getStringOption(PERSPECTIVE_NAME)); //$NON-NLS-1$
+ perspectiveElement.setAttribute(
+ "class", getStringOption(KEY_PACKAGE_NAME) + "." + getStringOption(PERSPECTIVE_CLASS_NAME)); //$NON-NLS-1$
+ perspectiveElement.setAttribute(
+ "icon", "icons/releng_gears.gif"); //$NON-NLS-1$ $NON-NLS-2$
+
+
+ extension.add(perspectiveElement);
+ if (!extension.isInTheModel())
+ plugin.add(extension);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getNewFiles()
+ */
+ public String[] getNewFiles() {
+ return new String[] { "icons/" }; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.ui.wizards.templates.PDETemplateSection#getFormattedPackageName(java.lang.String)
+ */
+ protected String getFormattedPackageName(String id) {
+ // Package name addition to create a location for containing
+ // any classes required by the decorator.
+ String packageName = super.getFormattedPackageName(id);
+ if (packageName.length() != 0)
+ return packageName + ".perspectives"; //$NON-NLS-1$
+ return "perspectives"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.ui.templates.ITemplateSection#getUsedExtensionPoint()
+ */
+ public String getUsedExtensionPoint() {
+ return "org.eclipse.ui.perspectives"; //$NON-NLS-1$
+ }
+}
Index: templates_3.0/perspective/java/$perspectiveClassName$.java
===================================================================
RCS file: templates_3.0/perspective/java/$perspectiveClassName$.java
diff -N templates_3.0/perspective/java/$perspectiveClassName$.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates_3.0/perspective/java/$perspectiveClassName$.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package $packageName$;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.jdt.ui.JavaUI;
+
+
+/**
+ * This class is meant to serve as an example for how various contributions
+ * are made to a perspective. Note that some of the extension point id's are
+ * referred to as API constants while others are hardcoded and may be subject
+ * to change.
+ */
+public class $perspectiveClassName$ implements IPerspectiveFactory {
+
+ private IPageLayout factory;
+
+ public $perspectiveClassName$() {
+ super();
+ }
+
+ public void createInitialLayout(IPageLayout factory) {
+ this.factory = factory;
+ addViews();
+% if(actionSets)
+ addActionSets();
+% endif
+% if(newWizardShortcuts)
+ addNewWizardShortcuts();
+% endif
+% if(perspectiveShortcuts)
+ addPerspectiveShortcuts();
+% endif
+% if(showViewShortcuts)
+ addViewShortcuts();
+% endif
+ }
+
+ private void addViews() {
+ // Creates the overall folder layout.
+ // Note that each new Folder uses a percentage of the remaining EditorArea.
+
+ IFolderLayout bottom =
+ factory.createFolder(
+ "bottomRight", //$NON-NLS-1$
+ IPageLayout.BOTTOM,
+ 0.75f,
+ factory.getEditorArea());
+ bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
+ bottom.addView("org.eclipse.team.ccvs.ui.GenericHistoryView"); //$NON-NLS-1$
+ bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
+
+ IFolderLayout topLeft =
+ factory.createFolder(
+ "topLeft", //$NON-NLS-1$
+ IPageLayout.LEFT,
+ 0.25f,
+ factory.getEditorArea());
+ topLeft.addView(IPageLayout.ID_RES_NAV);
+ topLeft.addView("org.eclipse.jdt.junit.ResultView"); //$NON-NLS-1$
+
+ factory.addFastView("org.eclipse.team.ccvs.ui.RepositoriesView",0.50f); //$NON-NLS-1$
+ factory.addFastView("org.eclipse.team.sync.views.SynchronizeView", 0.50f); //$NON-NLS-1$
+ }
+
+% if(actionSets)
+ private void addActionSets() {
+ factory.addActionSet("org.eclipse.debug.ui.launchActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.debug.ui.debugActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.debug.ui.profileActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.jdt.debug.ui.JDTDebugActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.jdt.junit.JUnitActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.team.ui.actionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.team.cvs.ui.CVSActionSet"); //$NON-NLS-1$
+ factory.addActionSet("org.eclipse.ant.ui.actionSet.presentation"); //$NON-NLS-1$
+ factory.addActionSet(JavaUI.ID_ACTION_SET);
+ factory.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+ factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); //$NON-NLS-1$
+ }
+
+% endif
+% if(perspectiveShortcuts)
+ private void addPerspectiveShortcuts() {
+ factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); //$NON-NLS-1$
+ factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective"); //$NON-NLS-1$
+ factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
+ }
+
+% endif
+% if(newWizardShortcuts)
+ private void addNewWizardShortcuts() {
+ factory.addNewWizardShortcut("org.eclipse.team.cvs.ui.newProjectCheckout");//$NON-NLS-1$
+ factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
+ factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
+ }
+
+% endif
+% if(showViewShortcuts)
+ private void addViewShortcuts() {
+ factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.GenericHistoryView"); //$NON-NLS-1$
+ factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
+ factory.addShowViewShortcut(JavaUI.ID_PACKAGES);
+ factory.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+ factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ }
+
+% endif
+}