From e09b94f945a1f60ed6ae4684263bbcff69ac9a60 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Wed, 24 Sep 2003 14:20:49 +0000 Subject: [PATCH] Patch for Sean Evoy: This patch adds a "hook" for F1 help on the new managed project wizard configuration selection page. It also adds functionality to the managed build project property page to allow the user to edit the make command and build artifact name. They can also add and delete configurations from a target. There is no support for adding another target to a project in this release. --- .../ChangeLog | 10 + .../managedbuilder/core/IConfiguration.java | 8 + .../cdt/managedbuilder/core/ITarget.java | 38 +- .../managedbuilder/internal/core/Target.java | 86 ++++- .../ChangeLog | 22 ++ .../plugin.properties | 4 + .../plugin.xml | 64 ++-- .../ui/ManagedBuilderHelpContextIds.java | 22 ++ .../internal/ui/PluginResources.properties | 14 +- .../ui/properties/BuildPropertyPage.java | 90 ++++- .../ui/properties/ManageConfigDialog.java | 358 +++++++++++++++--- .../ui/properties/NewConfigurationDialog.java | 15 +- .../ui/wizards/CProjectPlatformPage.java | 9 +- core/org.eclipse.cdt.core.tests/ChangeLog | 10 + .../managed/tests/ManagedBuildTests.java | 91 ++++- core/org.eclipse.cdt.core.tests/plugin.xml | 1 - 16 files changed, 708 insertions(+), 134 deletions(-) create mode 100644 build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderHelpContextIds.java diff --git a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog index 55e3d673bab..22ec15c7bfa 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/ChangeLog +++ b/build/org.eclipse.cdt.managedbuilder.core/ChangeLog @@ -1,3 +1,13 @@ +2003-09-23 Sean Evoy + All the work in this patch is for critical bug 43292. In order to manage + configurations, there had to be a method through ITarget to remove + configurations. Also, to support the naming of newly created configurations, + I added a name method to the IConfiguration interface. Finally, the ITarget + needed to support setting (and resetting) the make command to use when building. + * src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java + * src/org/eclipse/cdt/managedbuilder/core/ITarget.java + * src/org/eclipse/cdt/managedbuilder/internal/core/Target.java + 2003-09-19 Sean Evoy Added a new field to the target specification in the build model to hard-code the binary parser for project creation. There is a new getter 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 24478ebd8e9..840b3d80e49 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,13 @@ public interface IConfiguration extends IBuildObject { */ public ITool[] getTools(); + /** + * Sets the name of the receiver to the value specified in the argument + * + * @param name + */ + public void setName(String name); + /** * Sets the value of a boolean option for this configuration. * @@ -72,4 +79,5 @@ public interface IConfiguration extends IBuildObject { */ public void setOption(IOption option, String[] value) throws BuildException; + } 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 4f7f11be028..010a97db574 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 @@ -33,8 +33,8 @@ public interface ITarget extends IBuildObject { * change in the parent, unoverridden values are updated in the child * config as well. * - * @param parent - * @param id + * @param parent The IConfiguration to use as a settings template + * @param id The unique id the new configuration will have * @return */ public IConfiguration createConfiguration(IConfiguration parent, String id); @@ -91,7 +91,7 @@ public interface ITarget extends IBuildObject { public String getMakeCommand(); /** - * Returns the configuration with the given id, or null if not found. + * Returns the configuration with the given id, or null if not found. * * @param id * @return @@ -118,6 +118,15 @@ public interface ITarget extends IBuildObject { */ public ITool[] getTools(); + + /** + * Answers true if the receiver has a make command that differs from its + * parent specification. + * + * @return + */ + public boolean hasOverridenMakeCommand(); + /** * Returns whether this target is abstract. * @return @@ -133,13 +142,32 @@ public interface ITarget extends IBuildObject { */ public boolean isTestTarget(); + /** + * Removes the configuration with the ID specified in the argument. + * + * @param id + */ + public void removeConfiguration(String id); + + /** + * Resets the make command in the receiver to the value specified in + * its parent. + * + */ + public void resetMakeCommand(); + /** * Set the name of the artifact that will be produced when the receiver * is built. * - * @param name The name of the build artifact. + * @param name */ public void setBuildArtifact(String name); - + /** + * Sets the make command for the receiver to the value in the argument. + * + * @param command + */ + public void setMakeCommand(String command); } 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 27b51690f84..a40912c2b60 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 @@ -1,3 +1,5 @@ +package org.eclipse.cdt.managedbuilder.internal.core; + /********************************************************************** * Copyright (c) 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -8,10 +10,10 @@ * Contributors: * IBM - Initial API and implementation **********************************************************************/ -package org.eclipse.cdt.managedbuilder.internal.core; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -26,11 +28,9 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; -/** - * - */ public class Target extends BuildObject implements ITarget { + // Build model elements that come from the plugin or project files private String artifactName; private String binaryParserId; private String cleanCommand; @@ -71,7 +71,6 @@ public class Target extends BuildObject implements ITarget { this.defaultExtension = parent.getDefaultExtension(); this.isTest = parent.isTestTarget(); this.cleanCommand = parent.getCleanCommand(); - this.makeCommand = parent.getMakeCommand(); // Hook me up IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner, true); @@ -190,7 +189,9 @@ public class Target extends BuildObject implements ITarget { cleanCommand = element.getAttribute(CLEAN_COMMAND); // Get the make command - makeCommand = element.getAttribute(MAKE_COMMAND); + if (element.hasAttribute(MAKE_COMMAND)) { + makeCommand = element.getAttribute(MAKE_COMMAND); + } Node child = element.getFirstChild(); while (child != null) { @@ -201,6 +202,29 @@ public class Target extends BuildObject implements ITarget { } } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#removeConfiguration(java.lang.String) + */ + public void removeConfiguration(String id) { + // Remove the specified configuration from the list and map + Iterator iter = configurations.listIterator(); + while (iter.hasNext()) { + IConfiguration config = (IConfiguration)iter.next(); + if (config.getId().equals(id)) { + configurations.remove(config); + configMap.remove(id); + break; + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#resetMakeCommand() + */ + public void resetMakeCommand() { + makeCommand = null; + } + /** * Persist receiver to project file. * @@ -218,7 +242,9 @@ public class Target extends BuildObject implements ITarget { element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension()); element.setAttribute(IS_TEST, isTest ? "true" : "false"); element.setAttribute(CLEAN_COMMAND, getCleanCommand()); - element.setAttribute(MAKE_COMMAND, getMakeCommand()); + if (makeCommand != null) { + element.setAttribute(MAKE_COMMAND, makeCommand); + } if (configurations != null) for (int i = 0; i < configurations.size(); ++i) { @@ -234,17 +260,26 @@ public class Target extends BuildObject implements ITarget { */ public String getMakeCommand() { // Return the name of the make utility - return makeCommand == null ? EMPTY_STRING : makeCommand; + return (makeCommand == null) ? parent.getMakeCommand() : makeCommand; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName() + */ public String getName() { return (name == null && parent != null) ? parent.getName() : name; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#getParent() + */ public ITarget getParent() { return parent; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#getOwner() + */ public IResource getOwner() { return owner; } @@ -269,12 +304,26 @@ public class Target extends BuildObject implements ITarget { return n; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools() + */ public ITool[] getTools() { ITool[] toolArray = new ITool[getNumTools()]; addToolsToArray(toolArray, 0); return toolArray; } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#hasMakeCommandOverride() + */ + public boolean hasOverridenMakeCommand() { + return (makeCommand != null && !makeCommand.equals(parent.getMakeCommand())); + } + + /** + * @param id + * @return + */ public ITool getTool(String id) { ITool result = null; // See if receiver has it in list @@ -286,6 +335,9 @@ public class Target extends BuildObject implements ITarget { return result; } + /** + * @param tool + */ public void addTool(ITool tool) { if (tools == null) { tools = new ArrayList(); @@ -296,6 +348,9 @@ public class Target extends BuildObject implements ITarget { toolMap.put(tool.getId(), tool); } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations() + */ public IConfiguration[] getConfigurations() { if (configurations != null) return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]); @@ -340,6 +395,9 @@ public class Target extends BuildObject implements ITarget { return (IConfiguration)configMap.get(id); } + /** + * @param configuration + */ public void addConfiguration(IConfiguration configuration) { if (configurations == null) { configurations = new ArrayList(); @@ -381,8 +439,18 @@ public class Target extends BuildObject implements ITarget { * @see org.eclipse.cdt.core.build.managed.ITarget#setBuildArtifact(java.lang.String) */ public void setBuildArtifact(String name) { - artifactName = name; + if (name != null) { + artifactName = name; + } } + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.ITarget#setMakeCommand(java.lang.String) + */ + public void setMakeCommand(String command) { + if (command != null && !getMakeCommand().equals(command)) { + makeCommand = command; + } + } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog b/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog index 7ca161b10ad..98cbb16ca00 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog +++ b/build/org.eclipse.cdt.managedbuilder.ui/ChangeLog @@ -1,3 +1,25 @@ +2003-09-23 Sean Evoy + I added a fix for critical bug 43439. The new project wizard is ready to be hooked + up to the help system content on F1. There is a new file with the string constant + the doc project will use to map the widget to a help file. + * src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java + * src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderHelpContextIds.java + + In support of the fix for critical bug 43292, I added a new set of widgets to + the ManageConfigDialog implementation. I added new string literals in the properties + file for the plugin. There are obviously new event handlers for the Manage dialog. + It displays the make command for the target, the name of the build artifact, and + a list of current and deleted configurations. There is no way to add new targets. + Users can restore deleted configurations up until they click OK. The client of this + dialog has been changed to properly respond to the changes. The NewConfigurationDialog + now displays an externalized string in the title bar. + * plugin.xml + * plugin.properties + * src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties + * src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java + * src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java + * src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java + 2003-09-19 Sean Evoy Removed the binary parser selection tab from the new class wizard. Updated the page description externalized string. diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties b/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties index b8dfd060f59..bff79be6a1e 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties @@ -22,3 +22,7 @@ OptionCategory.Debug=Debugging OptionCategory.Warn=Warnings OptionCategory.Misc=Miscellaneous OptionCategory.Libs=Libraries +Option.Posix.PreprocOnly=Preprocess only (-E) +Option.Posix.DefSym=Defined symbols (-D) +Option.Posix.Libs=Libraries (-l) +Option.Posix.Libsearch=Library search path (-L) diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index cf08589e7d2..95183810699 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -96,7 +96,7 @@ - + - +