mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Exclude closed projects from list of candidates for conversion
This commit is contained in:
parent
d32b5a8355
commit
654e98387e
7 changed files with 29 additions and 29 deletions
|
@ -145,7 +145,13 @@ public abstract class ConversionWizard
|
|||
|
||||
/**
|
||||
* Method addPages allows subclasses to add as many pages as they need. Overwrite
|
||||
* to create a conversion specific page.
|
||||
* to create at least one conversion specific page. <p>
|
||||
*
|
||||
* i.e. <br>
|
||||
*<pre>
|
||||
* mainPage = new ConvertSimpleToCStdMakeProjectWizardPage(getPrefix());
|
||||
* addPage(mainPage);
|
||||
*</pre>
|
||||
*
|
||||
* @see Wizard#createPages
|
||||
*/
|
||||
|
|
|
@ -66,14 +66,12 @@ public class ConvertCtoCCStdMakeProjectWizardPage extends ConvertProjectWizardPa
|
|||
* @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);
|
||||
}
|
||||
try {
|
||||
if (project.hasNature(CoreModel.C_NATURE_ID)
|
||||
&& !project.hasNature(CoreModel.CC_NATURE_ID))
|
||||
return true;
|
||||
} catch (CoreException e) {
|
||||
CPlugin.log(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,8 +51,10 @@ import org.eclipse.ui.PlatformUI;
|
|||
* conversion through the method convertProjects([]Object), which is also
|
||||
* defined by all subclasses.<br> Subclasses provide the methods that
|
||||
* determine what files are displayed and what action is performed on them as
|
||||
* well as the labels for the Wizard.
|
||||
* </p>
|
||||
* well as the labels for the Wizard.</p>
|
||||
*
|
||||
* Note: Only Projects that are open will be considered for conversion.
|
||||
*
|
||||
*
|
||||
* @author Judy N. Green
|
||||
* @since Aug 6, 2002 <p>
|
||||
|
@ -330,7 +332,9 @@ public abstract class ConvertProjectWizardPage
|
|||
|
||||
/**
|
||||
* Returns a list of open projects that are determined to be candidates
|
||||
* through the method isCandidate().
|
||||
* through the method isCandidate().<br>
|
||||
*
|
||||
* Note: Only Projects that are open will be considered for conversion.
|
||||
*
|
||||
* @return Object[] which may be null
|
||||
*/
|
||||
|
@ -341,11 +345,13 @@ public abstract class ConvertProjectWizardPage
|
|||
Vector candidates = new Vector(projects.length);
|
||||
IProject next = null;
|
||||
|
||||
// ensure we only present valid candidates to the user
|
||||
// ensure we only present open, valid candidates to the user
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
next = (IProject)projects[i];
|
||||
|
||||
if ((next != null) && isCandidate(next)) {
|
||||
if ((next != null)
|
||||
&& next.isOpen()
|
||||
&& isCandidate(next)) {
|
||||
candidates.addElement(next);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,18 +68,13 @@ public class ConvertSimpleToCCStdMakeProjectWizardPage extends ConvertSimpleToCS
|
|||
protected boolean isCandidate(IProject project) {
|
||||
boolean noCNature = super.isCandidate(project);
|
||||
boolean noCCNature = false;
|
||||
|
||||
// hasNature() throws a CoreException if the
|
||||
// project is not open and/or is not visible to this view
|
||||
// which is what happens when a project does not have a
|
||||
// C nature
|
||||
|
||||
|
||||
try {
|
||||
noCCNature = !project.hasNature(CoreModel.CC_NATURE_ID);
|
||||
} catch (CoreException e) {
|
||||
noCCNature = true;
|
||||
}
|
||||
return (noCNature && noCCNature);
|
||||
return noCNature && noCCNature;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,17 +67,12 @@ public class ConvertSimpleToCStdMakeProjectWizardPage extends ConvertProjectWiza
|
|||
*/
|
||||
protected boolean isCandidate(IProject project) {
|
||||
boolean noCNature = false;
|
||||
|
||||
// hasNature() throws a CoreException if the
|
||||
// project is not open and/or is not visible to this view
|
||||
// which is what happens when a project does not have a
|
||||
// C nature
|
||||
try {
|
||||
noCNature = !project.hasNature(CoreModel.C_NATURE_ID);
|
||||
} catch (CoreException e) {
|
||||
noCNature = true;
|
||||
}
|
||||
return (noCNature);
|
||||
return noCNature;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SimpleToCCStdMakeConversionWizard extends ConversionWizard {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method addPages adds our C++ conversion Wizard page.
|
||||
* Method addPages adds our Simple to C++ conversion Wizard page.
|
||||
*
|
||||
* @see Wizard#createPages
|
||||
*/
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SimpleToCStdMakeConversionWizard extends ConversionWizard {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method addPages adds our C to C++ conversion Wizard page.
|
||||
* Method addPages adds our Simple to C conversion Wizard page.
|
||||
*
|
||||
* @see Wizard#createPages
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue