[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Fixes to the Conversion wizards and supporting classes. Part 1 - CDT UI
|
cvs diff -N -u "ChangeLog"
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.29
diff -u -r1.29 ChangeLog
--- ChangeLog 13 Nov 2002 14:32:04 -0000 1.29
+++ ChangeLog 13 Nov 2002 20:28:11 -0000
@@ -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):
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.properties,v
retrieving revision 1.11
diff -u -r1.11 plugin.properties
--- plugin.properties 13 Nov 2002 13:19:12 -0000 1.11
+++ plugin.properties 13 Nov 2002 18:27:23 -0000
@@ -28,17 +28,9 @@
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
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.12
diff -u -r1.12 plugin.xml
--- plugin.xml 13 Nov 2002 13:19:12 -0000 1.12
+++ plugin.xml 13 Nov 2002 18:27:23 -0000
@@ -159,17 +159,17 @@
%StdCWizard.description
</description>
</wizard>
-<!-- For C Conversion Wizards -->
+<!-- For C Conversion Wizard -->
<wizard
- name="%SimpleToCStdMakeConversionWizard.name"
+ name="%StdMakeConversionWizard.name"
icon="icons/full/ctool16/newcc_app.gif"
category="org.eclipse.cdt.ui.newCWizards"
- class="org.eclipse.cdt.ui.wizards.conversion.SimpleToCStdMakeConversionWizard"
+ class="org.eclipse.cdt.ui.wizards.conversion.ConvertToStdMakeConversionWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
- id="org.eclipse.cdt.ui.wizards.SimpleToCStdMakeConversionWizard">
+ id="org.eclipse.cdt.ui.wizards.ConvertToStdMakeConversionWizard">
<description>
- %SimpleToCStdMakeConversionWizard.description
+ %StdMakeConversionWizard.description
</description>
</wizard>
<!-- For C++ Wizards -->
@@ -189,28 +189,17 @@
%StdCCWizard.description
</description>
</wizard>
+<!-- For C++ Conversion Wizard -->
<wizard
- name="%CtoCCConversionWizard.name"
- icon="icons/full/ctool16/newc_app.gif"
- category="org.eclipse.cdt.ui.newCCWizards"
- class="org.eclipse.cdt.ui.wizards.conversion.CtoCCConversionWizard"
- project="true"
- finalPerspective="org.eclipse.cdt.ui.CPerspective"
- id="org.eclipse.cdt.ui.wizards.CtoCCConversionWizard">
- <description>
- %CtoCCConversionWizard.description
- </description>
- </wizard>
- <wizard
- name="%SimpleToCCStdMakeConversionWizard.name"
+ name="%StdMakeConversionWizard.name"
icon="icons/full/ctool16/newcc_app.gif"
category="org.eclipse.cdt.ui.newCCWizards"
- class="org.eclipse.cdt.ui.wizards.conversion.SimpleToCCStdMakeConversionWizard"
+ class="org.eclipse.cdt.ui.wizards.conversion.ConvertToStdMakeConversionWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
- id="org.eclipse.cdt.ui.wizards.SimpleToCCStdMakeConversionWizard">
+ id="org.eclipse.cdt.ui.wizards.ConvertToStdMakeConversionWizard">
<description>
- %SimpleToCCStdMakeConversionWizard.description
+ %StdMakeConversionWizard.description
</description>
</wizard>
</extension>
Index: src/org/eclipse/cdt/internal/ui/CPluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties,v
retrieving revision 1.8
diff -u -r1.8 CPluginResources.properties
--- src/org/eclipse/cdt/internal/ui/CPluginResources.properties 6 Nov 2002 20:36:44 -0000 1.8
+++ src/org/eclipse/cdt/internal/ui/CPluginResources.properties 13 Nov 2002 18:27:24 -0000
@@ -92,20 +92,10 @@
ConversionWizard.title=Add a C++ Nature to project(s)
ConversionWizard.projectlist=Candidates for conversion
-# Convert from Simple to C
-SimpleToCStdMakeConversionWizard.windowTitle=Convert Projects to C
-SimpleToCStdMakeConversionWizard.description=Select project(s) for conversion
-SimpleToCStdMakeConversionWizard.title=Add a C Nature to selected project(s)
-
-# Convert from Simple to C++
-SimpleToCCStdMakeConversionWizard.windowTitle=Convert Projects to C++
-SimpleToCCStdMakeConversionWizard.description=Select Project(s) for conversion
-SimpleToCCStdMakeConversionWizard.title=Add a C++ Nature to selected project(s)
-
-# Convert from C to C++
-CtoCCConversionWizard.windowTitle=Convert C Projects to C++
-CtoCCConversionWizard.description=Select C Project(s) for conversion
-CtoCCConversionWizard.title=Add a C++ Nature to project(s)
+# Convert to C/C++
+StdMakeConversionWizard.windowTitle=Convert Projects to C or C/C++
+StdMakeConversionWizard.description=Select project(s) for conversion
+StdMakeConversionWizard.title=Add a C or C++ Nature to selected project(s)
TabFolderPage=Tab Folder Page
TabFolderPage.title=Project
Index: src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java,v
retrieving revision 1.4
diff -u -r1.4 StdMakeProjectWizard.java
--- src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java 29 Oct 2002 21:40:58 -0000 1.4
+++ src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java 13 Nov 2002 18:27:23 -0000
@@ -87,9 +87,6 @@
if (settingsBlock != null) {
settingsBlock.doRun(newProject, new SubProgressMonitor(monitor, 1));
}
-
- // Set the Default C Builder to make this a StdMakeProject.
- CCorePlugin.getDefault().addDefaultCBuilder(newProject, new SubProgressMonitor(monitor, 1));
}
}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java,v
retrieving revision 1.5
diff -u -r1.5 ConversionWizard.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java 29 Oct 2002 21:40:58 -0000 1.5
+++ src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java 13 Nov 2002 18:27:23 -0000
@@ -149,7 +149,7 @@
*
* i.e. <br>
*<pre>
- * mainPage = new ConvertSimpleToCStdMakeProjectWizardPage(getPrefix());
+ * mainPage = new ConvertToStdMakeProjectWizardPage(getPrefix());
* addPage(mainPage);
*</pre>
*
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConvertCtoCCStdMakeProjectWizardPage.java 29 Oct 2002 21:40:58 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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
- *<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 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);
- }
-}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java,v
retrieving revision 1.9
diff -u -r1.9 ConvertProjectWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java 11 Nov 2002 21:42:41 -0000 1.9
+++ src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java 13 Nov 2002 18:27:23 -0000
@@ -7,15 +7,17 @@
*/
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.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.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 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 @@
*
*/
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 @@
* @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$
+ }
+ }
+
}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCCStdMakeProjectWizardPage.java 29 Oct 2002 21:40:58 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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
- *<p>
- * Example useage:
- * <pre>
- * mainPage = new ConvertSimpleToCCStdMakeProjectWizardPage("UKtoCCConvertProjectPage");
- * mainPage.setTitle("Project Conversion");
- * mainPage.setDescription("Add C++ a Nature to a project.");
- * </pre>
- * </p>
- */
-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);
- }
-}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/conversion/ConvertSimpleToCStdMakeProjectWizardPage.java 29 Oct 2002 21:40:58 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,95 +0,0 @@
-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.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
- * 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
- *<p>
- * Example useage:
- * <pre>
- * mainPage = new ConvertSimpleToCStdMakeProjectWizardPage("UKtoCConvertProjectPage");
- * mainPage.setTitle("Project Conversion");
- * mainPage.setDescription("Add C a Nature to a project.");
- * </pre>
- * </p>
- */
-public class ConvertSimpleToCStdMakeProjectWizardPage extends ConvertProjectWizardPage {
-
- private static final String WZ_TITLE = "SimpleToCStdMakeConversionWizard.title"; //$NON-NLS-1$
- private static final String WZ_DESC = "SimpleToCStdMakeConversionWizard.description"; //$NON-NLS-1$
-
- /**
- * Constructor for ConvertSimpleToCStdMakeProjectWizardPage.
- * @param pageName
- */
- public ConvertSimpleToCStdMakeProjectWizardPage(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
- * no "C" Nature, but are Projects in the Eclipse sense.
- *
- * @param project
- * @return boolean
- */
- public boolean isCandidate(IProject project) {
- boolean noCNature = false;
- try {
- noCNature = !project.hasNature(CProjectNature.C_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);
- }
- }
-}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java 13 Nov 2002 18:27:23 -0000
@@ -0,0 +1,88 @@
+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 ConvertToStdMakeConversionWizard extends ConversionWizard {
+
+ 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 = "ConvertToStdMakeConversionWizard.windowTitle";//$NON-NLS-1$
+
+ /**
+ * ConvertToStdMakeConversionWizard Wizard constructor
+ */
+ public ConvertToStdMakeConversionWizard() {
+ this(getWindowTitleResource(), getWzDescriptionResource());
+ }
+ /**
+ * ConvertToStdMakeConversionWizard Wizard constructor
+ *
+ * @param title
+ * @param desc
+ */
+ public ConvertToStdMakeConversionWizard(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 ConvertToStdMakeProjectWizardPage(getPrefix());
+
+ addPage(mainPage);
+ }
+}
Index: src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java 13 Nov 2002 18:27:23 -0000
@@ -0,0 +1,77 @@
+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.CProjectNature;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ *
+ * 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).
+ *
+ * @author Judy N. Green
+ * @since Aug 6, 2002
+ *<p>
+ * Example useage:
+ * <pre>
+ * mainPage = new ConvertToStdMakeProjectWizardPage("ConvertProjectPage");
+ * mainPage.setTitle("Project Conversion");
+ * mainPage.setDescription("Add C or C++ a Nature to a project.");
+ * </pre>
+ * </p>
+ */
+public class ConvertToStdMakeProjectWizardPage extends ConvertProjectWizardPage {
+
+ private static final String WZ_TITLE = "StdMakeConversionWizard.title"; //$NON-NLS-1$
+ private static final String WZ_DESC = "StdMakeConversionWizard.description"; //$NON-NLS-1$
+
+ /**
+ * Constructor for ConvertToStdMakeProjectWizardPage.
+ * @param pageName
+ */
+ public ConvertToStdMakeProjectWizardPage(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
+ * no "C" or "C++" Nature, but are Projects in the Eclipse sense.
+ *
+ * @param project
+ * @return boolean
+ */
+ public boolean isCandidate(IProject project) {
+ boolean noCNature = false;
+ try {
+ noCNature = !project.hasNature(CProjectNature.C_NATURE_ID)
+ || !project.hasNature(CCProjectNature.CC_NATURE_ID);
+ } catch (CoreException e) {
+ noCNature = true;
+ }
+ return noCNature;
+ }
+}
Index: src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java
--- src/org/eclipse/cdt/ui/wizards/conversion/CtoCCConversionWizard.java 29 Oct 2002 21:40:58 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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);
- }
-}
Index: src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java
--- src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCCStdMakeConversionWizard.java 29 Oct 2002 21:40:58 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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);
- }
-}
Index: src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java
diff -N src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java
--- src/org/eclipse/cdt/ui/wizards/conversion/SimpleToCStdMakeConversionWizard.java 29 Oct 2002 21:40:58 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -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 SimpleToCStdMakeConversionWizard 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 WINDOW_TITLE = "SimpleToCStdMakeConversionWizard.windowTitle";//$NON-NLS-1$
-
- /**
- * SimpleToCStdMakeConversionWizard Wizard constructor
- */
- public SimpleToCStdMakeConversionWizard() {
- this(getWindowTitleResource(), getWzDescriptionResource());
- }
- /**
- * SimpleToCStdMakeConversionWizard Wizard constructor
- *
- * @param title
- * @param desc
- */
- public SimpleToCStdMakeConversionWizard(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 ConvertSimpleToCStdMakeProjectWizardPage(getPrefix());
-
- addPage(mainPage);
- }
-}