Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java280
1 files changed, 141 insertions, 139 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
index e1854576b3b..af3928ac836 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
@@ -43,22 +43,24 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.osgi.framework.Version;
-public class ManagedProject extends BuildObject implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {
+public class ManagedProject extends BuildObject
+ implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {
// Parent and children
private IProjectType projectType;
private String projectTypeId;
private IResource owner;
-// private List configList; // Configurations of this project type
- private Map<String, Configuration> configMap = Collections.synchronizedMap(new LinkedHashMap<String, Configuration>());
+ // private List configList; // Configurations of this project type
+ private Map<String, Configuration> configMap = Collections
+ .synchronizedMap(new LinkedHashMap<String, Configuration>());
// Miscellaneous
private boolean isDirty = false;
private boolean isValid = true;
private boolean resolved = true;
//holds the user-defined macros
-// private StorableMacros userDefinedMacros;
+ // private StorableMacros userDefinedMacros;
//holds user-defined environment
-// private StorableEnvironment userDefinedEnvironment;
+ // private StorableEnvironment userDefinedEnvironment;
private BuildObjectProperties buildProperties;
private OptionalBuildProperties optionalBuildProperties;
@@ -89,7 +91,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
// Copy the parent's identity
this.projectType = projectType;
int id = ManagedBuildManager.getRandomNumber();
- setId(owner.getName() + "." + projectType.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
+ setId(owner.getName() + "." + projectType.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
setName(projectType.getName());
setManagedBuildRevision(projectType.getManagedBuildRevision());
@@ -105,17 +107,17 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
this(des.getProject());
// Copy the parent's identity
-// this.projectType = projectType;
+ // this.projectType = projectType;
int id = ManagedBuildManager.getRandomNumber();
- setId(owner.getName() + "." + des.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
+ setId(owner.getName() + "." + des.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
setName(des.getName());
-// setManagedBuildRevision(projectType.getManagedBuildRevision());
+ // setManagedBuildRevision(projectType.getManagedBuildRevision());
// Hook me up
-// IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
-// buildInfo.setManagedProject(this);
-// setDirty(true);
+ // IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
+ // buildInfo.setManagedProject(this);
+ // setDirty(true);
}
/**
@@ -123,7 +125,8 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
*
* @param managedBuildRevision the fileVersion of Managed Build System
*/
- public ManagedProject(ManagedBuildInfo buildInfo, ICStorageElement element, boolean loadConfigs, String managedBuildRevision) {
+ public ManagedProject(ManagedBuildInfo buildInfo, ICStorageElement element, boolean loadConfigs,
+ String managedBuildRevision) {
this(buildInfo.getOwner());
setManagedBuildRevision(managedBuildRevision);
@@ -137,22 +140,22 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
setValid(false);
}
- if(loadConfigs){
+ if (loadConfigs) {
// Load children
StorableCdtVariables vars = null;
ICStorageElement configElements[] = element.getChildren();
for (ICStorageElement configElement : configElements) {
if (configElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
Configuration config = new Configuration(this, configElement, managedBuildRevision, false);
- } else if (configElement.getName().equals("macros")) { //$NON-NLS-1$
+ } else if (configElement.getName().equals("macros")) { //$NON-NLS-1$
vars = new StorableCdtVariables(configElement, false);
}
}
- if(vars != null){
+ if (vars != null) {
for (Configuration cfg : getConfigurationCollection()) {
- ((ToolChain)cfg.getToolChain()).addProjectVariables(vars);
+ ((ToolChain) cfg.getToolChain()).addProjectVariables(vars);
}
}
}
@@ -194,16 +197,16 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
}
String props = element.getAttribute(BUILD_PROPERTIES);
- if(props != null && props.length() != 0)
+ if (props != null && props.length() != 0)
buildProperties = new BuildObjectProperties(props, this, this);
-
+
String optionalProps = element.getAttribute(OPTIONAL_BUILD_PROPERTIES);
if (optionalProps != null && optionalProps.length() != 0)
optionalBuildProperties = new OptionalBuildProperties(optionalProps);
String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
- if(artType != null){
- if(buildProperties == null)
+ if (artType != null) {
+ if (buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
try {
@@ -237,7 +240,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
public void serialize(ICStorageElement element, boolean saveChildren) {
serializeProjectInfo(element);
- if(saveChildren){
+ if (saveChildren) {
for (Configuration cfg : getConfigurationCollection()) {
ICStorageElement configElement = element.createChild(IConfiguration.CONFIGURATION_ELEMENT_NAME);
cfg.serialize(configElement);
@@ -245,16 +248,16 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
}
// Serialize my children
-// //serialize user-defined macros
-// if(userDefinedMacros != null){
-// Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
-// element.appendChild(macrosElement);
-// userDefinedMacros.serialize(doc,macrosElement);
-// }
-//
-// if(userDefinedEnvironment != null){
-// EnvironmentVariableProvider.fUserSupplier.storeEnvironment(this,true);
-// }
+ // //serialize user-defined macros
+ // if(userDefinedMacros != null){
+ // Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
+ // element.appendChild(macrosElement);
+ // userDefinedMacros.serialize(doc,macrosElement);
+ // }
+ //
+ // if(userDefinedEnvironment != null){
+ // EnvironmentVariableProvider.fUserSupplier.storeEnvironment(this,true);
+ // }
// I am clean now
isDirty = false;
@@ -296,7 +299,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
*/
@Override
public IConfiguration createConfiguration(IConfiguration parent, String id) {
- Configuration config = new Configuration(this, (Configuration)parent, id, false, false, false);
+ Configuration config = new Configuration(this, (Configuration) parent, id, false, false, false);
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
return config;
}
@@ -306,7 +309,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
*/
@Override
public IConfiguration createConfigurationClone(IConfiguration parent, String id) {
- Configuration config = new Configuration(this, (Configuration)parent, id, true, false, false);
+ Configuration config = new Configuration(this, (Configuration) parent, id, true, false, false);
// Inform all options in the configuration and all its resource configurations
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
return config;
@@ -338,63 +341,63 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
final String removeId = id;
//handle the case of temporary configuration
- if(!configMap.containsKey(id))
+ if (!configMap.containsKey(id))
return;
configMap.remove(removeId);
-//
-// IWorkspaceRunnable remover = new IWorkspaceRunnable() {
-// public void run(IProgressMonitor monitor) throws CoreException {
-// // Remove the specified configuration from the list and map
-// Iterator iter = getConfigurationCollection().iterator();
-// while (iter.hasNext()) {
-// IConfiguration config = (IConfiguration)iter.next();
-// if (config.getId().equals(removeId)) {
-// // TODO: For now we clean the entire project. This may be overkill, but
-// // it avoids a problem with leaving the configuration output directory
-// // around and having the outputs try to be used by the makefile generator code.
-// IResource proj = config.getOwner();
-// IManagedBuildInfo info = null;
-// if (proj instanceof IProject) {
-// info = ManagedBuildManager.getBuildInfo(proj);
-// }
-// IConfiguration currentConfig = null;
-// boolean isCurrent = true;
-// if (info != null) {
-// currentConfig = info.getDefaultConfiguration();
-// if (!currentConfig.getId().equals(removeId)) {
-// info.setDefaultConfiguration(config);
-// isCurrent = false;
-// }
-// }
-// ((IProject)proj).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
-//
-// ManagedBuildManager.performValueHandlerEvent(config,
-// IManagedOptionValueHandler.EVENT_CLOSE);
-// PropertyManager.getInstance().clearProperties(config);
-//// getConfigurationList().remove(config);
-// getConfigurationMap().remove(removeId);
-//
-// if (info != null) {
-// if (!isCurrent) {
-// info.setDefaultConfiguration(currentConfig);
-// } else {
-// // If the current default config is the one being removed, reset the default config
-// String[] configs = info.getConfigurationNames();
-// if (configs.length > 0) {
-// info.setDefaultConfiguration(configs[0]);
-// }
-// }
-// }
-// break;
-// }
-// }
-// }
-// };
-// try {
-// ResourcesPlugin.getWorkspace().run( remover, null );
-// }
-// catch( CoreException e ) {}
+ //
+ // IWorkspaceRunnable remover = new IWorkspaceRunnable() {
+ // public void run(IProgressMonitor monitor) throws CoreException {
+ // // Remove the specified configuration from the list and map
+ // Iterator iter = getConfigurationCollection().iterator();
+ // while (iter.hasNext()) {
+ // IConfiguration config = (IConfiguration)iter.next();
+ // if (config.getId().equals(removeId)) {
+ // // TODO: For now we clean the entire project. This may be overkill, but
+ // // it avoids a problem with leaving the configuration output directory
+ // // around and having the outputs try to be used by the makefile generator code.
+ // IResource proj = config.getOwner();
+ // IManagedBuildInfo info = null;
+ // if (proj instanceof IProject) {
+ // info = ManagedBuildManager.getBuildInfo(proj);
+ // }
+ // IConfiguration currentConfig = null;
+ // boolean isCurrent = true;
+ // if (info != null) {
+ // currentConfig = info.getDefaultConfiguration();
+ // if (!currentConfig.getId().equals(removeId)) {
+ // info.setDefaultConfiguration(config);
+ // isCurrent = false;
+ // }
+ // }
+ // ((IProject)proj).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
+ //
+ // ManagedBuildManager.performValueHandlerEvent(config,
+ // IManagedOptionValueHandler.EVENT_CLOSE);
+ // PropertyManager.getInstance().clearProperties(config);
+ //// getConfigurationList().remove(config);
+ // getConfigurationMap().remove(removeId);
+ //
+ // if (info != null) {
+ // if (!isCurrent) {
+ // info.setDefaultConfiguration(currentConfig);
+ // } else {
+ // // If the current default config is the one being removed, reset the default config
+ // String[] configs = info.getConfigurationNames();
+ // if (configs.length > 0) {
+ // info.setDefaultConfiguration(configs[0]);
+ // }
+ // }
+ // }
+ // break;
+ // }
+ // }
+ // }
+ // };
+ // try {
+ // ResourcesPlugin.getWorkspace().run( remover, null );
+ // }
+ // catch( CoreException e ) {}
setDirty(true);
}
@@ -404,7 +407,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* @param Tool
*/
public void addConfiguration(Configuration configuration) {
- if(!configuration.isTemporary())
+ if (!configuration.isTemporary())
configMap.put(configuration.getId(), configuration);
}
@@ -431,7 +434,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* @see org.eclipse.cdt.managedbuilder.core.IManagedProject#(getDefaultArtifactName)
*/
@Override
- public String getDefaultArtifactName(){
+ public String getDefaultArtifactName() {
return CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME);
}
@@ -462,16 +465,16 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
@Override
public boolean isDirty() {
// If I need saving, just say yes
- if (isDirty) return true;
+ if (isDirty)
+ return true;
//check whether the project - specific macros are dirty
-// if(userDefinedMacros != null && userDefinedMacros.isDirty())
-// return true;
+ // if(userDefinedMacros != null && userDefinedMacros.isDirty())
+ // return true;
//check whether the project - specific environment is dirty
-// if(userDefinedEnvironment != null && userDefinedEnvironment.isDirty())
-// return true;
-
+ // if(userDefinedEnvironment != null && userDefinedEnvironment.isDirty())
+ // return true;
// Otherwise see if any configurations need saving
for (IConfiguration cfg : getConfigurationCollection())
@@ -516,12 +519,12 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
*/
@Override
public Version getVersion() {
- if (version == null) {
- if ( getProjectType() != null) {
- return getProjectType().getVersion();
- }
+ if (version == null) {
+ if (getProjectType() != null) {
+ return getProjectType().getVersion();
}
- return version;
+ }
+ return version;
}
@Override
@@ -533,25 +536,25 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* this method is called by the UserDefinedMacroSupplier to obtain user-defined
* macros available for this managed project
*/
-/* public StorableMacros getUserDefinedMacros(){
- if(userDefinedMacros == null)
- userDefinedMacros = new StorableMacros();
- return userDefinedMacros;
- }
-*/
-// public StorableEnvironment getUserDefinedEnvironmet(){
-// return userDefinedEnvironment;
-// }
-//
-// public void setUserDefinedEnvironmet(StorableEnvironment env){
-// userDefinedEnvironment = env;
-// }
+ /* public StorableMacros getUserDefinedMacros(){
+ if(userDefinedMacros == null)
+ userDefinedMacros = new StorableMacros();
+ return userDefinedMacros;
+ }
+ */
+ // public StorableEnvironment getUserDefinedEnvironmet(){
+ // return userDefinedEnvironment;
+ // }
+ //
+ // public void setUserDefinedEnvironmet(StorableEnvironment env){
+ // userDefinedEnvironment = env;
+ // }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.core.BuildObject#updateManagedBuildRevision(java.lang.String)
*/
@Override
- public void updateManagedBuildRevision(String revision){
+ public void updateManagedBuildRevision(String revision) {
super.updateManagedBuildRevision(revision);
for (Configuration cfg : getConfigurationCollection()) {
cfg.updateManagedBuildRevision(revision);
@@ -559,9 +562,9 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
}
public void setProjectType(IProjectType projectType) {
- if ( this.projectType != projectType ) {
+ if (this.projectType != projectType) {
this.projectType = projectType;
- if ( this.projectType == null) {
+ if (this.projectType == null) {
projectTypeId = null;
} else {
projectTypeId = this.projectType.getId();
@@ -569,15 +572,15 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
}
}
- public void applyConfiguration(Configuration cfg){
+ public void applyConfiguration(Configuration cfg) {
cfg.applyToManagedProject(this);
}
@Override
public IBuildObjectProperties getBuildProperties() {
- if(buildProperties == null){
+ if (buildProperties == null) {
BuildObjectProperties parentProps = findBuildProperties();
- if(parentProps != null)
+ if (parentProps != null)
buildProperties = new BuildObjectProperties(parentProps, this, this);
else
buildProperties = new BuildObjectProperties(this, this);
@@ -587,9 +590,9 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
@Override
public IOptionalBuildProperties getOptionalBuildProperties() {
- if(optionalBuildProperties == null){
+ if (optionalBuildProperties == null) {
OptionalBuildProperties parentProps = findOptionalBuildProperties();
- if(parentProps != null)
+ if (parentProps != null)
optionalBuildProperties = new OptionalBuildProperties(parentProps);
else
optionalBuildProperties = new OptionalBuildProperties();
@@ -597,20 +600,20 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
return optionalBuildProperties;
}
- private BuildObjectProperties findBuildProperties(){
- if(buildProperties == null){
- if(projectType != null){
- return ((ProjectType)projectType).findBuildProperties();
+ private BuildObjectProperties findBuildProperties() {
+ if (buildProperties == null) {
+ if (projectType != null) {
+ return ((ProjectType) projectType).findBuildProperties();
}
return null;
}
return buildProperties;
}
- private OptionalBuildProperties findOptionalBuildProperties(){
- if(optionalBuildProperties == null){
- if(projectType != null){
- return ((ProjectType)projectType).findOptionalBuildProperties();
+ private OptionalBuildProperties findOptionalBuildProperties() {
+ if (optionalBuildProperties == null) {
+ if (projectType != null) {
+ return ((ProjectType) projectType).findOptionalBuildProperties();
}
return null;
}
@@ -621,7 +624,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
public void propertiesChanged() {
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- ((Configuration)cfg).propertiesChanged();
+ ((Configuration) cfg).propertiesChanged();
}
}
@@ -629,8 +632,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
return supportsType(type.getId());
}
- public boolean supportsValue(IBuildPropertyType type,
- IBuildPropertyValue value) {
+ public boolean supportsValue(IBuildPropertyType type, IBuildPropertyValue value) {
return supportsValue(type.getId(), value.getId());
}
@@ -638,7 +640,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
public boolean supportsType(String typeId) {
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- if(((Configuration)cfg).supportsType(typeId))
+ if (((Configuration) cfg).supportsType(typeId))
return true;
}
return false;
@@ -648,7 +650,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
public boolean supportsValue(String typeId, String valueId) {
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- if(((Configuration)cfg).supportsValue(typeId, valueId))
+ if (((Configuration) cfg).supportsValue(typeId, valueId))
return true;
}
return false;
@@ -659,7 +661,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
List<String> result = new ArrayList<String>();
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- result.addAll(Arrays.asList(((Configuration)cfg).getRequiredTypeIds()));
+ result.addAll(Arrays.asList(((Configuration) cfg).getRequiredTypeIds()));
}
return result.toArray(new String[result.size()]);
}
@@ -669,7 +671,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
List<String> result = new ArrayList<String>();
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- result.addAll(Arrays.asList(((Configuration)cfg).getSupportedTypeIds()));
+ result.addAll(Arrays.asList(((Configuration) cfg).getSupportedTypeIds()));
}
return result.toArray(new String[result.size()]);
}
@@ -679,7 +681,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
List<String> result = new ArrayList<String>();
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- result.addAll(Arrays.asList(((Configuration)cfg).getSupportedValueIds(typeId)));
+ result.addAll(Arrays.asList(((Configuration) cfg).getSupportedValueIds(typeId)));
}
return result.toArray(new String[result.size()]);
}
@@ -688,7 +690,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
public boolean requiresType(String typeId) {
IConfiguration cfgs[] = getConfigurations();
for (IConfiguration cfg : cfgs) {
- if(((Configuration)cfg).requiresType(typeId))
+ if (((Configuration) cfg).requiresType(typeId))
return true;
}
return false;

Back to the top