mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
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>
This commit is contained in:
parent
1c258538de
commit
c29c9bc057
3 changed files with 24 additions and 26 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue