Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2015-02-21 22:58:25 -0500
committerMarc-Andre2015-12-28 13:43:42 -0500
commitc29c9bc0579a955d20a98bc3b477ee53998e99d8 (patch)
tree81223d796052ba9d22c65fd05dcbaa0276bdef5a
parent1c258538dee14f70d9f309e4500c30da6b4ee8b9 (diff)
downloadorg.eclipse.cdt-c29c9bc0579a955d20a98bc3b477ee53998e99d8.tar.gz
org.eclipse.cdt-c29c9bc0579a955d20a98bc3b477ee53998e99d8.tar.xz
org.eclipse.cdt-c29c9bc0579a955d20a98bc3b477ee53998e99d8.zip
Bug 382746 - Adding C/C++ nature for C Project impossible
This patch modifies the wizard so that the C projects also show in the list of projects. - If a given C project is selected and the C nature is selected, the project is not modified. - If a given C project is selected and the C++ nature is selected, the C++ nature is added and project type and toolchain selection have no effect because it is assumed that the project type and toolchain had already been setup before hand. - Old-style projects (CDT 3.0) are not converted anymore. Unchanged behavior: - C++ projects never show in the list of projects. Removing nature is (still) unsupported. - Non-CDT project behave as they use to. Change-Id: Ie6282c11d90c42d21ecad2996ab49ebd64c38ece Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/plugin.xml2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConvertToMakeWizardPage.java44
3 files changed, 24 insertions, 26 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
index a0ff29806d..e06330b470 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2010 QNX Software Systems and others.
+# Copyright (c) 2003, 2015 QNX Software 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
@@ -46,7 +46,7 @@ MakeCCWizardSettings.title=C++/Make Project Settings
MakeCCWizardSettings.description=Define the project and 'make' builder settings
WizardMakeProjectConversion.title=Convert to a C/C++ project
-WizardMakeProjectConversion.description=The wizard adds C/C++ Nature to the selected projects to enable C/C++ Tools Support for them. It also converts old-style C/C++ projects to the new style.
+WizardMakeProjectConversion.description=The wizard adds C/C++ Nature to the selected projects to enable C/C++ Tools Support for them.
WizardMakeProjectConversion.monitor.convertingToMakeProject=Converting to C/C++ Project...
WizardMakeProjectConversion.projectOptions.title=Project options
WizardMakeProjectConversion.projectOptions.projectType=Specify project type
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
index 9f9adfb4a2..39299a9a31 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
@@ -351,7 +351,7 @@
<adapt type="org.eclipse.core.resources.IProject" >
<test
property="org.eclipse.core.resources.projectNature"
- value="org.eclipse.cdt.core.cnature"/>
+ value="org.eclipse.cdt.core.ccnature"/>
</adapt>
</not>
</and>
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConvertToMakeWizardPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConvertToMakeWizardPage.java
index df45066bfd..56f682d93f 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConvertToMakeWizardPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConvertToMakeWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 QNX Software Systems and others.
+ * Copyright (c) 2000, 2015 QNX Software 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
@@ -9,6 +9,7 @@
* QNX Software Systems - Initial API and implementation
* Intel corporation - customization for New Project model.
* Marc-Andre Laperle (Ericsson) - Bug 394492 Project options not visible
+ * Marc-Andre Laperle (Ericsson) - Bug 382746 Add C++ nature to C Project
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
@@ -16,8 +17,8 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.ui.newui.AbstractPage;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.cdt.ui.newui.PageLayout;
@@ -250,29 +251,29 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
/**
* Method isCandidate returns true for:
* - non-CDT projects
- * - old style Make CDT projects
- * So new model projects and
- * old style managed projects
- * are refused.
+ * - C projects, to be potentially converted to C++
*/
@Override
public boolean isCandidate(IProject project) {
- boolean a = !AbstractPage.isCDTPrj(project);
- boolean b = ManagedBuilderCorePlugin.getDefault().isOldStyleMakeProject(project);
- return a || b;
+ boolean isCDTProject = AbstractPage.isCDTPrj(project);
+ boolean cOnly = false;
+ try {
+ cOnly = !project.hasNature(CCProjectNature.CC_NATURE_ID);
+ } catch (CoreException e) {
+ // If the project doesn't exist or is not open, it cannot be converted
+ return false;
+ }
+ return !isCDTProject || cOnly;
}
@Override
public void convertProject(IProject project, String bsId, IProgressMonitor monitor) throws CoreException{
monitor.beginTask(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 3); //$NON-NLS-1$
try {
- if (ManagedBuilderCorePlugin.getDefault().isOldStyleMakeProject(project)) {
- ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
- } else {
- super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1));
- if (isSetProjectType()) {
- h_selected.convertProject(project, monitor);
- }
+ boolean wasCDTProject = AbstractPage.isCDTPrj(project);
+ super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1));
+ if (!wasCDTProject && isSetProjectType()) {
+ h_selected.convertProject(project, monitor);
}
} finally {
monitor.done();
@@ -283,13 +284,10 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
monitor.beginTask(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 3); //$NON-NLS-1$
try {
- if (ManagedBuilderCorePlugin.getDefault().isOldStyleMakeProject(project)) {
- ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
- } else {
- super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
- if (isSetProjectType()) {
- h_selected.convertProject(project, monitor);
- }
+ boolean wasCDTProject = AbstractPage.isCDTPrj(project);
+ super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
+ if (!wasCDTProject && isSetProjectType()) {
+ h_selected.convertProject(project, monitor);
}
} finally {
monitor.done();

Back to the top