1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

deprecate ties to old builder from nature and core plugin

This commit is contained in:
David Inglis 2003-09-16 22:07:34 +00:00
parent 9579841bcd
commit 9362cf3ae8
4 changed files with 75 additions and 103 deletions

View file

@ -1,3 +1,11 @@
2003-09-16 David Inglis
Deprecate old make builder
* src/org/eclipse/cdt/core/resources/MakeUtil.java
* src/org/eclipse/cdt/core/CCorePlugin.java
* src/org/eclipse/cdt/core/CProjectNature.java
2003-09-12 Alain Magloire 2003-09-12 Alain Magloire
Patch from Bogdan Gheorghe, it corrected a NPE, when dealing with file extensions. Patch from Bogdan Gheorghe, it corrected a NPE, when dealing with file extensions.
In a Unix enviroment binaries do not have extensions also some C++ headers In a Unix enviroment binaries do not have extensions also some C++ headers

View file

@ -554,9 +554,9 @@ public class CCorePlugin extends Plugin {
if (monitor == null) { if (monitor == null) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
} }
monitor.beginTask("Creating C Project", 3); //$NON-NLS-1$ monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
if (!projectHandle.exists()) { if (!projectHandle.exists()) {
projectHandle.create(description, monitor); projectHandle.create(description, new SubProgressMonitor(monitor, 1));
} }
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
@ -564,13 +564,13 @@ public class CCorePlugin extends Plugin {
} }
// Open first. // Open first.
projectHandle.open(monitor); projectHandle.open(new SubProgressMonitor(monitor, 1));
// Add C Nature ... does not add duplicates // Add C Nature ... does not add duplicates
mapCProjectOwner(projectHandle, projectID, false); mapCProjectOwner(projectHandle, projectID, false);
CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1)); CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
} finally { } finally {
//monitor.done(); monitor.done();
} }
return projectHandle; return projectHandle;
} }
@ -595,20 +595,8 @@ public class CCorePlugin extends Plugin {
} }
} }
/**
* Method addDefaultCBuilder adds the default C make builder
* @param projectHandle
* @param monitor
* @exception CoreException
*/
public void addDefaultCBuilder(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
// Set the Default C Builder.
CProjectNature.addCBuildSpec(projectHandle, monitor);
}
/** /**
* Method to convert a project to a C nature * Method to convert a project to a C nature
* & default make builder (Will always add a default builder)
* All checks should have been done externally * All checks should have been done externally
* (as in the Conversion Wizards). * (as in the Conversion Wizards).
* This method blindly does the conversion. * This method blindly does the conversion.
@ -620,26 +608,7 @@ public class CCorePlugin extends Plugin {
* @exception CoreException * @exception CoreException
*/ */
public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID) throws CoreException { public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID)
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 { throws CoreException {
if ((projectHandle == null) || (monitor == null) || (projectID == null)) { if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
return; return;
@ -648,23 +617,19 @@ public class CCorePlugin extends Plugin {
IProjectDescription description = workspace.newProjectDescription(projectHandle.getName()); IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
description.setLocation(projectHandle.getFullPath()); description.setLocation(projectHandle.getFullPath());
createCProject(description, projectHandle, monitor, projectID); createCProject(description, projectHandle, monitor, projectID);
if (addMakeBuilder) {
addDefaultCBuilder(projectHandle, monitor);
}
} }
/** /**
* Method to convert a project to a C++ nature * Method to convert a project to a C++ nature
* & default make builder(if indicated), if it does not have one already
* *
* @param project * @param project
* @param String targetNature * @param String targetNature
* @param monitor * @param monitor
* @param projectID * @param projectID
* @param addMakeBuilder
* @exception CoreException * @exception CoreException
*/ */
public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID, boolean addMakeBuilder) public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID)
throws CoreException { throws CoreException {
if ((projectHandle == null) || (monitor == null) || (projectID == null)) { if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
return; return;
@ -672,31 +637,16 @@ public class CCorePlugin extends Plugin {
createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID); createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
// now add C++ nature // now add C++ nature
convertProjectFromCtoCC(projectHandle, monitor); 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
* @param monitor
* @param projectID
* @exception CoreException
*/
public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID) throws CoreException {
this.convertProjectToCC(projectHandle, monitor, projectID, true);
} }
/** // Extract the builder from the .cdtproject.
* Instanciate the class from the extension point "ProcessList" // public ICBuilder[] getBuilders(IProject project) throws CoreException {
* responsable of returning a list of process for this platform. // ICExtension extensions[] = fDescriptorManager.createExtensions(BUILDER_MODEL_ID, project);
* @return // ICBuilder builders[] = new ICBuilder[extensions.length];
*/ // System.arraycopy(extensions, 0, builders, 0, extensions.length);
// return builders;
// }
public IProcessList getProcessList() { public IProcessList getProcessList() {
IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList"); IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList");
if (extension != null) { if (extension != null) {

View file

@ -90,37 +90,38 @@ public class CProjectNature implements IProjectNature {
/** /**
* Sets the path of the build command executable. * Sets the path of the build command executable.
* @depercated
*/ */
public void setBuildCommand(IPath locationPath, IProgressMonitor monitor) throws CoreException { public void setBuildCommand(IPath locationPath, IProgressMonitor monitor) throws CoreException {
String newLocation= locationPath.toString();
String oldLocation= fBuildInfo.getBuildLocation();
if (!newLocation.equals(oldLocation)) {
fBuildInfo.setBuildLocation(newLocation);
}
} }
/** /**
* Gets the path of the build command executable. * Gets the path of the build command executable.
* @deprecated
*/ */
public IPath getBuildCommand() throws CoreException { public IPath getBuildCommand() throws CoreException {
if( fBuildInfo == null) {
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
}
String buildLocation= fBuildInfo.getBuildLocation(); String buildLocation= fBuildInfo.getBuildLocation();
return new Path(buildLocation); return new Path(buildLocation);
} }
/** /**
* Sets the arguments for the full build. * Sets the arguments for the full build.
* @deprecated
*/ */
public void setFullBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException { public void setFullBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException {
String oldArguments= fBuildInfo.getFullBuildArguments();
if (!arguments.equals(oldArguments)) {
fBuildInfo.setFullBuildArguments(arguments);
}
} }
/** /**
* Gets the arguments for the full build * Gets the arguments for the full build
* @deprecated
*/ */
public String getFullBuildArguments() throws CoreException { public String getFullBuildArguments() throws CoreException {
if( fBuildInfo == null) {
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
}
String buildArguments= fBuildInfo.getFullBuildArguments(); String buildArguments= fBuildInfo.getFullBuildArguments();
if (buildArguments == null) { if (buildArguments == null) {
buildArguments= ""; buildArguments= "";
@ -130,18 +131,19 @@ public class CProjectNature implements IProjectNature {
/** /**
* Sets the arguments for the incremental build. * Sets the arguments for the incremental build.
* @deprecated
*/ */
public void setIncrBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException { public void setIncrBuildArguments(String arguments, IProgressMonitor monitor) throws CoreException {
String oldArguments= fBuildInfo.getIncrementalBuildArguments();
if (!arguments.equals(oldArguments)) {
fBuildInfo.setIncrementalBuildArguments(arguments);
}
} }
/** /**
* Gets the arguments for the incremental build * Gets the arguments for the incremental build
* @deprecated
*/ */
public String getIncrBuildArguments() throws CoreException { public String getIncrBuildArguments() throws CoreException {
if( fBuildInfo == null) {
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
}
String buildArguments= fBuildInfo.getIncrementalBuildArguments(); String buildArguments= fBuildInfo.getIncrementalBuildArguments();
if (buildArguments == null) { if (buildArguments == null) {
buildArguments= ""; buildArguments= "";
@ -151,32 +153,41 @@ public class CProjectNature implements IProjectNature {
/** /**
* Sets Stop on Error * Sets Stop on Error
* @deprecated
*/ */
public void setStopOnError(boolean on) throws CoreException { public void setStopOnError(boolean on) throws CoreException {
boolean oldArgument= fBuildInfo.isStopOnError();
if (on != oldArgument) {
fBuildInfo.setStopOnError(on);
}
} }
/**
* @deprecated
*/
public void setBuildCommandOverride(boolean on) throws CoreException { public void setBuildCommandOverride(boolean on) throws CoreException {
boolean oldArgument= fBuildInfo.isDefaultBuildCmd();
if (on != oldArgument) {
fBuildInfo.setUseDefaultBuildCmd(on);
}
} }
/** /**
* Gets Stop on Error * Gets Stop on Error
* @deprecated
*/ */
public boolean isStopOnError() throws CoreException { public boolean isStopOnError() throws CoreException {
if( fBuildInfo == null) {
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
}
return fBuildInfo.isStopOnError(); return fBuildInfo.isStopOnError();
} }
/**
* @deprecated
*/
public boolean isDefaultBuildCmd() throws CoreException { public boolean isDefaultBuildCmd() throws CoreException {
if( fBuildInfo == null) {
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
}
return fBuildInfo.isDefaultBuildCmd(); return fBuildInfo.isDefaultBuildCmd();
} }
/**
* @deprecated
*/
public static boolean hasCBuildSpec(IProject project) { public static boolean hasCBuildSpec(IProject project) {
boolean found= false; boolean found= false;
try { try {
@ -193,20 +204,28 @@ public class CProjectNature implements IProjectNature {
return found; return found;
} }
/**
* @deprecated
*/
public void addCBuildSpec(IProgressMonitor mon) throws CoreException { public void addCBuildSpec(IProgressMonitor mon) throws CoreException {
addToBuildSpec(getBuilderID(), mon);
} }
/**
* @deprecated
*/
public static void addCBuildSpec(IProject project, IProgressMonitor mon) throws CoreException { public static void addCBuildSpec(IProject project, IProgressMonitor mon) throws CoreException {
addToBuildSpec(project, getBuilderID(), mon);
} }
/**
* @deprecated
*/
public void addToBuildSpec(String builderID, IProgressMonitor mon) throws CoreException { public void addToBuildSpec(String builderID, IProgressMonitor mon) throws CoreException {
addToBuildSpec(getProject(), builderID, mon); addToBuildSpec(getProject(), builderID, mon);
} }
/** /**
* Adds a builder to the build spec for the given project. * Adds a builder to the build spec for the given project.
* @deprecated
*/ */
public static void addToBuildSpec(IProject project, String builderID, IProgressMonitor mon) throws CoreException { public static void addToBuildSpec(IProject project, String builderID, IProgressMonitor mon) throws CoreException {
IProjectDescription description= project.getDescription(); IProjectDescription description= project.getDescription();
@ -230,12 +249,15 @@ public class CProjectNature implements IProjectNature {
} }
} }
/**
* @deprecated
*/
public void removeCBuildSpec(IProgressMonitor mon) throws CoreException { public void removeCBuildSpec(IProgressMonitor mon) throws CoreException {
removeFromBuildSpec(getBuilderID(), mon);
} }
/** /**
* Removes the given builder from the build spec for the given project. * Removes the given builder from the build spec for the given project.
* @deprecated
*/ */
public void removeFromBuildSpec(String builderID, IProgressMonitor mon) throws CoreException { public void removeFromBuildSpec(String builderID, IProgressMonitor mon) throws CoreException {
IProjectDescription description= getProject().getDescription(); IProjectDescription description= getProject().getDescription();
@ -254,6 +276,7 @@ public class CProjectNature implements IProjectNature {
/** /**
* Get the correct builderID * Get the correct builderID
* @deprecated
*/ */
public static String getBuilderID() { public static String getBuilderID() {
Plugin plugin = (Plugin)CCorePlugin.getDefault(); Plugin plugin = (Plugin)CCorePlugin.getDefault();
@ -268,21 +291,12 @@ public class CProjectNature implements IProjectNature {
* @see IProjectNature#configure * @see IProjectNature#configure
*/ */
public void configure() throws CoreException { public void configure() throws CoreException {
addToBuildSpec(getBuilderID(), null);
IStandardBuildInfo info = BuildInfoFactory.create();
fBuildInfo.setBuildLocation(info.getBuildLocation());
fBuildInfo.setFullBuildArguments("");
fBuildInfo.setIncrementalBuildArguments("");
} }
/** /**
* @see IProjectNature#deconfigure * @see IProjectNature#deconfigure
*/ */
public void deconfigure() throws CoreException { public void deconfigure() throws CoreException {
removeFromBuildSpec(getBuilderID(), null);
fBuildInfo.setBuildLocation(null);
fBuildInfo.setFullBuildArguments(null);
fBuildInfo.setIncrementalBuildArguments(null);
} }
/** /**
@ -296,11 +310,7 @@ public class CProjectNature implements IProjectNature {
* @see IProjectNature#setProject * @see IProjectNature#setProject
*/ */
public void setProject(IProject project) { public void setProject(IProject project) {
try { fProject= project;
fProject= project;
fBuildInfo = StandardBuildManager.getBuildInfo(fProject, true);
} catch (CoreException e) {
}
} }
} }

View file

@ -13,6 +13,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
/**
* @deprecated
*
*/
public class MakeUtil { public class MakeUtil {
final static String MAKE_GOALS = "goals"; final static String MAKE_GOALS = "goals";