diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java index 6399b4165e5..6b8ba50656d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java @@ -45,6 +45,19 @@ public interface IConfiguration extends IBuildObject { */ public ITool[] getTools(); + /** + * Answers true the receiver has changes that need to be saved + * in the project file, else false. + * + * @return boolean + */ + public boolean isDirty(); + + /** + * @param isDirty + */ + public void setDirty(boolean isDirty); + /** * Sets the name of the receiver to the value specified in the argument * @@ -57,6 +70,7 @@ public interface IConfiguration extends IBuildObject { * * @param option The option to change. * @param value The value to apply to the option. + * * @throws BuildException */ public void setOption(IOption option, boolean value) @@ -67,6 +81,8 @@ public interface IConfiguration extends IBuildObject { * * @param option The option that will be effected by change. * @param value The value to apply to the option. + * + * @throws BuildException */ public void setOption(IOption option, String value) throws BuildException; @@ -76,6 +92,8 @@ public interface IConfiguration extends IBuildObject { * * @param option The option to change. * @param value The values to apply to the option. + * + * @throws BuildException */ public void setOption(IOption option, String[] value) throws BuildException; @@ -83,8 +101,8 @@ public interface IConfiguration extends IBuildObject { /** * Overrides the tool command for a tool defined in the receiver. * - * @param tool - * @param command + * @param tool The tool that will have its command modified + * @param command The command */ public void setToolCommand(ITool tool, String command); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java index 201dc8ea48a..b9acca8b7ed 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java @@ -66,6 +66,11 @@ public interface ITarget extends IBuildObject { */ public String getArtifactName(); + /** + * @param isDirty + */ + public void setDirty(boolean isDirty); + /** * Answers the unique ID of the binary parser associated with the target. * @@ -171,6 +176,14 @@ public interface ITarget extends IBuildObject { * @return boolean */ public boolean isAbstract(); + + /** + * Answers true the receiver has changes that need to be saved + * in the project file, else false. + * + * @return boolean + */ + public boolean isDirty(); /** * Answers true if the receiver is a target that is defined @@ -232,5 +245,4 @@ public interface ITarget extends IBuildObject { * @param resource */ public void updateOwner(IResource resource); - } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 0bc952db459..27d65f99fbc 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -35,6 +35,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.internal.core.ToolReference; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.internal.core.Target; import org.eclipse.cdt.managedbuilder.internal.core.Tool; @@ -206,18 +207,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI * @param config * @param option */ - private static void setDirty(IConfiguration config, IOption option) { - // Set the build info dirty so builder will rebuild - IResource resource = config.getOwner(); - IManagedBuildInfo info = getBuildInfo(resource); - info.setDirty(true); - + private static void notifyListeners(IConfiguration config, IOption option) { // Continue if change is something that effect the scanner if (!(option.getValueType() == IOption.INCLUDE_PATH || option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) { return; } // Figure out if there is a listener for this change + IResource resource = config.getOwner(); List listeners = (List) getBuildModelListeners().get(resource); if (listeners == null) { return; @@ -237,8 +234,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI */ public static void setOption(IConfiguration config, IOption option, boolean value) { try { + // Request a value change and set dirty if real change results config.setOption(option, value); - setDirty(config, option); + notifyListeners(config, option); } catch (BuildException e) { return; } @@ -254,7 +252,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI public static void setOption(IConfiguration config, IOption option, String value) { try { config.setOption(option, value); - setDirty(config, option); + notifyListeners(config, option); } catch (BuildException e) { return; } @@ -270,19 +268,35 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI public static void setOption(IConfiguration config, IOption option, String[] value) { try { config.setOption(option, value); - setDirty(config, option); + notifyListeners(config, option); } catch (BuildException e) { return; } } + /** + * @param config + * @param tool + * @param command + */ + public static void setToolCommand(IConfiguration config, ITool tool, String command) { + // The tool may be a reference. + if (tool instanceof ToolReference) { + // If so, just set the command in the reference + ((ToolReference)tool).setToolCommand(command); + } else { + config.setToolCommand(tool, command); + } + } + /** * Saves the build information associated with a project and all resources * in the project to the build info file. * * @param project + * @param force */ - public static void saveBuildInfo(IProject project) { + public static void saveBuildInfo(IProject project, boolean force) { // Create document Document doc = new DocumentImpl(); Element rootElement = doc.createElement(ROOT_ELEM_NAME); @@ -290,30 +304,31 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI // Save the build info ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project); - if (buildInfo != null) + if (buildInfo != null && (force == true || buildInfo.isDirty())) { buildInfo.serialize(doc, rootElement); - // Save the document - ByteArrayOutputStream s = new ByteArrayOutputStream(); - OutputFormat format = new OutputFormat(); - format.setIndenting(true); - format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ - String xml = null; - try { - Serializer serializer + // Save the document + ByteArrayOutputStream s = new ByteArrayOutputStream(); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ + String xml = null; + try { + Serializer serializer = SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format); //$NON-NLS-1$ - serializer.asDOMSerializer().serialize(doc); - xml = s.toString("UTF8"); //$NON-NLS-1$ - IFile rscFile = project.getFile(FILE_NAME); - InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); - // update the resource content - if (rscFile.exists()) { - rscFile.setContents(inputStream, IResource.FORCE, null); - } else { - rscFile.create(inputStream, IResource.FORCE, null); + serializer.asDOMSerializer().serialize(doc); + xml = s.toString("UTF8"); //$NON-NLS-1$ + IFile rscFile = project.getFile(FILE_NAME); + InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); + // update the resource content + if (rscFile.exists()) { + rscFile.setContents(inputStream, IResource.FORCE, null); + } else { + rscFile.create(inputStream, IResource.FORCE, null); + } + } catch (Exception e) { + return; } - } catch (Exception e) { - return; } } @@ -542,7 +557,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI if (buildInfo == null && create) { try { + // Create a new build info object for the project buildInfo = new ManagedBuildInfo(resource); + // Associate the build info with the project for the duration of the session resource.setSessionProperty(buildInfoProperty, buildInfo); } catch (CoreException e) { buildInfo = null; @@ -668,5 +685,5 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI public static IConfigurationElement getConfigElement(IBuildObject buildObj) { return (IConfigurationElement)getConfigElementMap().get(buildObj); } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java index c9e65438b12..bb87dbc6af5 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java @@ -33,11 +33,11 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Configuration extends BuildObject implements IConfiguration { - - private ITarget target; + private boolean isDirty = false; private IConfiguration parent; - private List toolReferences; private boolean resolved = true; + private ITarget target; + private List toolReferences; /** * Build a configuration from the project manifest file. @@ -307,6 +307,14 @@ public class Configuration extends BuildObject implements IConfiguration { return tools; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty() + */ + public boolean isDirty() { + return isDirty; + } + + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent() */ @@ -418,15 +426,27 @@ public class Configuration extends BuildObject implements IConfiguration { element.appendChild(toolRefElement); toolRef.serialize(doc, toolRefElement); } + + // I am clean now + isDirty = false; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean) + */ + public void setDirty(boolean isDirty) { + this.isDirty = isDirty; + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean) */ public void setOption(IOption option, boolean value) throws BuildException { // Is there a delta - if (option.getBooleanValue() != value) + if (option.getBooleanValue() != value) { createOptionReference(option).setValue(value); + isDirty = true; + } } /* (non-Javadoc) @@ -441,8 +461,10 @@ public class Configuration extends BuildObject implements IConfiguration { else { oldValue = option.getStringValue(); } - if (oldValue != null && !oldValue.equals(value)) + if (oldValue != null && !oldValue.equals(value)) { createOptionReference(option).setValue(value); + isDirty = true; + } } /* (non-Javadoc) @@ -471,8 +493,10 @@ public class Configuration extends BuildObject implements IConfiguration { oldValue = new String[0]; break; } - if(!Arrays.equals(value, oldValue)) + if(!Arrays.equals(value, oldValue)) { createOptionReference(option).setValue(value); + isDirty = true; + } } /* (non-Javadoc) @@ -489,8 +513,9 @@ public class Configuration extends BuildObject implements IConfiguration { } // Set the ref's command if (ref != null) { - ref.setToolCommand(command); + isDirty = ref.setToolCommand(command); } } } + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java index 44e9527d84b..b61c618c7da 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java @@ -45,8 +45,10 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { public static final String MINOR_SEPERATOR = "::"; //$NON-NLS-1$ private static final QualifiedName defaultConfigProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultConfig"); //$NON-NLS-1$ private static final QualifiedName defaultTargetProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultTarget"); //$NON-NLS-1$ + private String defaultConfigIds; private Map defaultConfigMap; private ITarget defaultTarget; + private String defaultTargetId; private boolean isDirty; private IResource owner; private Map targetMap; @@ -58,8 +60,28 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { * @param owner */ public ManagedBuildInfo(IResource owner) { - targetList = new ArrayList(); this.owner = owner; + isDirty = false; + + // The id of the default target from the project persistent settings store + IProject project = (IProject)owner; + defaultTargetId = null; + try { + defaultTargetId = project.getPersistentProperty(defaultTargetProperty); + } catch (CoreException e) { + // We have all the build elements so we can stop if this occurs + return; + } + + // Get the default configs for every target out of the same store + defaultConfigIds = null; + try { + defaultConfigIds = project.getPersistentProperty(defaultConfigProperty); + } catch (CoreException e) { + // Again, hitting this error just means the default config is not set + return; + } + } /** @@ -70,7 +92,6 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { * @param element */ public ManagedBuildInfo(IResource owner, Element element) { - // Store the IProject the info is for this(owner); // Read in the top-level info objects @@ -81,70 +102,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { } child = child.getNextSibling(); } - - // The id of the default configuration from the persistent store - IProject project = (IProject)getOwner(); - String defaultTargetId = null; - try { - defaultTargetId = project.getPersistentProperty(defaultTargetProperty); - } catch (CoreException e) { - // We have all the build elements so we can stop if this occurs - return; - } - - // All targets have been read in so set the default from the persisted ID - if (defaultTargetId != null) { - defaultTarget = (ITarget) getTargetMap().get(defaultTargetId); - } - - // Get the string of all default config IDs from the store - String defaultIds = null; - try { - defaultIds = project.getPersistentProperty(defaultConfigProperty); - } catch (CoreException e1) { - // Again, hitting this error just means the default config is not set - return; - } - if (defaultIds != null) { - String[] majorTokens = defaultIds.split(MAJOR_SEPERATOR); - for (int index = majorTokens.length - 1; index >= 0; --index) { - // Now split each token into the target and config id component - String idToken = majorTokens[index]; - if (idToken != null) { - String[] minorTokens = idToken.split(MINOR_SEPERATOR); - // The first token is the target ID - ITarget target = getTarget(minorTokens[0]); - // The second is the configuration ID - IConfiguration config = target.getConfiguration(minorTokens[1]); - if (config != null) { - getDefaultConfigMap().put(target.getId(), config); - } - } - } - } - -/* // Now we have a miserable O(N^2) operation (oh well, the data sets are small) - ListIterator stringIter = configIds.listIterator(); - while (stringIter.hasNext()){ - String confId = (String) stringIter.next(); - ListIterator targIter = targetList.listIterator(); - while (targIter.hasNext()) { - Target targ = (Target) targIter.next(); - IConfiguration conf = targ.getConfiguration(confId); - if (conf != null) { - defaultConfigMap.put(targ.getId(), conf); - break; - } - } - } -*/ } + } /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget) */ public void addTarget(ITarget target) { getTargetMap().put(target.getId(), target); - targetList.add(target); + getTargets().add(target); } /* (non-Javadoc) @@ -250,6 +215,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { private Map getDefaultConfigMap() { if (defaultConfigMap == null) { defaultConfigMap = new HashMap(); + // We read this as part of the constructor + if (defaultConfigIds != null) { + String[] majorTokens = defaultConfigIds.split(MAJOR_SEPERATOR); + for (int index = majorTokens.length - 1; index >= 0; --index) { + // Now split each token into the target and config id component + String idToken = majorTokens[index]; + if (idToken != null) { + String[] minorTokens = idToken.split(MINOR_SEPERATOR); + // The first token is the target ID + ITarget target = getTarget(minorTokens[0]); + if (target == null) continue; + // The second is the configuration ID + IConfiguration config = target.getConfiguration(minorTokens[1]); + if (config != null) { + defaultConfigMap.put(target.getId(), config); + } + } + } + } } return defaultConfigMap; } @@ -276,7 +260,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { */ public ITarget getDefaultTarget() { if (defaultTarget == null) { - defaultTarget = (ITarget) targetList.get(0); + // See if there is a target that was persisted + if (defaultTargetId != null) { + defaultTarget = (ITarget) getTargetMap().get(defaultTargetId); + } + // If that failed, look for anything + if (defaultTarget == null) { + defaultTarget = (ITarget) getTargets().get(0); + } } return defaultTarget; } @@ -709,6 +700,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration) */ public List getTargets() { + if (targetList == null) { + targetList = new ArrayList(); + } return targetList; } @@ -840,7 +834,20 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty() */ public boolean isDirty() { - return isDirty; + // If the info has been flagged dirty, answer true + if (isDirty) { + return true; + } + + // Check if any of the defined targets are dirty + Iterator iter = getTargets().listIterator(); + while (iter.hasNext()) { + if (((ITarget)iter.next()).isDirty()) { + return true; + } + } + + return false; } /* (non-Javadoc) @@ -877,27 +884,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { return false; } - /** - * Write the contents of the build model to the persistent store specified in the - * argument. + + /* (non-Javadoc) * - * @param doc - * @param element */ - public void serialize(Document doc, Element element) { + private void persistDefaultConfigurations() { // Create a buffer of the default configuration IDs StringBuffer defaultConfigs = new StringBuffer(); - - // Write out each target and their default config - Iterator iter = targetList.listIterator(); + Iterator iter = getTargets().listIterator(); while (iter.hasNext()) { - // Get the target - Target targ = (Target)iter.next(); - // Create an XML element to hold the target settings - Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME); - element.appendChild(targetElement); - targ.serialize(doc, targetElement); // Persist the default target configuration pair as :: + ITarget targ = (ITarget)iter.next(); IConfiguration config = getDefaultConfiguration((ITarget)targ); if (config != null) { defaultConfigs.append(targ.getId()); @@ -906,65 +903,105 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { defaultConfigs.append(MAJOR_SEPERATOR); } } - -/* for (int i = 0; i < targets.size(); ++i) { - Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME); - element.appendChild(targetElement); - ((Target)targets.get(i)).serialize(doc, targetElement); - IConfiguration config = getDefaultConfiguration((ITarget)targets.get(i)); - if (config != null) { - Element configEl = doc.createElement(DEFAULT_CONFIGURATION); - element.appendChild(configEl); - configEl.setAttribute(IConfiguration.ID, config.getId()); - } + // Persist the default configurations + IProject project = (IProject) getOwner(); + try { + project.setPersistentProperty(defaultConfigProperty, defaultConfigs.toString().trim()); + } catch (CoreException e) { + // Too bad } -*/ // Persist the default target as a project setting + } + + /* (non-Javadoc) + * + */ + private void persistDefaultTarget() { + // Persist the default target as a project setting IProject project = (IProject) getOwner(); ITarget defTarget = getDefaultTarget(); if (defTarget != null){ try { project.setPersistentProperty(defaultTargetProperty, defTarget.getId()); } catch (CoreException e) { - // There is no point in storing the default configurations - return; + // Tough } } - - try { - // Persist the default configurations - project.setPersistentProperty(defaultConfigProperty, defaultConfigs.toString().trim()); - } catch (CoreException e) { - // Too bad + } + + /** + * Write the contents of the build model to the persistent store + * specified in the argument. + * + * @param doc + * @param element + */ + public void serialize(Document doc, Element element) { + // Write out each target + Iterator iter = getTargets().listIterator(); + while (iter.hasNext()) { + // Get the target + Target targ = (Target)iter.next(); + // Create an XML element to hold the target settings + Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME); + element.appendChild(targetElement); + targ.serialize(doc, targetElement); } - + // Remember the default target and configurations + persistDefaultTarget(); + persistDefaultConfigurations(); + // I'm clean now + setDirty(false); } /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration) */ public void setDefaultConfiguration(IConfiguration configuration) { + // Sanity + if (configuration== null) return; + // Get the target associated with the argument ITarget target = configuration.getTarget(); - // Make sure it is the default - setDefaultTarget(target); - getDefaultConfigMap().put(target.getId(), configuration); + + // See if there is anything to be done + IConfiguration oldDefault = getDefaultConfiguration(target); + if (!configuration.equals(oldDefault)) { + // Make sure it is the default + setDefaultTarget(target); + // Make the argument the + getDefaultConfigMap().put(target.getId(), configuration); + // Save it + persistDefaultConfigurations(); + } } /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget) */ public void setDefaultTarget(ITarget target) { - if (defaultTarget != null && defaultTarget.getId().equals(target.getId())) { - return; + // Sanity + if (target == null) return; + + // Make sure there is something to change + if (!target.equals(defaultTarget)) { + defaultTarget = target; + defaultTargetId = target.getId(); + persistDefaultTarget(); } - defaultTarget = target; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean) */ public void setDirty(boolean isDirty) { + // Reset the dirty status here this.isDirty = isDirty; + // and in the contained targets + Iterator iter = getTargets().listIterator(); + while (iter.hasNext()) { + ITarget target = (ITarget)iter.next(); + target.setDirty(isDirty); + } } /** @@ -979,7 +1016,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { if (!owner.equals(resource)) { owner = resource; // Do the same for the targets - Iterator iter = targetList.listIterator(); + Iterator iter = getTargets().listIterator(); while(iter.hasNext()) { ITarget target = (ITarget) iter.next(); target.updateOwner(resource); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java index 8ce66c321ea..9cc271aa90e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java @@ -37,11 +37,12 @@ public class Target extends BuildObject implements ITarget { private String artifactName; private String binaryParserId; private String cleanCommand; + private List configList; private Map configMap; - private List configurations; private String defaultExtension; private String extension; private boolean isAbstract = false; + private boolean isDirty = false; private boolean isTest = false; private String makeArguments; private String makeCommand; @@ -252,12 +253,10 @@ public class Target extends BuildObject implements ITarget { ToolReference current = (ToolReference)refIter.next(); current.resolveReferences(); } - if (configurations != null) { - Iterator configIter = configurations.iterator(); - while (configIter.hasNext()) { - Configuration current = (Configuration)configIter.next(); - current.resolveReferences(); - } + Iterator configIter = getConfigurationList().iterator(); + while (configIter.hasNext()) { + Configuration current = (Configuration)configIter.next(); + current.resolveReferences(); } } } @@ -267,12 +266,13 @@ public class Target extends BuildObject implements ITarget { */ public void removeConfiguration(String id) { // Remove the specified configuration from the list and map - Iterator iter = configurations.listIterator(); + Iterator iter = getConfigurationList().listIterator(); while (iter.hasNext()) { IConfiguration config = (IConfiguration)iter.next(); if (config.getId().equals(id)) { - configurations.remove(config); - configMap.remove(id); + getConfigurationList().remove(config); + getConfigurationMap().remove(id); + isDirty = true; break; } } @@ -310,14 +310,18 @@ public class Target extends BuildObject implements ITarget { if (makeArguments != null) { element.setAttribute(MAKE_ARGS, makeArguments); } - - if (configurations != null) - for (int i = 0; i < configurations.size(); ++i) { - Configuration config = (Configuration)configurations.get(i); - Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME); - element.appendChild(configElement); - config.serialize(doc, configElement); - } + + // Serialize the configuration settings + Iterator iter = getConfigurationList().listIterator(); + while (iter.hasNext()) { + Configuration config = (Configuration) iter.next(); + Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME); + element.appendChild(configElement); + config.serialize(doc, configElement); + } + + // I am clean now + isDirty = false; } /* (non-javadoc) @@ -566,14 +570,35 @@ public class Target extends BuildObject implements ITarget { getToolMap().put(tool.getId(), tool); } + /* (non-Javadoc) + * Safe accessor for the list of configurations. + * + * @return List containing the configurations + */ + private List getConfigurationList() { + if (configList == null) { + configList = new ArrayList(); + } + return configList; + } + + /* (non-Javadoc) + * Safe accessor for the map of configuration ids to configurations + * + * @return + */ + private Map getConfigurationMap() { + if (configMap == null) { + configMap = new HashMap(); + } + return configMap; + } + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations() */ public IConfiguration[] getConfigurations() { - if (configurations != null) - return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]); - else - return emptyConfigs; + return (IConfiguration[])getConfigurationList().toArray(new IConfiguration[getConfigurationList().size()]); } @@ -665,19 +690,15 @@ public class Target extends BuildObject implements ITarget { * @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration() */ public IConfiguration getConfiguration(String id) { - return (IConfiguration)configMap.get(id); + return (IConfiguration)getConfigurationMap().get(id); } /** * @param configuration */ public void addConfiguration(IConfiguration configuration) { - if (configurations == null) { - configurations = new ArrayList(); - configMap = new HashMap(); - } - configurations.add(configuration); - configMap.put(configuration.getId(), configuration); + getConfigurationList().add(configuration); + getConfigurationMap().put(configuration.getId(), configuration); } /* (non-Javadoc) @@ -687,6 +708,25 @@ public class Target extends BuildObject implements ITarget { return isAbstract; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#isDirty() + */ + public boolean isDirty() { + // If I need saving, just say yes + if (isDirty) { + return true; + } + + // Iterate over the configurations and ask them if they need saving + Iterator iter = getConfigurationList().listIterator(); + while (iter.hasNext()) { + if (((IConfiguration)iter.next()).isDirty()) { + return true; + } + } + + return false; + } /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.ITarget#isTestTarget() */ @@ -705,6 +745,7 @@ public class Target extends BuildObject implements ITarget { * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration) */ public IConfiguration createConfiguration(IConfiguration parent, String id) { + isDirty = true; return new Configuration(this, parent, id); } @@ -723,6 +764,7 @@ public class Target extends BuildObject implements ITarget { public void setArtifactExtension(String extension) { if (extension != null) { this.extension = extension; + isDirty = true; } } @@ -731,16 +773,32 @@ public class Target extends BuildObject implements ITarget { */ public void setArtifactName(String name) { if (name != null) { - artifactName = name; + artifactName = name; + isDirty = true; } } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#setDirty(boolean) + */ + public void setDirty(boolean isDirty) { + // Override the dirty flag here + this.isDirty = isDirty; + // and in the configurations + Iterator iter = getConfigurationList().listIterator(); + while (iter.hasNext()) { + IConfiguration config = (IConfiguration)iter.next(); + config.setDirty(isDirty); + } + } + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.ITarget#setMakeArguments(java.lang.String) */ public void setMakeArguments(String makeArgs) { if (makeArgs != null && !getMakeArguments().equals(makeArgs)) { makeArguments = makeArgs; + isDirty = true; } } @@ -750,6 +808,7 @@ public class Target extends BuildObject implements ITarget { public void setMakeCommand(String command) { if (command != null && !getMakeCommand().equals(command)) { makeCommand = command; + isDirty = true; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java index 624f500cd42..133c0ec2ab8 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java @@ -366,10 +366,14 @@ public class ToolReference extends AbstractToolReference { * Sets the command in the receiver to be the argument. * * @param cmd - */ - public void setToolCommand(String cmd) { + * @return true if the call results in a chnaged command, else false + */ + public boolean setToolCommand(String cmd) { if (cmd != null && !cmd.equals(command)) { command = cmd; + return true; + } else { + return false; } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index 2abdd9dddaf..b02d4f6d41d 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -31,8 +31,8 @@ icon="icons/full/wizban/newmngcc_app.gif" category="org.eclipse.cdt.ui.newCCWizards" class="org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedCCProjectWizard" - finalPerspective="org.eclipse.cdt.ui.CPerspective" project="true" + finalPerspective="org.eclipse.cdt.ui.CPerspective" id="org.eclipse.cdt.managedbuilder.ui.wizards.StdCCWizard"> %MngCCWizard.description @@ -43,8 +43,8 @@ icon="icons/full/wizban/newmngc_app.gif" category="org.eclipse.cdt.ui.newCWizards" class="org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedCProjectWizard" - finalPerspective="org.eclipse.cdt.ui.CPerspective" project="true" + finalPerspective="org.eclipse.cdt.ui.CPerspective" id="org.eclipse.cdt.managedbuilder.ui.wizards.StdCWizard"> %MngCWizard.description @@ -54,8 +54,8 @@ @@ -82,12 +82,12 @@ osList="win32"> + valueType="boolean" + id="cygwin.gnu.c.compiler.preprocessor.nostdinc"> + valueType="definedSymbols" + id="cygwin.gnu.c.preprocessor.def.symbols"> + value="_X86_=1" + builtIn="true"> + value="__OPTIMIZE__" + builtIn="true"> + value="__STDC_HOSTED__=1" + builtIn="true"> + value="i386" + builtIn="true"> + value="__i386" + builtIn="true"> + value="__i386__" + builtIn="true"> + value="__tune_i686__" + builtIn="true"> + value="__tune_pentiumpro__" + builtIn="true"> + value="__tune_pentium2__" + builtIn="true"> + value="__tune_pentium3__" + builtIn="true"> + value="__stdcall=__attribute__((__stdcall__))" + builtIn="true"> + value="__fastcall=__attribute__((__fastcall__))" + builtIn="true"> + value="__cdecl=__attribute__((__cdecl__))" + builtIn="true"> + value="_stdcall=__attribute__((__stdcall__))" + builtIn="true"> + value="_fastcall=__attribute__((__fastcall__))" + builtIn="true"> + value="_cdecl=__attribute__((__cdecl__))" + builtIn="true"> + value="__declspec(x)=__attribute__((x))" + builtIn="true"> + value="__CYGWIN32__" + builtIn="true"> - + value="unix" + builtIn="true"> + value="__unix__" + builtIn="true"> + value="__unix" + builtIn="true"> + valueType="includePath" + id="cygwin.gnu.c.compiler.general.include.paths"> + value="C:\Cygwin\usr\include" + builtIn="true"> + value="C:\cygwin\usr\include\w32api" + builtIn="true"> + valueType="enumerated" + id="cygwin.gnu.c.compiler.general.optimization.level"> + valueType="string" + id="cygwin.gnu.c.compiler.optimization.flags"> + valueType="enumerated" + id="cygwin.c.compiler.debugging.level"> + valueType="boolean" + id="cygwin.gnu.c.compiler.warnings.syntax"> + valueType="string" + id="cygwin.gnu.c.compiler.misc.other"> + valueType="boolean" + id="cygwin.gnu.compiler.preprocessor.nostdinc"> + valueType="definedSymbols" + id="cygwin.preprocessor.def.symbols"> + value="_X86_=1" + builtIn="true"> + value="__OPTIMIZE__" + builtIn="true"> + value="__STDC_HOSTED__=1" + builtIn="true"> + value="i386" + builtIn="true"> + value="__i386" + builtIn="true"> + value="__i386__" + builtIn="true"> + value="__tune_i686__" + builtIn="true"> + value="__tune_pentiumpro__" + builtIn="true"> + value="__tune_pentium2__" + builtIn="true"> + value="__tune_pentium3__" + builtIn="true"> + value="__stdcall=__attribute__((__stdcall__))" + builtIn="true"> + value="__fastcall=__attribute__((__fastcall__))" + builtIn="true"> + value="__cdecl=__attribute__((__cdecl__))" + builtIn="true"> + value="_stdcall=__attribute__((__stdcall__))" + builtIn="true"> + value="_fastcall=__attribute__((__fastcall__))" + builtIn="true"> + value="_cdecl=__attribute__((__cdecl__))" + builtIn="true"> + value="__declspec(x)=__attribute__((x))" + builtIn="true"> + value="__CYGWIN32__" + builtIn="true"> - - - - - - - + + + + + + + valueType="includePath" + id="cygwin.compiler.general.include.paths"> - - + value="C:\cygwin\usr\include\c++\3.3.1\i686-pc-cygwin"> + value="C:\cygwin\usr\include\c++\3.3.1\backward" + builtIn="true"> + value="C:\cygwin\lib\gcc-lib\i686-pc-cygwin\3.3.1\include" + builtIn="true"> + value="C:\cygwin\usr\include" + builtIn="true"> + + + valueType="enumerated" + id="cygwin.compiler.general.optimization.level"> + valueType="string" + id="cygwin.compiler.optimization.flags"> + valueType="enumerated" + id="cygwin.compiler.debugging.level"> + valueType="boolean" + id="cygwin.gnu.compiler.warnings.syntax"> + valueType="string" + id="cygwin.compiler.misc.other"> @@ -836,8 +836,8 @@ natureFilter="cnature" name="%ToolName.linker.c" outputFlag="-o" - command="gcc" outputs="exe" + command="gcc" id="cdt.build.tool.cygwin.c.link"> + valueType="boolean" + id="cygwin.gnu.c.link.options.nostart"> + valueType="libs" + id="cygwin.gnu.c.link.libs"> + valueType="boolean" + id="cygwin.gnu.linker.options.nostart"> + valueType="libs" + id="cygwin.link.libs"> @@ -1092,9 +1094,9 @@ natureFilter="cnature" name="%ToolName.linker.c" outputFlag="-o" - command="gcc" - outputPrefix="lib" outputs="dll" + outputPrefix="lib" + command="gcc" id="cdt.build.tool.cygwin.c.solink"> + valueType="boolean" + id="cygwin.gnu.c.solink.options.nostart"> + valueType="libs" + id="cygwin.gnu.c.solink.libs"> + valueType="boolean" + id="cygwin.gnu.solink.options.nostart"> + valueType="libs" + id="cygwin.solink.libs"> @@ -1322,9 +1324,9 @@ natureFilter="ccnature" name="%ToolName.linker.cpp" outputFlag="-o" - command="g++ -shared" - outputPrefix="cyg" outputs="dll" + outputPrefix="cyg" + command="g++ -shared" id="org.eclipse.cdt.build.tool.cygwin.explink"> + valueType="string" + id="cygwin.explink.ld.flags"> @@ -1420,9 +1422,9 @@ + valueType="string" + id="cygwin.ar.flags"> @@ -1450,12 +1452,12 @@ osList="linux"> + valueType="boolean" + id="linux.gnu.c.compiler.preprocessor.nostdinc"> + valueType="definedSymbols" + id="linux.gnu.c.preprocessor.def.symbols"> + value="__ELF__" + builtIn="true"> + value="unix" + builtIn="true"> + value="__gnu_linux__" + builtIn="true"> + value="linux" + builtIn="true"> + value="__unix__" + builtIn="true"> + value="__linux__" + builtIn="true"> + value="__unix" + builtIn="true"> + value="__linux" + builtIn="true"> + value="__OPTIMIZE__" + builtIn="true"> + value="__STDC_HOSTED__=1" + builtIn="true"> + value="_GNU_SOURCE" + builtIn="true"> + value="i386" + builtIn="true"> + value="__i386" + builtIn="true"> + value="__i386__" + builtIn="true"> + value="__tune_i386__" + builtIn="true"> + valueType="includePath" + id="linux.gnu.c.compiler.general.include.paths"> + valueType="enumerated" + id="linux.gnu.c.compiler.general.optimization.level"> + valueType="string" + id="linux.gnu.c.compiler.optimization.flags"> + valueType="enumerated" + id="linux.c.compiler.debugging.level"> + valueType="string" + id="linux.gnu.c.compiler.debugging.other"> + valueType="boolean" + id="linux.gnu.c.compiler.warnings.syntax"> + valueType="string" + id="linux.gnu.c.compiler.misc.other"> + valueType="boolean" + id="linux.gnu.compiler.preprocessor.nostdinc"> + valueType="includePath" + id="linux.gnu.compiler.dirs.incpaths"> + value="/usr/local/include" + builtIn="true"> + value="/usr/include" + builtIn="true"> + valueType="enumerated" + id="linux.gnu.compiler.optimization.level"> + valueType="string" + id="linux.compiler.optimization.flags"> + valueType="enumerated" + id="linux.gnu.compiler.debugging.level"> + valueType="string" + id="linux.gnu.compiler.debugging.other"> + valueType="boolean" + id="linux.gnu.compiler.warnings.syntax"> + valueType="string" + id="linux.gnu.compiler.other.other"> @@ -2113,40 +2115,40 @@ name="%Option.Posix.Linker.NoStartFiles" category="linux.gnu.c.linker.category.general" command="-nostartfiles" - id="linux.gnu.c.link.options.nostart" - valueType="boolean"> + valueType="boolean" + id="linux.gnu.c.link.options.nostart"> + valueType="libs" + id="linux.gnu.c.link.libs"> + valueType="string" + id="linux.gnu.c.link.ldflags"> @@ -2209,40 +2211,40 @@ name="%Option.Posix.Linker.NoStartFiles" category="linux.gnu.linker.category.options" command="-nostartfiles" - id="linux.gnu.linker.options.nostart" - valueType="boolean"> + valueType="boolean" + id="linux.gnu.linker.options.nostart"> + valueType="libs" + id="linux.gnu.linker.libs.libs"> + valueType="string" + id="linux.gnu.linker.libs.flags"> @@ -2351,12 +2353,12 @@ + valueType="boolean" + id="linux.gnu.c.solink.options.nostart"> + valueType="libs" + id="linux.gnu.c.solink.libs"> + valueType="string" + id="linux.gnu.c.solink.ldflags"> + valueType="boolean" + id="linux.gnu.solink.options.nostart"> + valueType="libs" + id="linux.gnu.solink.libs.libs"> + valueType="string" + id="linux.gnu.solink.libs.flags"> @@ -2602,11 +2604,11 @@ + valueType="string" + id="linux.gnu.lib.flags"> @@ -2634,12 +2636,12 @@ osList="solaris"> + valueType="boolean" + id="solaris.gnu.c.compiler.preprocessor.nostdinc"> + valueType="definedSymbols" + id="solaris.gnu.c.preprocessor.def.symbols"> + value="sun" + builtIn="true"> + value="sparc" + builtIn="true"> + value="unix" + builtIn="true"> + value="__svr4__" + builtIn="true"> + value="__SVR4" + builtIn="true"> + value="__GCC_NEW_VARARGS__" + builtIn="true"> + value="__sun__" + builtIn="true"> + value="__sparc__" + builtIn="true"> + value="__unix__" + builtIn="true"> + value="__sun" + builtIn="true"> + value="__sparc" + builtIn="true"> + value="__unix" + builtIn="true"> + value="__OPTIMIZE__" + builtIn="true"> + valueType="includePath" + id="solaris.gnu.c.compiler.general.include.paths"> + valueType="enumerated" + id="solaris.gnu.c.compiler.general.optimization.level"> + valueType="string" + id="solaris.gnu.c.compiler.optimization.flags"> + valueType="enumerated" + id="solaris.c.compiler.debugging.level"> + valueType="string" + id="solaris.gnu.c.compiler.debugging.other"> + valueType="boolean" + id="solaris.gnu.c.compiler.warnings.syntax"> + valueType="string" + id="solaris.gnu.c.compiler.misc.other"> + valueType="boolean" + id="solaris.gnu.compiler.preprocessor.nostdinc"> + valueType="includePath" + id="solaris.gnu.compiler.dirs.incpaths"> + value="/usr/local/include" + builtIn="true"> + value="/usr/include" + builtIn="true"> + valueType="enumerated" + id="solaris.gnu.compiler.optimization.level"> + valueType="string" + id="solaris.compiler.optimization.flags"> + valueType="enumerated" + id="solaris.gnu.compiler.debugging.level"> + valueType="string" + id="solaris.gnu.compiler.debugging.other"> + valueType="boolean" + id="solaris.gnu.compiler.warnings.syntax"> + valueType="string" + id="solaris.gnu.compiler.other.other"> @@ -3274,40 +3276,40 @@ name="%Option.Posix.Linker.NoStartFiles" category="solaris.gnu.c.linker.category.general" command="-nostartfiles" - id="solaris.gnu.c.link.options.nostart" - valueType="boolean"> + valueType="boolean" + id="solaris.gnu.c.link.options.nostart"> + valueType="libs" + id="solaris.gnu.c.link.libs"> + valueType="string" + id="solaris.gnu.c.link.ldflags"> @@ -3370,40 +3372,40 @@ name="%Option.Posix.Linker.NoStartFiles" category="solaris.gnu.linker.category.options" command="-nostartfiles" - id="solaris.gnu.linker.options.nostart" - valueType="boolean"> + valueType="boolean" + id="solaris.gnu.linker.options.nostart"> + valueType="libs" + id="solaris.gnu.linker.libs.libs"> + valueType="string" + id="solaris.gnu.linker.libs.flags"> @@ -3516,12 +3518,12 @@ + valueType="boolean" + id="solaris.gnu.c.solink.options.nostart"> + valueType="libs" + id="solaris.gnu.c.solink.libs"> + valueType="string" + id="solaris.gnu.c.solink.ldflags"> + valueType="boolean" + id="solaris.gnu.solink.options.nostart"> + valueType="libs" + id="solaris.gnu.solink.libs.libs"> + valueType="string" + id="solaris.gnu.solink.libs.flags"> @@ -3767,11 +3769,11 @@ + valueType="string" + id="solaris.gnu.lib.flags"> diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties index 9365939c98a..438523caf6a 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties @@ -41,6 +41,7 @@ BuildPropertyPage.label.Configuration=Configuration: BuildPropertyPage.label.Active=Active configuration BuildPropertyPage.label.Settings=Configuration settings BuildPropertyPage.label.AddConfButton=Manage... +BuildPropertyPage.selection.configuration.all=All configurations BuildPropertyPage.label.ToolTree=Tools BuildPropertyPage.label.ToolOptions=Options BuildPropertyPage.tip.platform=Select a platform for the project diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java index c13407c8bd3..7e3eee63f47 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java @@ -75,6 +75,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert private static final String BUILD_TOOLS_LABEL = LABEL + ".BuildToolTree"; //$NON-NLS-1$ private static final String PLATFORM_LABEL = LABEL + ".Platform"; //$NON-NLS-1$ private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$ + private static final String ALL_CONFS = PREFIX + ".selection.configuration.all"; //$NON-NLS-1$ private static final String ACTIVE_LABEL = LABEL + ".Active"; //$NON-NLS-1$ private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$ private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$ @@ -453,8 +454,15 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert // If there is nothing in config selection widget just bail if (configSelector.getItemCount() == 0) return; - // Cache the selected config - selectedConfiguration = configurations[configSelector.getSelectionIndex()]; + // Check if the user has selected the "all" configuration + int selectionIndex = configSelector.getSelectionIndex(); + if (selectionIndex >= configurations.length) { + // This is the all config + return; + } else { + // Cache the selected config + selectedConfiguration = configurations[selectionIndex]; + } // Set the content provider for the list viewer ToolListContentProvider provider = new ToolListContentProvider(); @@ -768,7 +776,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert // Write out the build model info ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration()); - ManagedBuildManager.saveBuildInfo(getProject()); + ManagedBuildManager.saveBuildInfo(getProject(), false); return true; } @@ -782,6 +790,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert // Clear and replace the contents of the selector widget configSelector.removeAll(); configSelector.setItems(getConfigurationNames()); + configSelector.add(ManagedBuilderUIPlugin.getResourceString(ALL_CONFS)); // Make sure the active configuration is selected IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject()); diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java index 591b9a02aa2..8d867b56169 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.ITool; -import org.eclipse.cdt.managedbuilder.internal.core.ToolReference; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.swt.graphics.Point; @@ -77,13 +77,9 @@ public class BuildToolSettingsPage extends BuildSettingsPage { return result; } - // The tool may be a reference. - if (tool instanceof ToolReference) { - // If so, just set the command in the reference - ((ToolReference)tool).setToolCommand(command); - } else { - configuration.setToolCommand(tool, command); - } + // Ask the build system manager to change the tool command + ManagedBuildManager.setToolCommand(configuration, tool, command); + return result; } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java index c6de613cf6c..5614952afb3 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java @@ -35,11 +35,20 @@ public class BuildToolsSettingsStore implements IPreferenceStore { private boolean dirtyFlag; private IConfiguration owner; - public BuildToolsSettingsStore (IConfiguration config) { + /** + * + */ + public BuildToolsSettingsStore() { listenerList = new ListenerList(); - dirtyFlag = false; + dirtyFlag = false; + } + + /** + * @param config + */ + public BuildToolsSettingsStore (IConfiguration config) { + this(); owner = config; - // Now populate the options map populateSettingsMap(); } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java index 98da7ace621..7f2a9d36888 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java @@ -148,7 +148,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard { // Save the build options monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE)); - ManagedBuildManager.saveBuildInfo(newProject); + ManagedBuildManager.saveBuildInfo(newProject, true); monitor.done(); }