summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Dushistova2012-05-01 19:17:42 (EDT)
committerDoug Schaefer2012-05-04 10:03:05 (EDT)
commit27d49dfd542d0a9b241790c30a01418c8316c339 (patch)
treee7a1d5652fb82cb7f38c20d6e3bac0ea378577f8
parenta2cfb6e5cd7eacc5415d74e5ccf29f36fc6c7037 (diff)
downloadorg.eclipse.cdt-27d49dfd542d0a9b241790c30a01418c8316c339.zip
org.eclipse.cdt-27d49dfd542d0a9b241790c30a01418c8316c339.tar.gz
org.eclipse.cdt-27d49dfd542d0a9b241790c30a01418c8316c339.tar.bz2
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>
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java20
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetAction.java27
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetDialog.java39
3 files changed, 81 insertions, 5 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
index 590ce24..7ce7087 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
@@ -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;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetAction.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetAction.java
index fbc2ef7..89a70ee 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetAction.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetAction.java
@@ -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,
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetDialog.java
index dbc97ae..e5de8c8 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/actions/ConvertTargetDialog.java
@@ -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);
- conversionElements = ManagedBuildManager.getConversionElements(getProjectType());
+ 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;
+ }
+
}