1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

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]
This commit is contained in:
Jeff Johnston 2012-03-29 17:37:48 -04:00
parent 90ecfa9d5e
commit 179924ef5c
2 changed files with 43 additions and 23 deletions

View file

@ -1,3 +1,9 @@
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
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 <jjohnstn@redhat.com> 2012-01-03 Jeff Johnston <jjohnstn@redhat.com>
Refactor entire plug-in to org.eclipse.cdt.autotools.ui. Refactor entire plug-in to org.eclipse.cdt.autotools.ui.

View file

@ -40,6 +40,8 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
* @since 5.1 * @since 5.1
*/ */
public static final String EMPTY_PROJECT = AutotoolsWizardMessages.getResourceString("AutotoolsBuildWizard.2"); //$NON-NLS-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 * Creates and returns an array of items to be displayed
*/ */
@ -49,38 +51,50 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
IBuildPropertyValue[] vs = bpt.getSupportedValues(); IBuildPropertyValue[] vs = bpt.getSupportedValues();
Arrays.sort(vs, BuildListComparator.getInstance()); Arrays.sort(vs, BuildListComparator.getInstance());
ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>(); ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
// 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; EntryDescriptor oldsRoot = null;
SortedMap<String, IProjectType> sm = ManagedBuildManager.getExtensionProjectTypeMap(); SortedMap<String, IProjectType> sm = ManagedBuildManager.getExtensionProjectTypeMap();
for (Map.Entry<String, IProjectType> e : sm.entrySet()) { for (Map.Entry<String, IProjectType> e : sm.entrySet()) {
IProjectType pt = e.getValue(); IProjectType pt = e.getValue();
if (pt.getId().equals(AUTOTOOLS_PROJECTTYPE_ID)) { AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard);
AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard); IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt);
IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt); for(int i = 0; i < tcs.length; i++){
for(int i = 0; i < tcs.length; i++){ IToolChain t = tcs[i];
IToolChain t = tcs[i];
if(t.isSystemObject())
continue;
if (!isValid(t, supportedOnly, wizard))
continue;
h.addTc(t); IToolChain parent = t;
while (parent.getSuperClass() != null) {
parent = parent.getSuperClass();
} }
String pId = null; if (!parent.getId().equals(AUTOTOOLS_TOOLCHAIN_ID))
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) { continue;
if (oldsRoot == null) {
oldsRoot = new EntryDescriptor(OTHERS_LABEL, null, OTHERS_LABEL, true, null, null); if(t.isSystemObject())
items.add(oldsRoot); continue;
} if (!isValid(t, supportedOnly, wizard))
pId = oldsRoot.getId(); continue;
} else { // do not group to <Others>
pId = null; h.addTc(t);
}
items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, null));
} }
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 <Others>
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()]); return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]);
} }
} }