From 179924ef5c78c72e0465ff6fe3baff0acdee00e9 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 29 Mar 2012 17:37:48 -0400 Subject: [PATCH] Bug 374026 - [autotools] unable to extend the autotools toolchain - fix createItems method in AutotoolsBuildWizard to accept any project type that has a toolchain that is based upon [GNU Autotools] --- build/org.eclipse.cdt.autotools.ui/ChangeLog | 6 ++ .../ui/wizards/AutotoolsBuildWizard.java | 60 ++++++++++++------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.ui/ChangeLog b/build/org.eclipse.cdt.autotools.ui/ChangeLog index 3a19b166803..b54ca73364c 100644 --- a/build/org.eclipse.cdt.autotools.ui/ChangeLog +++ b/build/org.eclipse.cdt.autotools.ui/ChangeLog @@ -1,3 +1,9 @@ +2012-03-29 Jeff Johnston + + Resolves: bug#374026 + * src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java (createItems): Change to accept any + type of project that has at least one toolchain that is based upon the GNU Autotools toolchain. + 2012-01-03 Jeff Johnston Refactor entire plug-in to org.eclipse.cdt.autotools.ui. diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java index 838f61ca487..60de20c70a4 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java @@ -40,6 +40,8 @@ public class AutotoolsBuildWizard extends AbstractCWizard { * @since 5.1 */ public static final String EMPTY_PROJECT = AutotoolsWizardMessages.getResourceString("AutotoolsBuildWizard.2"); //$NON-NLS-1$ + public static final String AUTOTOOLS_TOOLCHAIN_ID = "org.eclipse.linuxtools.cdt.autotools.core.toolChain"; //$NON-NLS-1$ + /** * Creates and returns an array of items to be displayed */ @@ -49,38 +51,50 @@ public class AutotoolsBuildWizard extends AbstractCWizard { IBuildPropertyValue[] vs = bpt.getSupportedValues(); Arrays.sort(vs, BuildListComparator.getInstance()); ArrayList items = new ArrayList(); - - // look for Autotools project type + + // look for project types that have a toolchain based on the Autotools toolchain + // and if so, add an entry for the project type. + // Fix for bug#374026 EntryDescriptor oldsRoot = null; SortedMap sm = ManagedBuildManager.getExtensionProjectTypeMap(); for (Map.Entry e : sm.entrySet()) { IProjectType pt = e.getValue(); - if (pt.getId().equals(AUTOTOOLS_PROJECTTYPE_ID)) { - AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard); - IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt); - for(int i = 0; i < tcs.length; i++){ - IToolChain t = tcs[i]; - if(t.isSystemObject()) - continue; - if (!isValid(t, supportedOnly, wizard)) - continue; + AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard); + IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt); + for(int i = 0; i < tcs.length; i++){ + IToolChain t = tcs[i]; - h.addTc(t); + IToolChain parent = t; + while (parent.getSuperClass() != null) { + parent = parent.getSuperClass(); } - String pId = null; - if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) { - if (oldsRoot == null) { - oldsRoot = new EntryDescriptor(OTHERS_LABEL, null, OTHERS_LABEL, true, null, null); - items.add(oldsRoot); - } - pId = oldsRoot.getId(); - } else { // do not group to - pId = null; - } - items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, null)); + if (!parent.getId().equals(AUTOTOOLS_TOOLCHAIN_ID)) + continue; + + if(t.isSystemObject()) + continue; + if (!isValid(t, supportedOnly, wizard)) + continue; + + h.addTc(t); } + + String pId = null; + if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) { + if (oldsRoot == null) { + oldsRoot = new EntryDescriptor(OTHERS_LABEL, null, OTHERS_LABEL, true, null, null); + items.add(oldsRoot); + } + pId = oldsRoot.getId(); + } else { // do not group to + pId = null; + } + + if (h.getToolChainsCount() > 0) + items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, null)); } + return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]); } }