blob: 8ddd744ecbf51439a76456768b95c4a940bd6c41 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
package org.eclipse.cdt.ui.wizards.conversion;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.internal.ui.CPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/**
*
* ConvertCtoCCStdMakeProjectWizardPage
* Standard main page for a wizard that converts a project's nature from C to C++.
* This conversion is one way in that the project cannot be converted back from a C++ project to a C project.
*
* @author Judy N. Green
* @since Aug 6, 2002
*<p>
* Example useage:
* <pre>
* mainPage = new ConvertCtoCCStdMakeProjectWizardPage("CtoCCConvertProjectPage");
* mainPage.setTitle("Project Conversion");
* mainPage.setDescription("Convert a project's nature from C to C++.");
* </pre>
* </p>
*/
public class ConvertCtoCCStdMakeProjectWizardPage extends ConvertProjectWizardPage {
private static final String WZ_TITLE = "CtoCCConversionWizard.title"; //$NON-NLS-1$
private static final String WZ_DESC = "CtoCCConversionWizard.description"; //$NON-NLS-1$
/**
* Constructor for ConvertCtoCCStdMakeProjectWizardPage.
* @param pageName
*/
public ConvertCtoCCStdMakeProjectWizardPage(String pageName) {
super(pageName);
}
/**
* Method getWzTitleResource returns the correct Title Label for this class
* overriding the default in the superclass.
*/
protected String getWzTitleResource(){
return CPlugin.getResourceString(WZ_TITLE);
}
/**
* Method getWzDescriptionResource returns the correct description
* Label for this class overriding the default in the superclass.
*/
protected String getWzDescriptionResource(){
return CPlugin.getResourceString(WZ_DESC);
}
/**
* Method isCandidate returns projects that have
* a "C" Nature but do not have a "C++" Nature
*
* @param project
* @return boolean
*/
protected boolean isCandidate(IProject project) {
if (project.isOpen()) {
try {
if (project.hasNature(CoreModel.C_NATURE_ID)
&& !project.hasNature(CoreModel.CC_NATURE_ID))
return true;
} catch (CoreException e) {
CPlugin.log(e);
}
}
return false;
}
/**
* Method convertProject adds a C++ Nature to those projects
* that were selected by the user.
*
* @param project
* @param monitor
* @param projectID
* @throws CoreException
*/
public void convertProject(IProject project, IProgressMonitor monitor, String projectID)
throws CoreException {
CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor, projectID);
}
}
|