From 1c258538dee14f70d9f309e4500c30da6b4ee8b9 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Sat, 5 Dec 2015 13:21:54 -0500 Subject: [PATCH] Remore unused New New Wizard This code is not used and hasn't been touched since 2012. Now it can be referred as the "old new new wizard". Change-Id: Iccc60651a8233a5ef5b138dfcc334cfcf926d109 Signed-off-by: Marc-Andre Laperle --- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 4 +- .../plugin.xml | 23 -- .../org.eclipse.cdt.managedbuilder.ui/pom.xml | 2 +- .../managedbuilder/internal/ui/Messages.java | 2 - .../internal/ui/Messages.properties | 3 - .../ui/wizards/ToolChainSelectionPage.java | 100 ------ core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF | 2 +- core/org.eclipse.cdt.ui/plugin.properties | 4 - core/org.eclipse.cdt.ui/plugin.xml | 12 - core/org.eclipse.cdt.ui/pom.xml | 2 +- .../schema/projectTypePages.exsd | 80 ----- .../eclipse/cdt/internal/ui/CUIMessages.java | 7 - .../cdt/internal/ui/CUIMessages.properties | 10 +- .../cdt/ui/wizards/NewCDTProjectWizard.java | 92 ----- .../cdt/ui/wizards/ProjectTypePage.java | 33 -- .../cdt/ui/wizards/TemplateSelectionPage.java | 337 ------------------ .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- 20 files changed, 10 insertions(+), 711 deletions(-) mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties delete mode 100644 build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java mode change 100755 => 100644 core/org.eclipse.cdt.ui/plugin.properties delete mode 100644 core/org.eclipse.cdt.ui/schema/projectTypePages.exsd delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java diff --git a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF index 04613e4262c..8b62ac883f9 100644 --- a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF @@ -29,7 +29,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", - org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)", + org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", org.eclipse.cdt.make.core;bundle-version="[7.0.0,8.1.0)", org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", diff --git a/build/org.eclipse.cdt.managedbuilder.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.ui/META-INF/MANIFEST.MF index f489d38be0f..203fb1c4c9e 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.managedbuilder.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui; singleton:=true -Bundle-Version: 8.2.2.qualifier +Bundle-Version: 9.0.0.qualifier Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", org.eclipse.cdt.make.core, org.eclipse.cdt.make.ui, org.eclipse.cdt.managedbuilder.core;bundle-version="[8.1.0,9.0.0)", - org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)", + org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.ui.console;bundle-version="[3.5.100,4.0.0)", org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index abc9c5e2b28..9f9adfb4a21 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -844,29 +844,6 @@ - - - - - - - - - - ../../pom.xml - 8.2.2-SNAPSHOT + 9.0.0-SNAPSHOT org.eclipse.cdt.managedbuilder.ui eclipse-plugin diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java index 90b13c31564..d20f4f40e5b 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java @@ -278,8 +278,6 @@ public class Messages extends NLS { public static String WizardDefaultsTab_0; public static String WizardDefaultsTab_1; public static String RefreshPolicyTab_resourcesTreeLabel; - public static String ToolChainSelectionPage_Description; - public static String ToolChainSelectionPage_Title; static { // Initialize resource bundle. diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties old mode 100755 new mode 100644 index b7e3f6f550f..a4b640700ef --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties @@ -288,9 +288,6 @@ NewCfgDialog_3=-- not selected -- NewCfgDialog_4=Import from projects NewCfgDialog_5=Import predefined -ToolChainSelectionPage_Description=Select the initial toolchain for this project. -ToolChainSelectionPage_Title=Select Tool Chain - # Language Settings Providers BuiltinSpecsDetectorOptionPage_AllocateConsole=Allocate console in the Console View BuiltinSpecsDetectorOptionPage_Browse=Browse... diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java deleted file mode 100644 index 5c0079ff92c..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Doug Schaefer 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.ui.wizards; - -import org.eclipse.cdt.managedbuilder.core.IToolChain; -import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.cdt.managedbuilder.internal.ui.Messages; -import org.eclipse.cdt.ui.templateengine.Template; -import org.eclipse.cdt.ui.wizards.ProjectTypePage; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.List; - -/** - * @since 8.1 - * - */ -public class ToolChainSelectionPage extends WizardPage implements ProjectTypePage { - - private IWizardPage nextPage; - private String[] toolChainIds; - private String selectedToolChainId; - private List toolChainList; - - public ToolChainSelectionPage() { - super("ToolChainSelectionPage"); //$NON-NLS-1$ - setTitle(Messages.ToolChainSelectionPage_Title); - setDescription(Messages.ToolChainSelectionPage_Description); - } - - @Override - public void createControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - comp.setLayout(new GridLayout(1, true)); - - toolChainList = new List(comp, SWT.BORDER | SWT.SINGLE); - toolChainList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - for (String toolChainId : toolChainIds) { - IToolChain toolChain = ManagedBuildManager.getExtensionToolChain(toolChainId); - if (toolChain != null) - toolChainList.add(toolChain.getName()); - } - - toolChainList.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent e) { - if (toolChainList.getSelectionCount() == 0) - selectedToolChainId = null; - else - selectedToolChainId = toolChainIds[toolChainList.getSelectionIndex()]; - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - }); - - setControl(comp); - } - - @Override - public boolean init(Template template, IWizard wizard, IWizardPage nextPage) { - this.nextPage = nextPage; - setWizard(wizard); - toolChainIds = template.getTemplateInfo().getToolChainIds(); - - // only need this page if there are multiple toolChains to select from. - return toolChainIds != null && toolChainIds.length > 1; - } - - @Override - public IWizardPage getNextPage() { - if (nextPage != null) - return nextPage; - return super.getNextPage(); - } - - @Override - public boolean isPageComplete() { - return selectedToolChainId != null; - } - -} diff --git a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF index f56f421f0c1..c235b6036f4 100644 --- a/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true -Bundle-Version: 5.12.0.qualifier +Bundle-Version: 6.0.0.qualifier Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties old mode 100755 new mode 100644 index 97d518527ad..2d6978947e7 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -664,10 +664,6 @@ callHierarchyProviders.name = Call Hierarchy Providers externalSearchProviders.name = External Search Providers RefreshExclusionContributorExtensionPoint = Refresh Exclusion Contributor -# New New Project Wizard -newProjectWizard.name = C/C++ Project (prototype) -projectTypePages = Project Type Pages - semanticHighlightingExtensionPoint = Semantic Highlighting Extension Point UserSettingEntries.name = CDT User Setting Entries diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index d0ac8980278..930033961e3 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -30,7 +30,6 @@ - - diff --git a/core/org.eclipse.cdt.ui/pom.xml b/core/org.eclipse.cdt.ui/pom.xml index 3ed7481ec3e..9978bc4fa3f 100644 --- a/core/org.eclipse.cdt.ui/pom.xml +++ b/core/org.eclipse.cdt.ui/pom.xml @@ -11,7 +11,7 @@ ../../pom.xml - 5.12.0-SNAPSHOT + 6.0.0-SNAPSHOT org.eclipse.cdt.ui eclipse-plugin diff --git a/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd b/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd deleted file mode 100644 index 006828ce16e..00000000000 --- a/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - This extension is used to register a page in the CDT new project wizard to support -specifying additional information based on the project type associated with a template. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java index 94bb2de3581..0a9283d51c5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java @@ -71,13 +71,6 @@ public final class CUIMessages extends NLS { public static String FileTransferDragAdapter_refreshing; public static String FileTransferDragAdapter_problem; public static String FileTransferDragAdapter_problemTitle; - public static String NewCDTProjectWizard_mainPageDesc; - public static String NewCDTProjectWizard_mainPageTitle; - public static String NewCDTProjectWizard_refPageDesc; - public static String NewCDTProjectWizard_refPageTitle; - public static String NewCDTProjectWizard_templatePageDesc; - public static String NewCDTProjectWizard_templatePageTitle; - public static String NewCDTProjectWizard_windowTitle; public static String CUIPlugin_initPrefs; static { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties index 00705b5d30c..35f54d2a079 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties @@ -74,12 +74,4 @@ FileTransferDragAdapter_refreshing=Refreshing... FileTransferDragAdapter_problem=Problem while moving or copying files. FileTransferDragAdapter_problemTitle=Drag & Drop -NewCDTProjectWizard_mainPageDesc=Create a new C/C++ Project -NewCDTProjectWizard_mainPageTitle=Project -NewCDTProjectWizard_refPageDesc=Select referenced projects -NewCDTProjectWizard_refPageTitle=Project References -NewCDTProjectWizard_templatePageDesc=Select a project template for the new project -NewCDTProjectWizard_templatePageTitle=Project Template -NewCDTProjectWizard_windowTitle=New C/C++ Project - -CUIPlugin_initPrefs=Initialize C/C++ UI Preferences \ No newline at end of file +CUIPlugin_initPrefs=Initialize C/C++ UI Preferences diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java deleted file mode 100644 index df418029cc3..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.eclipse.cdt.ui.wizards; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; -import org.eclipse.ui.dialogs.WizardNewProjectReferencePage; - -import org.eclipse.cdt.internal.ui.CUIMessages; - -/** - * This is the new CDT project wizard. - * - * Without subclassing, it is in it's most generic form. - * - * Subclasses can filter or select the languages and add template filters. - * - * @author Doug Schaefer - * @since 5.4 - */ -public class NewCDTProjectWizard extends Wizard implements INewWizard { - - private IStructuredSelection selection; - private WizardNewProjectCreationPage mainPage; - private TemplateSelectionPage templatePage; - private WizardNewProjectReferencePage referencePage; - - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - setNeedsProgressMonitor(true); - setWindowTitle(CUIMessages.NewCDTProjectWizard_windowTitle); - } - - @Override - public boolean performFinish() { - return true; - } - - @Override - public void addPages() { - super.addPages(); - - mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$ - @Override - public void createControl(Composite parent) { - super.createControl(parent); - createWorkingSetGroup( - (Composite) getControl(), - selection, - new String[] { "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$ - "org.eclipse.cdt.ui.CElementWorkingSetPage" }); //$NON-NLS-1$ - Dialog.applyDialogFont(getControl()); - } - }; - mainPage.setTitle(CUIMessages.NewCDTProjectWizard_mainPageTitle); - mainPage.setDescription(CUIMessages.NewCDTProjectWizard_mainPageDesc); - addPage(mainPage); - - templatePage = new TemplateSelectionPage(); - templatePage.setTitle(CUIMessages.NewCDTProjectWizard_templatePageTitle); - templatePage.setDescription(CUIMessages.NewCDTProjectWizard_templatePageDesc); - addPage(templatePage); - - // only add page if there are already projects in the workspace - if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) { - referencePage = new WizardNewProjectReferencePage( - "basicReferenceProjectPage");//$NON-NLS-1$ - referencePage.setTitle(CUIMessages.NewCDTProjectWizard_refPageTitle); - referencePage - .setDescription(CUIMessages.NewCDTProjectWizard_refPageDesc); - this.addPage(referencePage); - } - } - - @Override - public boolean canFinish() { - IWizardPage page = mainPage; - while (page != null) { - if (!page.isPageComplete()) - return false; - page = page.getNextPage(); - } - return true; - } - -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java deleted file mode 100644 index ad5eae3b08d..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Doug Schaefer 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.wizards; - -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; - -import org.eclipse.cdt.ui.templateengine.Template; - -/** - * @since 5.4 - */ -public interface ProjectTypePage extends IWizardPage { - - /** - * Init the page. Return false if the page isn't needed. - * - * @param template The selected template - * @param wizard The wizard object - * @param nextPage The next page after this one - * @return whether page is really needed - */ - boolean init(Template template, IWizard wizard, IWizardPage nextPage); - -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java deleted file mode 100644 index 2608bce5a5d..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River Systems 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.ui.wizards; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.cdt.core.templateengine.TemplateCategory; -import org.eclipse.cdt.core.templateengine.TemplateEngine2; -import org.eclipse.cdt.core.templateengine.TemplateInfo2; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.templateengine.Template; -import org.eclipse.cdt.ui.templateengine.TemplateEngineUI; - -/** - * @author Doug Schaefer - * @since 5.4 - */ -public class TemplateSelectionPage extends WizardPage { - - private static class Node { - private final Object object; - private final Node parent; - private final List children = new LinkedList(); - - public Node(Node parent, Object object) { - this.parent = parent; - this.object = object; - - if (parent != null) - parent.addChild(this); - } - - private void addChild(Node child) { - children.add(child); - } - - public Node getChild(Object child) { - for (Node childNode : children) - if (childNode.getObject().equals(child)) - return childNode; - return null; - } - - public Object getObject() { - return object; - } - - public Node getParent() { - return parent; - } - - public List getChildren() { - return children; - } - } - - private static Node tree; - - private final TemplateEngine2 coreEngine = TemplateEngine2.getDefault(); - private final TemplateEngineUI uiEngine = TemplateEngineUI.getDefault(); - - private TreeViewer templateTree; - private Template selectedTemplate; - private IWizardPage nextPage; - - public TemplateSelectionPage() { - super("templateSelection"); //$NON-NLS-1$ - } - - @Override - public void createControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - comp.setLayout(new GridLayout(1, false)); - - templateTree = new TreeViewer(comp); - templateTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - templateTree.setContentProvider(new ITreeContentProvider() { - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - @Override - public void dispose() { - } - - @Override - public boolean hasChildren(Object element) { - if (element instanceof Node) - return !((Node)element).getChildren().isEmpty(); - return false; - } - - @Override - public Object getParent(Object element) { - if (element instanceof Node) - return ((Node)element).getParent(); - return null; - } - - @Override - public Object[] getElements(Object inputElement) { - if (inputElement instanceof Node) - return ((Node)inputElement).getChildren().toArray(); - return null; - } - - @Override - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof Node) - return ((Node)parentElement).getChildren().toArray(); - return null; - } - }); - templateTree.setLabelProvider(new ILabelProvider() { - @Override - public void removeListener(ILabelProviderListener listener) { - } - - @Override - public boolean isLabelProperty(Object element, String property) { - return false; - } - - @Override - public void dispose() { - } - - @Override - public void addListener(ILabelProviderListener listener) { - } - - @Override - public String getText(Object element) { - if (element instanceof Node) { - Object object = ((Node)element).getObject(); - if (object instanceof TemplateCategory) - return ((TemplateCategory)object).getLabel(); - else if (object instanceof Template) - return ((Template)object).getLabel(); - } - return element.toString(); - } - - @Override - public Image getImage(Object element) { - return null; - } - }); - templateTree.addSelectionChangedListener(new ISelectionChangedListener() { - @Override - public void selectionChanged(SelectionChangedEvent event) { - selectedTemplate = null; - nextPage = null; - IStructuredSelection selection = (IStructuredSelection)templateTree.getSelection(); - Object selObj = selection.getFirstElement(); - if (selObj instanceof Node) { - Object object = ((Node)selObj).getObject(); - if (object instanceof Template) { - IWizard wizard = getWizard(); - selectedTemplate = (Template)object; - - // Get the template pages - IWizardPage[] templatePages = selectedTemplate.getTemplateWizardPages(TemplateSelectionPage.this, - wizard.getNextPage(TemplateSelectionPage.this), wizard); - if (templatePages != null && templatePages.length > 0) - nextPage = templatePages[0]; - - String projectType = selectedTemplate.getTemplateInfo().getProjectType(); - ProjectTypePage projectTypePage = getProjectTypePage(projectType); - if (projectTypePage != null) { - if (projectTypePage.init(selectedTemplate, wizard, nextPage)) - nextPage = projectTypePage; - } - setPageComplete(true); - } else { - setPageComplete(false); - } - } else { - setPageComplete(false); - } - } - }); - buildTree(); - templateTree.setInput(tree); - - setControl(comp); - } - - public Template getSelectedTemplate() { - return selectedTemplate; - } - - @Override - public boolean isPageComplete() { - return selectedTemplate != null; - } - - @Override - public IWizardPage getNextPage() { - if (nextPage != null) - return nextPage; - return super.getNextPage(); - } - - private void buildTree() { - if (tree != null) - return; - tree = new Node(null, null); - - Template[] templates = uiEngine.getTemplates(); - for (Template template : templates) { - List parentCategoryIds = ((TemplateInfo2)template.getTemplateInfo()).getParentCategoryIds(); - boolean inTree = false; - if (!parentCategoryIds.isEmpty()) { - for (String parentCategoryId : parentCategoryIds) { - List parents = getParents(parentCategoryId); - if (!parents.isEmpty()) { - for (Node parent : parents) - new Node(parent, template); - inTree = true; - } - } - } - - if (!inTree) { - // no parents - new Node(tree, template); - } - } - } - - private List getParents(String parentCategoryId) { - List nodes = new LinkedList(); - - TemplateCategory category = coreEngine.getCategory(parentCategoryId); - if (category == null) { - // undefined, log it - CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, "Undefined parent category " + parentCategoryId)); //$NON-NLS-1$ - return nodes; - } - - // Hook me up to my parents - List parentCategoryIds = category.getParentCategoryIds(); - boolean inTree = false; - if (!parentCategoryIds.isEmpty()) { - for (String myParentId : parentCategoryIds) { - List parents = getParents(myParentId); - if (!parents.isEmpty()) { - for (Node parent : parents) { - Node node = parent.getChild(category); - if (node == null) - nodes.add(new Node(parent, category)); - else - nodes.add(node); - } - inTree = true; - } - } - } - - if (!inTree) { - // parents not found, I'm an orphan - Node node = tree.getChild(category); - if (node == null) - nodes.add(new Node(tree, category)); - else - nodes.add(node); - } - - return nodes; - } - - private ProjectTypePage getProjectTypePage(String projectType) { - if (projectType != null && !projectType.isEmpty()) { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IExtensionPoint point = reg.getExtensionPoint(CUIPlugin.PLUGIN_ID, "projectTypePages"); //$NON-NLS-1$ - if (point == null) - return null; - IExtension[] exts = point.getExtensions(); - for (IExtension ext : exts) { - IConfigurationElement[] elems = ext.getConfigurationElements(); - for (IConfigurationElement elem : elems) { - if (elem.getName().equals("projectTypePage")) { //$NON-NLS-1$ - String ept = elem.getAttribute("projectType"); //$NON-NLS-1$ - if (projectType.equals(ept)) { - try { - Object obj = elem.createExecutableExtension("class"); //$NON-NLS-1$ - if (obj instanceof ProjectTypePage) - return (ProjectTypePage)obj; - } catch (CoreException e) { - CUIPlugin.log(e.getStatus()); - } - } - } - } - } - } - - return null; - } - -} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF index 833fa549fe6..ba14e482c88 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.mi.ui/META-INF/MANIFEST.MF @@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.1.0)", org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", - org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)", + org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF index a025b9ec0ef..46be539dd18 100644 --- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF @@ -50,7 +50,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", org.eclipse.debug.ui;bundle-version="[3.7.0,4.0.0)", org.eclipse.debug.core;bundle-version="[3.7.0,4.0.0)", org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)", - org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)", + org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)", diff --git a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF index 8b07f2db46f..e036518bbd5 100644 --- a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF +++ b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)", - org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)", + org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)", org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)", org.eclipse.cdt.debug.ui;bundle-version="[7.0.0,8.1.0)", org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",