mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for bug 366771
Change-Id: Ib95c2b9c475f25196d1c399d65b12c715f8e5e1e Reviewed-on: https://git.eclipse.org/r/5778 Reviewed-by: Doug Schaefer <dschaefer@qnx.com> IP-Clean: Doug Schaefer <dschaefer@qnx.com> Tested-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
a2cfb6e5cd
commit
27d49dfd54
3 changed files with 81 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2003, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2003, 2012 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Anna Dushistova (MontaVista) - [366771]Converter fails to convert a CDT makefile project
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.core;
|
||||
|
||||
|
@ -4746,4 +4747,21 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic routine for checking the availability of converters for the given list of Build Objects.
|
||||
*
|
||||
* @return true if there are converters for at least one object in the given list of Build Objects.
|
||||
* Returns false if there are no converters.
|
||||
* @since 8.1
|
||||
*/
|
||||
public static boolean hasAnyTargetConversionElements(List<IBuildObject> buildObjs) {
|
||||
if (buildObjs != null && !buildObjs.isEmpty()) {
|
||||
for (IBuildObject obj : buildObjs) {
|
||||
if (hasTargetConversionElements(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2010 Intel Corporation and others.
|
||||
* Copyright (c) 2005, 2012 Intel 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
|
||||
|
@ -7,12 +7,18 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
* Anna Dushistova (MontaVista) - [366771]Converter fails to convert a CDT makefile project
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||
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.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||
|
@ -69,6 +75,22 @@ public class ConvertTargetAction
|
|||
return projectType;
|
||||
}
|
||||
|
||||
private Vector<IBuildObject> getProjectToolchains(IProject project) {
|
||||
Vector<IBuildObject> projectToolchains = new Vector<IBuildObject>();
|
||||
|
||||
// Get the projectType from project.
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||
if (info != null) {
|
||||
IConfiguration[] configs = info.getManagedProject().getConfigurations();
|
||||
for (IConfiguration config : configs) {
|
||||
IToolChain tc = config.getToolChain();
|
||||
if (tc != null) {
|
||||
projectToolchains.add(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return projectToolchains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
|
@ -77,7 +99,8 @@ public class ConvertTargetAction
|
|||
// Check whether the converters available for the selected project
|
||||
// If there are no converters display error dialog otherwise display converters list
|
||||
|
||||
if( ManagedBuildManager.hasTargetConversionElements(getProjectType(getSelectedProject())) == true ) {
|
||||
if( ManagedBuildManager.hasTargetConversionElements(getProjectType(getSelectedProject())) == true ||
|
||||
ManagedBuildManager.hasAnyTargetConversionElements(getProjectToolchains(getSelectedProject()))) {
|
||||
handleConvertTargetAction();
|
||||
} else {
|
||||
MessageDialog.openError(shell,Messages.ConvertTargetAction_No_Converter,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2010 Intel Corporation and others.
|
||||
* Copyright (c) 2005, 2012 Intel 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
|
||||
|
@ -7,16 +7,21 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
* Anna Dushistova (MontaVista) - [366771]Converter fails to convert a CDT makefile project
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||
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.core.resources.IProject;
|
||||
|
@ -61,7 +66,19 @@ public class ConvertTargetDialog extends Dialog {
|
|||
this.title = title;
|
||||
setProject(project);
|
||||
|
||||
if (getProjectType() != null) {
|
||||
conversionElements = ManagedBuildManager.getConversionElements(getProjectType());
|
||||
}
|
||||
for (IBuildObject tc : getProjectToolchains()) {
|
||||
Map<String, IConfigurationElement> converters = ManagedBuildManager.getConversionElements(tc);
|
||||
if (converters != null) {
|
||||
if (conversionElements == null) {
|
||||
conversionElements = converters;
|
||||
} else {
|
||||
conversionElements.putAll(converters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setShellStyle(getShellStyle()|SWT.RESIZE);
|
||||
}
|
||||
|
@ -222,5 +239,23 @@ public class ConvertTargetDialog extends Dialog {
|
|||
public void setConversionSuccessful(boolean isConversionSuccessful) {
|
||||
ConvertTargetDialog.isConversionSuccessful = isConversionSuccessful;
|
||||
}
|
||||
|
||||
private Vector<IBuildObject> getProjectToolchains() {
|
||||
Vector<IBuildObject> projectToolchains = new Vector<IBuildObject>();
|
||||
|
||||
// Get the projectType from project.
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
|
||||
if (info != null) {
|
||||
IConfiguration[] configs = info.getManagedProject().getConfigurations();
|
||||
for (IConfiguration config : configs) {
|
||||
IToolChain tc = config.getToolChain();
|
||||
if (tc != null) {
|
||||
projectToolchains.add(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return projectToolchains;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue