diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 956f768428f..fd4b8c797aa 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,21 @@
+
+2002-11-13 Judy Green
+
+ *src/org/eclipse/cdt/core/CCProjectNature.java
+ added configure() to overwrite CNatures implementation which adds a default CBuilder.
+ We now check that a project having a CCNature added already has a CNature
+ Throws a CoreException if not.
+
+ *src/org/eclipse/cdt/core/CCorePlugin.java
+ Added a static va CDT_PROJECT_NATURE_ID_MISMATCH to indicate the condition
+ described above in configure()
+
+ Cleaned up the convert methods to ensure that extra calls to add a
+ CBuilder are not called.
+
+
+
+
2002-11-13 Alain Magloire
* src/.../internal/core/CBuilder.java (invokeMake):
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
index 0c183e37bf2..b8d73394a01 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java
@@ -8,6 +8,8 @@ package org.eclipse.cdt.core;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
@@ -22,5 +24,20 @@ public class CCProjectNature extends CProjectNature {
public static void removeCCNature(IProject project, IProgressMonitor mon) throws CoreException {
removeNature(project, CC_NATURE_ID, mon);
}
+
+ /**
+ * Checks to ensure that a cnature already exists,
+ * if not throw a CoreException. Does NOT add a default builder
+ * @see IProjectNature#configure
+ */
+ public void configure() throws CoreException {
+ if (!getProject().hasNature(CProjectNature.C_NATURE_ID)){
+ IStatus status = new Status(IStatus.ERROR,
+ CCorePlugin.PLUGIN_ID,
+ CCorePlugin.CDT_PROJECT_NATURE_ID_MISMATCH,
+ "project must have a cnature", null); // $NON_NLS
+ throw new CoreException(status);
+ }
+ }
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index f82ddf75664..869b49bc0a7 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -36,6 +36,7 @@ public class CCorePlugin extends Plugin {
public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
+ public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
public static final String PLUGIN_ID= "org.eclipse.cdt.core";
@@ -218,41 +219,19 @@ public class CCorePlugin extends Plugin {
*
* @param projectHandle
* @param monitor
- * @param projectID
* @throws CoreException
*/
- public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor, String projectID)
+ public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor)
throws CoreException{
if ((projectHandle != null)
&& projectHandle.hasNature(CCProjectNature.C_NATURE_ID)
&& !projectHandle.hasNature(CCProjectNature.CC_NATURE_ID)) {
// Add C++ Nature ... does not add duplicates
CCProjectNature.addCCNature(projectHandle, monitor);
-
- if(projectID != null){
- mapCProjectOwner(projectHandle, projectID);
- }
}
}
- /**
- * Method convertProjectFromCtoCC converts
- * a C Project to a C++ Project
- * The newProject MUST, not be null, already have a C Nature
- * && must NOT already have a C++ Nature
- * This method does not map the project to an owner and should only
- * be used when this mapping has already taken place.
- *
- * @param projectHandle
- * @param monitor
- * @throws CoreException
- */
-
- public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor)
- throws CoreException{
-
- convertProjectFromCtoCC(projectHandle, monitor, null);
- }
+
/**
* Method addDefaultCBuilder adds the default C make builder
* @param projectHandle
@@ -264,10 +243,10 @@ public class CCorePlugin extends Plugin {
// Set the Default C Builder.
CProjectNature.addCBuildSpec(projectHandle, monitor);
}
-
+
/**
* Method to convert a project to a C nature
- * & default make builder
+ * & default make builder (Will always add a default builder)
* All checks should have been done externally
* (as in the Conversion Wizards).
* This method blindly does the conversion.
@@ -280,6 +259,26 @@ public class CCorePlugin extends Plugin {
*/
public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
+ throws CoreException{
+ this.convertProjectToC(projectHandle, monitor, projectID, true);
+
+ }
+ /**
+ * Method to convert a project to a C nature
+ * & default make builder (if indicated)
+ * All checks should have been done externally
+ * (as in the Conversion Wizards).
+ * This method blindly does the conversion.
+ *
+ * @param project
+ * @param String targetNature
+ * @param monitor
+ * @param projectID
+ * @param addMakeBuilder
+ * @exception CoreException
+ */
+
+ public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID, boolean addMakeBuilder)
throws CoreException{
if ((projectHandle == null) || (monitor == null) || (projectID == null)){
return;
@@ -288,11 +287,38 @@ public class CCorePlugin extends Plugin {
IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
description.setLocation(projectHandle.getFullPath());
createCProject(description, projectHandle, monitor, projectID);
- addDefaultCBuilder(projectHandle, monitor);
+ if (addMakeBuilder) {
+ addDefaultCBuilder(projectHandle, monitor);
+ }
}
/**
* Method to convert a project to a C++ nature
- * & default make builder, if it does not have one already
+ * & default make builder(if indicated), if it does not have one already
+ *
+ * @param project
+ * @param String targetNature
+ * @param monitor
+ * @param projectID
+ * @param addMakeBuilder
+ * @exception CoreException
+ */
+
+ public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID, boolean addMakeBuilder)
+ throws CoreException{
+ if ((projectHandle == null) || (monitor == null) || (projectID == null)){
+ return;
+ }
+ createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
+ // now add C++ nature
+ convertProjectFromCtoCC(projectHandle, monitor);
+ if (addMakeBuilder){
+ addDefaultCBuilder(projectHandle, monitor);
+ }
+ }
+ /**
+ * Method to convert a project to a C++ nature
+ * & default make builder,
+ * Note: Always adds the default Make builder
*
* @param project
* @param String targetNature
@@ -303,13 +329,7 @@ public class CCorePlugin extends Plugin {
public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID)
throws CoreException{
- if ((projectHandle == null) || (monitor == null) || (projectID == null)){
- return;
- }
- createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
- // now add C++ nature
- convertProjectFromCtoCC(projectHandle, monitor);
- addDefaultCBuilder(projectHandle, monitor);
+ this.convertProjectToCC(projectHandle, monitor, projectID, true);
}
public ICBuilder[] getBuilders(IProject project) throws CoreException {
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index 024db7adf3c..aaab4f13a0f 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,38 @@
+2002-11-13 Judy N. Green
+ */home/tools/org.eclipse.cdt.ui/plugin.properties
+ */home/tools/org.eclipse.cdt.ui/plugin.xml
+ updated labels & wizards to use combined conversion wizard
+
+ *src/org/eclipse/cdt/internal/ui/CPluginResources.properties
+ updated labels
+
+ *src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java
+ No longer add builder in run method. it is being added in enough other places
+
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java
+ updated reference to call combined conversion page
+
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java
+ Moved common c/c== conversion methods up to this shared class
+
+
+ Added:
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java
+ Combined the C/C++ conversion wizards to this class
+
+ Removed:
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java
+ *src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java
+ *src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java
+ *src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java
+
+
+
+
+
+
2002-11-13 Alain Magloire
* src/.../internal/ui/editor/ProblemPainter.java (hasProblem):
diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index f08d7754fe7..8a862cf8d69 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -28,17 +28,9 @@ StdCCWizard.description=Create a new C++ project
ConversionWizard.name=Convert a project's nature
ConversionWizard.description=Convert a project's nature
-#Convert Simple Project to C
-SimpleToCStdMakeConversionWizard.name=Convert to a C Project
-SimpleToCStdMakeConversionWizard.description=Convert a project's nature to C
-
-#Convert Simple Project to C++
-SimpleToCCStdMakeConversionWizard.name=Convert to a C++ Project
-SimpleToCCStdMakeConversionWizard.description=Convert a project's nature to C++
-
-#Convert C to C++
-CtoCCConversionWizard.name=Convert to a C++ Project
-CtoCCConversionWizard.description=Convert a project's nature from C to C++
+#Convert Standard Make C/C++
+StdMakeConversionWizard.name=Convert to a C or C++ Project
+StdMakeConversionWizard.description=Convert a project's nature to C or C/C++
NewFileWizard.name=File
NewFileCreationWizard.description=Create a file
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 64a2f01a7a4..ae74a2ff1fb 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -159,17 +159,17 @@
%StdCWizard.description
-
+
*
- * mainPage = new ConvertSimpleToCStdMakeProjectWizardPage(getPrefix()); + * mainPage = new ConvertToStdMakeProjectWizardPage(getPrefix()); * addPage(mainPage); ** diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java deleted file mode 100644 index 666fae02105..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.eclipse.cdt.ui.wizards.conversion; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.CProjectNature; -import org.eclipse.cdt.ui.CUIPlugin; -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 - *
- * Example useage: - *
- * mainPage = new ConvertCtoCCStdMakeProjectWizardPage("CtoCCConvertProjectPage"); - * mainPage.setTitle("Project Conversion"); - * mainPage.setDescription("Convert a project's nature from C to C++."); - *- * - */ -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 CUIPlugin.getResourceString(WZ_TITLE); - } - - /** - * Method getWzDescriptionResource returns the correct description - * Label for this class overriding the default in the superclass. - */ - protected String getWzDescriptionResource(){ - return CUIPlugin.getResourceString(WZ_DESC); - } - - /** - * Method isCandidate returns projects that have - * a "C" Nature but do not have a "C++" Nature - * - * @param project - * @return boolean - */ - public boolean isCandidate(IProject project) { - try { - if (project.hasNature(CProjectNature.C_NATURE_ID) - && !project.hasNature(CCProjectNature.CC_NATURE_ID)) - return true; - } catch (CoreException e) { - CUIPlugin.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); - } -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java index 58d9f6d161a..1b0103f0908 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java @@ -7,15 +7,17 @@ package org.eclipse.cdt.ui.wizards.conversion; */ import java.util.Vector; +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.internal.ui.util.SWTUtil; import org.eclipse.cdt.ui.CUIPlugin; - +import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; - import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredContentProvider; @@ -26,8 +28,12 @@ import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.jface.wizard.WizardPage; - import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -37,7 +43,6 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; - import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; @@ -66,6 +71,11 @@ public abstract class ConvertProjectWizardPage public static final String KEY_CONVERTING = "ConvertionWizard.converting"; private static final String PROJECT_LIST = "ConversionWizard.projectlist"; + protected boolean convertToC = false; + protected boolean convertToCC = true; + protected Button cRadioButton; + protected Button ccRadioButton; + // The Main widget containing the table and its list of condidate open projects protected CheckboxTableViewer tableViewer; @@ -126,7 +136,35 @@ public abstract class ConvertProjectWizardPage * */ protected void addToMainPage(Composite container){ - // by default do nothing + + // Add convert to C or C/C++ buttons + Composite area = ControlFactory.createGroup(container, "Convert to C or C/C++", 2); + + + SelectionListener cListener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + convertToC = cRadioButton.getSelection(); + convertToCC = ccRadioButton.getSelection(); + validatePage(); + } + }; + cRadioButton = ControlFactory.createRadioButton(area, + "C Project", + "C ", + cListener); + cRadioButton.setSelection(convertToC); + ccRadioButton = ControlFactory.createRadioButton(area, + "C/C++ Project", + "C++", + cListener); + ccRadioButton.setSelection(convertToCC); + + area.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent event) { + cRadioButton = null; + ccRadioButton = null; + } + }); } /** @@ -445,7 +483,36 @@ public abstract class ConvertProjectWizardPage * @param projectID * @throws CoreException */ - public abstract void convertProject(IProject project, - IProgressMonitor monitor, String projectID) - throws CoreException; + public void convertProject(IProject project, + IProgressMonitor monitor, + String projectID) + throws CoreException{ + // Add the correct nature + if (convertToC) { + if (!project.hasNature(CProjectNature.C_NATURE_ID)){ + addCNature(project, monitor, true); + } else { + if (project.hasNature(CCProjectNature.CC_NATURE_ID)){ + // remove the C++ nature + CCProjectNature.removeCCNature(project, monitor); + } + } + } else { + if (convertToCC && !project.hasNature(CCProjectNature.CC_NATURE_ID)) { + addCCNature(project, monitor, true); + } + } + } + protected void addCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException{ + CCorePlugin.getDefault().convertProjectToC(project, monitor, CCorePlugin.getDefault().PLUGIN_ID + ".make", addMakeBuilder); //$NON-NLS-1$ + } + + protected void addCCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException{ + if (project.hasNature(CProjectNature.C_NATURE_ID)) { + CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor); //$NON-NLS-1$ + } else { + CCorePlugin.getDefault().convertProjectToCC(project, monitor, CCorePlugin.getDefault().PLUGIN_ID + ".make", addMakeBuilder); //$NON-NLS-1$ + } + } + } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java deleted file mode 100644 index 624714a2309..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.cdt.ui.wizards.conversion; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * - * ConvertSimpleToCCStdMakeProjectWizardPage - * Standard main page for a wizard that adds a C++ project Nature to a project with no nature associated with it. - * This conversion is one way in that the project cannot be converted back (i.e have the nature removed). - * - * @author Judy N. Green - * @since Aug 6, 2002 - *
- * Example useage: - *
- * mainPage = new ConvertSimpleToCCStdMakeProjectWizardPage("UKtoCCConvertProjectPage"); - * mainPage.setTitle("Project Conversion"); - * mainPage.setDescription("Add C++ a Nature to a project."); - *- * - */ -public class ConvertSimpleToCCStdMakeProjectWizardPage extends ConvertSimpleToCStdMakeProjectWizardPage { - - private static final String WZ_TITLE = "SimpleToCCStdMakeConversionWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "SimpleToCCStdMakeConversionWizard.description"; //$NON-NLS-1$ - - /** - * Constructor for ConvertSimpleToCCStdMakeProjectWizardPage. - * @param pageName - */ - public ConvertSimpleToCCStdMakeProjectWizardPage(String pageName) { - super(pageName); - } - - /** - * Method getWzTitleResource returns the correct Title Label for this class - * overriding the default in the superclass. - */ - protected String getWzTitleResource(){ - return CUIPlugin.getResourceString(WZ_TITLE); - } - - /** - * Method getWzDescriptionResource returns the correct description - * Label for this class overriding the default in the superclass. - */ - protected String getWzDescriptionResource(){ - return CUIPlugin.getResourceString(WZ_DESC); - } - - /** - * Method isCandidate returns projects that have - * neither a "C" Nature nor a "C++" Nature - * - * @param project - * @return boolean - */ - public boolean isCandidate(IProject project) { - boolean noCNature = super.isCandidate(project); - boolean noCCNature = false; - - try { - noCCNature = !project.hasNature(CCProjectNature.CC_NATURE_ID); - } catch (CoreException e) { - noCCNature = true; - } - return noCNature && noCCNature; - } - - /** - * Method convertProject adds a C++ Nature and default make builder - * 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 { - if (!project.isOpen()){ - project.open(monitor); - } - CCorePlugin.getDefault().convertProjectToCC(project, monitor, projectID); - } -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java similarity index 74% rename from core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java index 9a4c7250bac..b36f22bae46 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java @@ -11,27 +11,27 @@ import org.eclipse.cdt.ui.CUIPlugin; * This wizard provides a method by which the user can * add a C nature to a project that previously had no nature associated with it. */ -public class SimpleToCStdMakeConversionWizard extends ConversionWizard { +public class ConvertToStdMakeConversionWizard extends ConversionWizard { - private static final String WZ_TITLE = "SimpleToCStdMakeConversionWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "SimpleToCStdMakeConversionWizard.description"; //$NON-NLS-1$ - private static final String PREFIX= "SimpleToCStdMakeConversionWizard"; //$NON-NLS-1$ + private static final String WZ_TITLE = "ConvertToStdMakeConversionWizard.title"; //$NON-NLS-1$ + private static final String WZ_DESC = "ConvertToStdMakeConversionWizard.description"; //$NON-NLS-1$ + private static final String PREFIX= "ConvertToStdMakeConversionWizard"; //$NON-NLS-1$ - private static final String WINDOW_TITLE = "SimpleToCStdMakeConversionWizard.windowTitle";//$NON-NLS-1$ + private static final String WINDOW_TITLE = "ConvertToStdMakeConversionWizard.windowTitle";//$NON-NLS-1$ /** - * SimpleToCStdMakeConversionWizard Wizard constructor + * ConvertToStdMakeConversionWizard Wizard constructor */ - public SimpleToCStdMakeConversionWizard() { + public ConvertToStdMakeConversionWizard() { this(getWindowTitleResource(), getWzDescriptionResource()); } /** - * SimpleToCStdMakeConversionWizard Wizard constructor + * ConvertToStdMakeConversionWizard Wizard constructor * * @param title * @param desc */ - public SimpleToCStdMakeConversionWizard(String title, String desc) { + public ConvertToStdMakeConversionWizard(String title, String desc) { super(title, desc); } @@ -81,7 +81,7 @@ public class SimpleToCStdMakeConversionWizard extends ConversionWizard { * @see Wizard#createPages */ public void addPages() { - mainPage = new ConvertSimpleToCStdMakeProjectWizardPage(getPrefix()); + mainPage = new ConvertToStdMakeProjectWizardPage(getPrefix()); addPage(mainPage); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java similarity index 55% rename from core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java index cc53d58f60e..cc57d8f8c35 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java @@ -5,16 +5,15 @@ package org.eclipse.cdt.ui.wizards.conversion; * All Rights Reserved. */ -import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; /** * - * ConvertSimpleToCStdMakeProjectWizardPage + * ConvertToStdMakeProjectWizardPage * Standard main page for a wizard that adds a C project Nature to a project with no nature associated with it. * This conversion is one way in that the project cannot be converted back (i.e have the nature removed). * @@ -23,22 +22,22 @@ import org.eclipse.core.runtime.IProgressMonitor; *
* Example useage: *
- * mainPage = new ConvertSimpleToCStdMakeProjectWizardPage("UKtoCConvertProjectPage"); + * mainPage = new ConvertToStdMakeProjectWizardPage("ConvertProjectPage"); * mainPage.setTitle("Project Conversion"); - * mainPage.setDescription("Add C a Nature to a project."); + * mainPage.setDescription("Add C or C++ a Nature to a project."); ** */ -public class ConvertSimpleToCStdMakeProjectWizardPage extends ConvertProjectWizardPage { +public class ConvertToStdMakeProjectWizardPage extends ConvertProjectWizardPage { - private static final String WZ_TITLE = "SimpleToCStdMakeConversionWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "SimpleToCStdMakeConversionWizard.description"; //$NON-NLS-1$ + private static final String WZ_TITLE = "StdMakeConversionWizard.title"; //$NON-NLS-1$ + private static final String WZ_DESC = "StdMakeConversionWizard.description"; //$NON-NLS-1$ /** - * Constructor for ConvertSimpleToCStdMakeProjectWizardPage. + * Constructor for ConvertToStdMakeProjectWizardPage. * @param pageName */ - public ConvertSimpleToCStdMakeProjectWizardPage(String pageName) { + public ConvertToStdMakeProjectWizardPage(String pageName) { super(pageName); } @@ -60,7 +59,7 @@ public class ConvertSimpleToCStdMakeProjectWizardPage extends ConvertProjectWiza /** * Method isCandidate returns projects that have - * no "C" Nature, but are Projects in the Eclipse sense. + * no "C" or "C++" Nature, but are Projects in the Eclipse sense. * * @param project * @return boolean @@ -68,28 +67,11 @@ public class ConvertSimpleToCStdMakeProjectWizardPage extends ConvertProjectWiza public boolean isCandidate(IProject project) { boolean noCNature = false; try { - noCNature = !project.hasNature(CProjectNature.C_NATURE_ID); + noCNature = !project.hasNature(CProjectNature.C_NATURE_ID) + || !project.hasNature(CCProjectNature.CC_NATURE_ID); } catch (CoreException e) { noCNature = true; } return noCNature; - } - - /** - * Method convertProject adds a C Nature and default make builder - * 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().convertProjectToC(project, monitor, projectID); - if (!project.isOpen()){ - project.open(monitor); - } - } + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java deleted file mode 100644 index c1143d022e8..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.eclipse.cdt.ui.wizards.conversion; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.ui.CUIPlugin; - -/** - * This wizard provides a method by which the user can - * change the nature of their projects. - */ -public class CtoCCConversionWizard extends ConversionWizard { - - private static final String WZ_TITLE = "CtoCCConversionWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "CtoCCConversionWizard.description"; //$NON-NLS-1$ - private static final String PREFIX= "CtoCCConversionWizard"; //$NON-NLS-1$ - - private static final String WINDOW_TITLE = "CtoCCConversionWizard.windowTitle";//$NON-NLS-1$ - - /** - * CtoCCConversion Wizard constructor - */ - public CtoCCConversionWizard() { - this(getWindowTitleResource(), getWzDescriptionResource()); - } - /** - * CtoCCConversion Wizard constructor - * - * @param title - * @param desc - */ - public CtoCCConversionWizard(String title, String desc) { - super(title, desc); - } - - /** - * Method getWzDescriptionResource, allows Wizard description label value - * to be changed by subclasses - * - * @return String - */ - protected static String getWzDescriptionResource() { - return CUIPlugin.getResourceString(WZ_DESC); - } - - /** - * Method getWzTitleResource, allows Wizard description label value - * to be changed by subclasses - * - * @return String - */ - protected static String getWzTitleResource() { - return CUIPlugin.getResourceString(WZ_TITLE); - } - - /** - * Method getWindowTitleResource, allows Wizard Title label value to be - * changed by subclasses - * - * @return String - */ - protected static String getWindowTitleResource() { - - return CUIPlugin.getResourceString(WINDOW_TITLE); - } - - /** - * Method getPrefix, allows prefix value to be changed by subclasses - * - * @return String - */ - protected static String getPrefix() { - return PREFIX; - } - - /** - * Method addPages adds our C to C++ conversion Wizard page. - * - * @see Wizard#createPages - */ - public void addPages() { - mainPage = new ConvertCtoCCStdMakeProjectWizardPage(getPrefix()); - - addPage(mainPage); - } -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java deleted file mode 100644 index 61ccb185e92..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.eclipse.cdt.ui.wizards.conversion; - -/* - * (c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - */ - -import org.eclipse.cdt.ui.CUIPlugin; - -/** - * This wizard provides a method by which the user can - * add a C++ nature to a project that previously had no nature associated with it. - */ -public class SimpleToCCStdMakeConversionWizard extends ConversionWizard { - - private static final String WZ_TITLE = "SimpleToCCStdMakeConversionWizard.title"; //$NON-NLS-1$ - private static final String WZ_DESC = "SimpleToCCStdMakeConversionWizard.description"; //$NON-NLS-1$ - private static final String PREFIX= "SimpleToCCStdMakeConversionWizard"; //$NON-NLS-1$ - - private static final String WINDOW_TITLE = "SimpleToCCStdMakeConversionWizard.windowTitle";//$NON-NLS-1$ - - /** - * SimpleToCCStdMakeConversionWizard Wizard constructor - */ - public SimpleToCCStdMakeConversionWizard() { - this(getWindowTitleResource(), getWzDescriptionResource()); - } - /** - * SimpleToCCStdMakeConversionWizard Wizard constructor - * - * @param title - * @param desc - */ - public SimpleToCCStdMakeConversionWizard(String title, String desc) { - super(title, desc); - } - - /** - * Method getWzDescriptionResource, allows Wizard description label value - * to be changed by subclasses - * - * @return String - */ - protected static String getWzDescriptionResource() { - return CUIPlugin.getResourceString(WZ_DESC); - } - - /** - * Method getWzTitleResource, allows Wizard description label value - * to be changed by subclasses - * - * @return String - */ - protected static String getWzTitleResource() { - return CUIPlugin.getResourceString(WZ_TITLE); - } - - /** - * Method getWindowTitleResource, allows Wizard Title label value to be - * changed by subclasses - * - * @return String - */ - protected static String getWindowTitleResource() { - - return CUIPlugin.getResourceString(WINDOW_TITLE); - } - - /** - * Method getPrefix, allows prefix value to be changed by subclasses - * - * @return String - */ - protected static String getPrefix() { - return PREFIX; - } - - /** - * Method addPages adds our Simple to C++ conversion Wizard page. - * - * @see Wizard#createPages - */ - public void addPages() { - mainPage = new ConvertSimpleToCCStdMakeProjectWizardPage(getPrefix()); - - addPage(mainPage); - } -}