1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-29 19:23:38 +02:00

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.
This commit is contained in:
Doug Schaefer 2003-09-24 14:20:49 +00:00
parent ec1f9424bb
commit e09b94f945
16 changed files with 708 additions and 134 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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 <code>IConfiguration</code> 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 <code>null</code> 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);
}

View file

@ -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;
}
}
}

View file

@ -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.

View file

@ -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)

View file

@ -96,7 +96,7 @@
</option>
<option
defaultValue="false"
name="Preprocess only (-E)"
name="%Option.Posix.PreprocOnly"
category="cygwin.compiler.category.preprocessor"
command="-E"
valueType="boolean"
@ -115,7 +115,7 @@
id="cygwin.gnu.compiler.category.symbols">
</optionCategory>
<option
name="Defined symbols (-D)"
name="%Option.Posix.DefSym"
category="cygwin.gnu.compiler.category.symbols"
command="-D"
valueType="definedSymbols"
@ -338,14 +338,14 @@
id="cygwin.link.ld.flags">
</option>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="cygwin.linker.category.general"
command="-l"
valueType="libs"
id="cygwin.link.libs">
</option>
<option
name="Library Paths"
name="%Option.Posix.Libsearch"
category="cygwin.linker.category.general"
command="-L"
valueType="stringList"
@ -389,19 +389,19 @@
id="cygwin.solink.ld.flags">
</option>
<option
name="Library Paths"
category="cygwin.solink.category.general"
command="-L"
valueType="stringList"
id="cygwin.solink.ld.paths">
</option>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="cygwin.solink.category.general"
command="-l"
valueType="libs"
id="cygwin.solink.libs">
</option>
<option
name="%Option.Posix.Libsearch"
category="cygwin.solink.category.general"
command="-L"
valueType="stringList"
id="cygwin.solink.ld.paths">
</option>
</tool>
</target>
<target
@ -440,19 +440,19 @@
id="cygwin.explink.ld.flags">
</option>
<option
name="Library Paths"
category="cygwin.explink.category.general"
command="-L"
valueType="stringList"
id="cygwin.explink.ld.paths">
</option>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="cygwin.explink.category.general"
command="-l"
valueType="libs"
id="cygwin.explink.libs">
</option>
<option
name="%Option.Posix.Libsearch"
category="cygwin.explink.category.general"
command="-L"
valueType="stringList"
id="cygwin.explink.ld.paths">
</option>
</tool>
</target>
<target
@ -522,14 +522,14 @@
</option>
<option
defaultValue="false"
name="Preprocess only (-E)"
name="%Option.Posix.PreprocOnly"
category="linux.gnu.compiler.category.preprocessor"
command="-E"
valueType="boolean"
id="linux.gnu.compiler.preprocessor.preprocess">
</option>
<option
name="Defined Symbols (-D)"
name="%Option.Posix.DefSym"
category="linux.gnu.compiler.category.preprocessor"
command="-D"
valueType="definedSymbols"
@ -862,14 +862,14 @@
id="linux.gnu.linker.category.libs">
</optionCategory>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="linux.gnu.linker.category.libs"
command="-l"
valueType="libs"
id="linux.gnu.linker.libs.libs">
</option>
<option
name="Library search path"
name="%Option.Posix.Libsearch"
category="linux.gnu.linker.category.libs"
command="-L"
valueType="stringList"
@ -967,14 +967,14 @@
id="linux.gnu.solink.category.libs">
</optionCategory>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="linux.gnu.solink.category.libs"
command="-l"
valueType="libs"
id="linux.gnu.solink.libs.libs">
</option>
<option
name="Library search path"
name="%Option.Posix.Libsearch"
category="linux.gnu.solink.category.libs"
command="-L"
valueType="stringList"
@ -1050,14 +1050,14 @@
</option>
<option
defaultValue="false"
name="Preprocess only (-E)"
name="%Option.Posix.PreprocOnly"
category="solaris.gnu.compiler.category.preprocessor"
command="-E"
valueType="boolean"
id="solaris.gnu.compiler.preprocessor.preprocess">
</option>
<option
name="Defined Symbols (-D)"
name="%Option.Posix.DefSym"
category="solaris.gnu.compiler.category.preprocessor"
command="-D"
valueType="definedSymbols"
@ -1382,14 +1382,14 @@
id="solaris.gnu.linker.category.libs">
</optionCategory>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="solaris.gnu.linker.category.libs"
command="-l"
valueType="libs"
id="solaris.gnu.linker.libs.libs">
</option>
<option
name="Library search path"
name="%Option.Posix.Libsearch"
category="solaris.gnu.linker.category.libs"
command="-L"
valueType="stringList"
@ -1487,14 +1487,14 @@
id="solaris.gnu.solink.category.libs">
</optionCategory>
<option
name="Libraries"
name="%Option.Posix.Libs"
category="solaris.gnu.solink.category.libs"
command="-l"
valueType="libs"
id="solaris.gnu.solink.libs.libs">
</option>
<option
name="Library search path"
name="%Option.Posix.Libsearch"
category="solaris.gnu.solink.category.libs"
command="-L"
valueType="stringList"

View file

@ -0,0 +1,22 @@
package org.eclipse.cdt.managedbuilder.internal.ui;
import org.eclipse.cdt.ui.CUIPlugin;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
public interface ManagedBuilderHelpContextIds {
public static final String PREFIX= CUIPlugin.PLUGIN_ID + ".";
// Wizard pages
public static final String MAN_PROJ_PLATFORM_HELP = PREFIX + "man_proj_platform_help";
}

View file

@ -47,11 +47,21 @@ BuildPropertyPage.tip.platform=Select a platform for the project
BuildPropertyPage.tip.config=Select the configuration to edit
BuildPropertyPage.tip.addconf=Add configurations for the platform
BuildPropertyPage.tip.remconf=Remove configurations for the platform
BuildPropertyPage.manage.title=Manage Configurations
BuildPropertyPage.manage.title=Manage
# ----------- New Configuration -----------
NewConfiguration.label.name=Configuration name:
NewConfiguration.label.copy=Copy settings from:
NewConfiguration.error.title=Error
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
# ----------- Target/Config management dialog -----------------
ManageConfig.label.makecmdgroup=Make command
ManageConfig.label.makecmddef=Use default command
ManageConfig.label.output.group=Build output
ManageConfig.label.output.label=Artifact name:
ManageConfig.label.configs=Manage configurations
ManageConfig.label.restore=Restore
ManageConfig.label.configs.current=Current:
ManageConfig.label.configs.deleted=Deleted:
ManageConfig.label.new.config.dialog=Create

View file

@ -13,14 +13,19 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
@ -403,9 +408,29 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Recreate the settings store for the configuration
settingsStore = new BuildToolsSettingsStore(selectedConfiguration);
// Select the first option in the list
// Select the first tool or option category in the list that has options
Object[] elements = provider.getElements(selectedConfiguration);
Object primary = elements.length > 0 ? elements[0] : null;
if (primary != null && primary instanceof ITool) {
// Check to see if there are any options.
ITool tool = (ITool)primary;
IOptionCategory top = tool.getTopOptionCategory();
IOption[] topOpts = top.getOptions(selectedConfiguration);
if (topOpts != null && topOpts.length == 0) {
// Get the children categories and start looking
IOptionCategory[] children = top.getChildCategories();
for (int i = 0; i < children.length; i++) {
IOptionCategory category = children[i];
IOption[] catOpts = category.getOptions(selectedConfiguration);
if (catOpts != null && catOpts.length > 0) {
primary = category;
break;
}
}
}
}
if (primary != null) {
optionList.setSelection(new StructuredSelection(primary));
}
@ -415,13 +440,66 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
private void handleManageConfig () {
ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(MANAGE_TITLE), selectedTarget);
if (manageDialog.open() == ManageConfigDialog.OK) {
// Check to see if any configurations have to be deleted
ArrayList deleteMe = manageDialog.getDeletedConfigs();
ListIterator iter = deleteMe.listIterator();
while (iter.hasNext()) {
boolean updateConfigs = false;
// Get the build output name
String newBuildOutput = manageDialog.getBuildArtifactName();
if (!selectedTarget.getArtifactName().equals(newBuildOutput)) {
selectedTarget.setBuildArtifact(newBuildOutput);
}
// Get the new make command
if (manageDialog.useDefaultMakeCommand()) {
// This is a cheap assignment to null so do it to be doubly sure
selectedTarget.resetMakeCommand();
} else {
String makeCommand = manageDialog.getMakeCommand();
selectedTarget.setMakeCommand(makeCommand);
}
// Check to see if any configurations have to be deleted
List deletedConfigs = manageDialog.getDeletedConfigIds();
Iterator iter = deletedConfigs.listIterator();
while (iter.hasNext()) {
String id = (String)iter.next();
// Remove the configurations from the target
selectedTarget.removeConfiguration(id);
// Clean up the UI
configurations = selectedTarget.getConfigurations();
configSelector.removeAll();
configSelector.setItems(getConfigurationNames());
configSelector.select(0);
updateConfigs = true;
}
// Check to see if any have to be added
SortedMap newConfigs = manageDialog.getNewConfigs();
Set keys = newConfigs.keySet();
Iterator keyIter = keys.iterator();
int index = selectedTarget.getConfigurations().length;
while (keyIter.hasNext()) {
String name = (String) keyIter.next();
IConfiguration parent = (IConfiguration) newConfigs.get(name);
if (parent != null) {
++index;
String newId = parent.getId() + "." + index;
IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
newConfig.setName(name);
// Update the config lists
configurations = selectedTarget.getConfigurations();
configSelector.removeAll();
configSelector.setItems(getConfigurationNames());
configSelector.select(configSelector.indexOf(name));
updateConfigs = true;
}
}
if (updateConfigs){
handleConfigSelection();
}
return;
}
return;
}
private void handleOptionSelection() {

View file

@ -18,50 +18,72 @@ import java.util.TreeMap;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class ManageConfigDialog extends Dialog {
// String constants
private static final String PREFIX = "BuildPropertyCommon"; //$NON-NLS-1$
private static final String CMN_PREFIX = "BuildPropertyCommon"; //$NON-NLS-1$
private static final String CMN_LABEL = CMN_PREFIX + ".label"; //$NON-NLS-1$
private static final String NEW = CMN_LABEL + ".new"; //$NON-NLS-1$
private static final String REMOVE = CMN_LABEL + ".remove"; //$NON-NLS-1$
private static final String PREFIX = "ManageConfig"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String NEW = LABEL + ".new"; //$NON-NLS-1$
private static final String REMOVE = LABEL + ".remove"; //$NON-NLS-1$
private static final String RESTORE = LABEL + ".restore"; //$NON-NLS-1$
private static final String GROUP = LABEL + ".makecmdgroup"; //$NON-NLS-1$
private static final String DEF_BTN = LABEL + ".makecmddef"; //$NON-NLS-1$
private static final String OUTPUT_GROUP = LABEL + ".output.group"; //$NON-NLS-1$
private static final String OUTPUT_LABEL = LABEL + ".output.label"; //$NON-NLS-1$
private static final String CONFIGS = LABEL + ".configs"; //$NON-NLS-1$
// Default return values
private static final ArrayList EMPTY_LIST = new ArrayList(0);
private static final SortedMap EMPTY_MAP = new TreeMap();
private static final String CURRENT_CONFIGS = CONFIGS + ".current"; //$NON-NLS-1$
private static final String DELETED_CONFIGS = CONFIGS + ".deleted"; //$NON-NLS-1$
private static final String CONF_DLG = LABEL + ".new.config.dialog"; //$NON-NLS-1$
// The title of the dialog.
private String title = "";
// The name of the build artifact
private String buildArtifact;
// The list of configurations to delete
private SortedMap deletedConfigs;
// Map of configuration names and ids
private SortedMap existingConfigs;
// The make command associated with the target
private String makeCommand;
// The target the configs belong to
private ITarget managedTarget;
// The list of configurations to delete
private ArrayList deletedConfigIds;
// Map of configuration names and ids
private SortedMap configIds;
// Map of new configurations chosen by the user
private SortedMap newConfigs;
// The title of the dialog.
private String title = "";
// State of the check box on exit
private boolean useDefaultMake;
// Widgets
private List configurationList;
private Button newBtn;
private Button okBtn;
private Button removeBtn;
protected Text buildArtifactEntry;
protected List currentConfigList;
protected List deletedConfigList;
protected Button makeCommandDefault;
protected Text makeCommandEntry;
protected Button newBtn;
protected Button okBtn;
protected Button removeBtn;
protected Button restoreBtn;
/**
* @param parentShell
@ -71,15 +93,39 @@ public class ManageConfigDialog extends Dialog {
this.title = title;
this.managedTarget = target;
// Figure out the default make command
makeCommand = managedTarget.getMakeCommand();
// Get the name of the build artifact
buildArtifact = managedTarget.getArtifactName();
// Get the defined configurations from the target
IConfiguration [] configs = this.managedTarget.getConfigurations();
configIds = new TreeMap();
getExistingConfigs().clear();
IConfiguration [] configs = managedTarget.getConfigurations();
for (int i = 0; i < configs.length; i++) {
IConfiguration configuration = configs[i];
configIds.put(configuration.getName(), configuration.getId());
getExistingConfigs().put(configuration.getName(), configuration.getId());
}
getDeletedConfigs().clear();
getNewConfigs().clear();
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
useDefaultMake = makeCommandDefault.getSelection();
makeCommand = makeCommandEntry.getText().trim();
buildArtifact = buildArtifactEntry.getText().trim();
} else {
useDefaultMake = true;
buildArtifact = managedTarget.getArtifactName();
}
super.buttonPressed(buttonId);
}
/* (non-Javadoc)
* Method declared in Window.
*/
@ -98,23 +144,80 @@ public class ManageConfigDialog extends Dialog {
}
protected Control createDialogArea(Composite parent) {
// Create the main composite with a 2-column grid layout
Composite composite = ControlFactory.createComposite(parent, 3);
Composite comp = ControlFactory.createComposite(parent, 1);
// Create a list
Composite listComp = ControlFactory.createComposite(composite, 1);
// Create a group for the build output
Group outputGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(OUTPUT_GROUP), 1);
outputGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
Label outputLabel = ControlFactory.createLabel(outputGroup, ManagedBuilderUIPlugin.getResourceString(OUTPUT_LABEL));
outputLabel.setLayoutData(new GridData());
buildArtifactEntry = ControlFactory.createTextField(outputGroup);
buildArtifactEntry.setText(buildArtifact);
buildArtifactEntry.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
buildArtifactEntry = null;
}
});
// Create the make command group area
Group makeCommandGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(GROUP), 1);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
listComp.setLayoutData(gd);
Label label = ControlFactory.createLabel(listComp, CUIPlugin.getResourceString(CONFIGS));
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
configurationList = new List(listComp, SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER);
makeCommandGroup.setLayoutData(gd);
makeCommandDefault = ControlFactory.createCheckBox(makeCommandGroup, ManagedBuilderUIPlugin.getResourceString(DEF_BTN));
setButtonLayoutData(makeCommandDefault);
makeCommandDefault.setSelection(!managedTarget.hasOverridenMakeCommand());
makeCommandDefault.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
handleUseDefaultPressed();
}
});
makeCommandDefault.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
makeCommandDefault = null;
}
});
makeCommandEntry = ControlFactory.createTextField(makeCommandGroup);
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
makeCommandEntry.setText(makeCommand);
makeCommandEntry.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
makeCommandEntry = null;
}
});
// Create the config list group area
Group configListGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(CONFIGS), 3);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 15;
configurationList.setLayoutData(gd);
configListGroup.setLayoutData(gd);
// Create the 2 labels first to align the buttons and list controls
Label currentConfigLabel = ControlFactory.createLabel(configListGroup, ManagedBuilderUIPlugin.getResourceString(CURRENT_CONFIGS));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
currentConfigLabel.setLayoutData(gd);
Label deletedConfigLabel = ControlFactory.createLabel(configListGroup, ManagedBuilderUIPlugin.getResourceString(DELETED_CONFIGS));
deletedConfigLabel.setLayoutData(new GridData());
// Create the current config list
Composite currentComp = ControlFactory.createComposite(configListGroup, 1);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
currentComp.setLayoutData(gd);
currentConfigList = new List(currentComp, SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 100;
currentConfigList.setLayoutData(gd);
currentConfigList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
currentConfigList = null;
}
});
// Create a composite for the buttons
Composite buttonBar = ControlFactory.createComposite(composite, 1);
Composite buttonBar = ControlFactory.createComposite(configListGroup, 1);
buttonBar.setLayoutData(new GridData());
newBtn = ControlFactory.createPushButton(buttonBar, CUIPlugin.getResourceString(NEW));
setButtonLayoutData(newBtn);
newBtn.addSelectionListener(new SelectionAdapter () {
@ -122,6 +225,11 @@ public class ManageConfigDialog extends Dialog {
handleNewPressed();
}
});
newBtn.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
newBtn = null;
}
});
removeBtn = ControlFactory.createPushButton(buttonBar, CUIPlugin.getResourceString(REMOVE));
setButtonLayoutData(removeBtn);
removeBtn.addSelectionListener(new SelectionAdapter () {
@ -129,38 +237,115 @@ public class ManageConfigDialog extends Dialog {
handleRemovePressed();
}
});
removeBtn.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
removeBtn = null;
}
});
restoreBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(RESTORE));
setButtonLayoutData(restoreBtn);
restoreBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
handleRestorePressed();
}
});
restoreBtn.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
restoreBtn = null;
}
});
// Create the deleted config list
Composite deletedComp = ControlFactory.createComposite(configListGroup, 1);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
deletedComp.setLayoutData(gd);
deletedConfigList = new List(deletedComp, SWT.SINGLE|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 100;
deletedConfigList.setLayoutData(gd);
deletedConfigList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
deletedConfigList = null;
}
});
// Do the final widget prep
configurationList.setItems(getConfigurationNames());
configurationList.select(0);
currentConfigList.setItems(getConfigurationNames());
currentConfigList.select(0);
newBtn.setFocus();
return composite;
return comp;
}
private String [] getConfigurationNames() {
return (String[]) configIds.keySet().toArray(new String[configIds.size()]);
/**
*
*/
protected void handleUseDefaultPressed() {
// If the state of the button is unchecked, then we want to enable the edit widget
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
}
/**
* @return <code>ArrayList</code> of <code>IConfiguration</code> ids
* the user has decided to remove from the target.
* Answers the value in the build artifact entry widget.
*
* @return
*/
public ArrayList getDeletedConfigs() {
if (deletedConfigIds == null) {
deletedConfigIds = EMPTY_LIST;
public String getBuildArtifactName() {
return buildArtifact;
}
private String [] getConfigurationNames() {
return (String[]) getExistingConfigs().keySet().toArray(new String[getExistingConfigs().size()]);
}
/* (non-javadoc)
* Answers a <code>SortedMap</code> of <code>IConfiguration</code> names to unique IDs.
*
* @return
*/
protected SortedMap getDeletedConfigs() {
if (deletedConfigs == null) {
deletedConfigs = new TreeMap();
}
return deletedConfigIds;
return deletedConfigs;
}
/**
* Answers a <code>List</code> of unique IDs corresponding to the <code>IConfigurations</code>
* the user wishes to remove from the <code>ITarget</code>
* @return
*/
public ArrayList getDeletedConfigIds() {
return new ArrayList(getDeletedConfigs().values());
}
protected SortedMap getExistingConfigs() {
if (existingConfigs == null) {
existingConfigs = new TreeMap();
}
return existingConfigs;
}
/**
* @return Map of configuration names to <code>IConfiguration</code>.
* Answers the value in the make command entry widget.
*
* @return
*/
public String getMakeCommand() {
return makeCommand;
}
/**
* Answers a map of configuration names to <code>IConfiguration</code>.
* The name is selected by the user and should be unique for the target
* it will be added to. The configuration is the what the new
* configuration will be based on.
* configuration will be based on.
*
* @return Map
*/
public SortedMap getNewConfigs() {
if (newConfigs == null) {
newConfigs = EMPTY_MAP;
newConfigs = new TreeMap();
}
return newConfigs;
}
@ -181,7 +366,7 @@ public class ManageConfigDialog extends Dialog {
ITarget [] targets = ManagedBuildManager.getDefinedTargets(getProject());
for (int i = 0; i < targets.length; i++) {
ITarget target = targets[i];
if (target.getId().equals(managedTarget.getId())) {
if (target.getId().equals(managedTarget.getParent().getId())) {
parentTarget = target;
break;
}
@ -194,10 +379,16 @@ public class ManageConfigDialog extends Dialog {
// There should be predefined configurations ....
if (allDefinedConfigs != null && allDefinedConfigs.length != 0) {
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(), allDefinedConfigs, managedTarget);
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
allDefinedConfigs,
managedTarget,
ManagedBuilderUIPlugin.getResourceString(CONF_DLG));
if (dialog.open() == NewConfigurationDialog.OK) {
// Get the new name and configuration to base the new config on
getNewConfigs().put(dialog.getNewName(), dialog.getParentConfiguration());
String newConfigName = dialog.getNewName();
getNewConfigs().put(newConfigName, dialog.getParentConfiguration());
currentConfigList.add(newConfigName);
currentConfigList.setSelection(currentConfigList.getItemCount() - 1);
}
}
@ -205,29 +396,72 @@ public class ManageConfigDialog extends Dialog {
updateButtons();
}
/*
/* (non-javadoc)
* Event handler for the remove button
*/
protected void handleRemovePressed() {
// TODO Request a remove configuration function through the ITarget interface
// Determine which configuration was selected
int selectionIndex = configurationList.getSelectionIndex();
int selectionIndex = currentConfigList.getSelectionIndex();
if (selectionIndex != -1){
String selectedConfig = configurationList.getItem(selectionIndex);
getDeletedConfigs().add(configIds.get(selectedConfig));
configurationList.remove(selectionIndex);
String selectedConfigName = currentConfigList.getItem(selectionIndex);
String selectedConfigId = null;
// If this is a newly added config, remove it from that map
if (getNewConfigs().containsKey(selectedConfigName)) {
selectedConfigId = (String) getNewConfigs().get(selectedConfigName);
getNewConfigs().remove(selectedConfigName);
}
// If it is not a new item, the ID is in the existing list
selectedConfigId = (String) getExistingConfigs().get(selectedConfigName);
getDeletedConfigs().put(selectedConfigName, selectedConfigId);
// Clean up the UI lists
currentConfigList.remove(selectionIndex);
currentConfigList.setSelection(selectionIndex - 1);
deletedConfigList.add(selectedConfigName);
deletedConfigList.setSelection(deletedConfigList.getItemCount() - 1);
updateButtons();
}
}
/* (non-javadoc)
* Event handler for the restore button
*/
protected void handleRestorePressed() {
// Determine which configuration was selected
int selectionIndex = deletedConfigList.getSelectionIndex();
// Move the selected element from the deleted list to the current list
if (selectionIndex != -1){
// Get the name of the item to delete
String selectedConfigName = deletedConfigList.getItem(selectionIndex);
String selectedConfigId = (String) getDeletedConfigs().get(selectedConfigName);
// If this was a new config (it won't be in the existing list) then add it back there
if (!getExistingConfigs().containsKey(selectedConfigName)) {
getNewConfigs().put(selectedConfigName, selectedConfigId);
}
// Remove it from the deleted map
getDeletedConfigs().remove(selectedConfigName);
// Clean up the UI
deletedConfigList.remove(selectionIndex);
deletedConfigList.setSelection(selectionIndex - 1);
currentConfigList.add(selectedConfigName);
currentConfigList.setSelection(currentConfigList.getItemCount());
updateButtons();
}
}
private void updateButtons() {
// Disable the remove button if there is only 1 configuration
// removeBtn.setEnabled(configurationList.getItemCount() > 1);
removeBtn.setEnabled(false);
// Enable the OK button if there are any configs to delete or add
okBtn.setEnabled(!(getDeletedConfigs().isEmpty() && getNewConfigs().isEmpty()));
removeBtn.setEnabled(currentConfigList.getItemCount() > 1);
// Enable the restore button if there is anything in the deleted list
restoreBtn.setEnabled(deletedConfigList.getItemCount() > 0);
}
public boolean useDefaultMakeCommand () {
return useDefaultMake;
}
}

View file

@ -53,13 +53,15 @@ public class NewConfigurationDialog extends Dialog {
private ITarget target;
private String newName;
private String [] allNames;
private String title = "";
/**
* @param parentShell
*/
protected NewConfigurationDialog(Shell parentShell, IConfiguration[] configs, ITarget managedTarget) {
protected NewConfigurationDialog(Shell parentShell, IConfiguration[] configs, ITarget managedTarget, String title) {
super(parentShell);
this.title = title;
setShellStyle(getShellStyle()|SWT.RESIZE);
newName = new String();
parentConfig = null;
@ -92,7 +94,16 @@ public class NewConfigurationDialog extends Dialog {
}
/* (non-Javadoc)
* Method declared on Dialog. Create OK and Cancel buttons and hold onto the OK button handle.
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null)
shell.setText(title);
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
btnOk = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

View file

@ -18,6 +18,7 @@ import java.util.ListIterator;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@ -33,12 +34,12 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.help.WorkbenchHelp;
public class CProjectPlatformPage extends WizardPage {
/*
* Bookeeping variables
*/
// private CProjectWizard wizard;
private ArrayList selectedConfigurations;
protected ITarget selectedTarget;
protected String[] targetNames;
@ -61,10 +62,9 @@ public class CProjectPlatformPage extends WizardPage {
* @param wizard
* @param pageName
*/
public CProjectPlatformPage(/*CProjectWizard wizard,*/ String pageName) {
public CProjectPlatformPage(String pageName) {
super(pageName);
setPageComplete(false);
// this.wizard = wizard;
populateTargets();
selectedTarget = null;
selectedConfigurations = new ArrayList(0);
@ -129,6 +129,9 @@ public class CProjectPlatformPage extends WizardPage {
// Select the first target in the list
handleTargetSelection();
// Setup the help information
WorkbenchHelp.setHelp(composite, ManagedBuilderHelpContextIds.MAN_PROJ_PLATFORM_HELP);
// Do the nasty
setErrorMessage(null);
setMessage(null);

View file

@ -10,6 +10,16 @@
Added CompleteParseASTTest.testBug43373()
Added QuickParseASTTests.testBug43371()
2003-09-23 Sean Evoy
As part of the fix for critical bug 43292, I had to add functionality to
the build model to remove configurations through an ITarget, and to set,
reset, and flag as default the make command associated with an ITarget. I
have updated the managed build test "testConfigurations" to exercise the
remove functionality. I added a test, "testMakeCommandManipulation" to
exercise the new make command functions in the interface.
* plugin.xml
* build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
2003-09-22 Bogdan Gheorghe
- modified CompletionProposalsTests, BaseSearchTest
to avoid using isEnabled for the IndexManager

View file

@ -46,7 +46,8 @@ import org.eclipse.core.runtime.NullProgressMonitor;
public class ManagedBuildTests extends TestCase {
private static final boolean boolVal = true;
private static final String PROJECT_ID = CCorePlugin.PLUGIN_ID + ".make";
private static final String testConfigName = "test.config.override";
private static final String testConfigId = "test.config.override";
private static final String testConfigName = "Tester";
private static final String enumVal = "Another Enum";
private static final String[] listVal = {"_DEBUG", "/usr/include", "libglade.a"};
private static final String projectName = "ManagedBuildTest";
@ -65,7 +66,8 @@ public class ManagedBuildTests extends TestCase {
suite.addTest(new ManagedBuildTests("testProjectCreation"));
suite.addTest(new ManagedBuildTests("testConfigurations"));
suite.addTest(new ManagedBuildTests("testConfigurationReset"));
suite.addTest(new ManagedBuildTests("testTargetArtifacts"));
suite.addTest(new ManagedBuildTests("testTargetBuildArtifact"));
suite.addTest(new ManagedBuildTests("testMakeCommandManipulation"));
suite.addTest(new ManagedBuildTests("testScannerInfoInterface"));
suite.addTest(new ManagedBuildTests("cleanup"));
@ -105,7 +107,43 @@ public class ManagedBuildTests extends TestCase {
assertNotNull(testSubSub);
}
/**
* This test exercises the interface the <code>ITarget</code> exposes to manipulate
* its make command.
*/
public void testMakeCommandManipulation () {
String oldMakeCmd = "make";
String newMakeCmd = "Ant";
// Open the test project
IProject project = null;
try {
project = createProject(projectName);
} catch (CoreException e) {
fail("Failed to open project in 'testMakeCommandManipulation': " + e.getLocalizedMessage());
}
assertNotNull(project);
// Now open the root target
ITarget[] targets = ManagedBuildManager.getTargets(project);
assertEquals(1, targets.length);
// Does it have a default make command
assertFalse(targets[0].hasOverridenMakeCommand());
assertEquals(oldMakeCmd, targets[0].getMakeCommand());
// Change it
targets[0].setMakeCommand(newMakeCmd);
assertEquals(newMakeCmd, targets[0].getMakeCommand());
assertTrue(targets[0].hasOverridenMakeCommand());
// Reset it
targets[0].resetMakeCommand();
assertFalse(targets[0].hasOverridenMakeCommand());
assertEquals(oldMakeCmd, targets[0].getMakeCommand());
}
/**
* The purpose of this test is to exercise the build path info interface.
* To get to that point, a new target/config has to be created in the test
@ -122,7 +160,7 @@ public class ManagedBuildTests extends TestCase {
try {
project = createProject(projectName);
} catch (CoreException e) {
fail("Failed to open project: " + e.getLocalizedMessage());
fail("Failed to open project in 'testScannerInfoInterface': " + e.getLocalizedMessage());
}
// Create a new target in the project based on the sub target
@ -227,6 +265,11 @@ public class ManagedBuildTests extends TestCase {
*
*/
public void testConfigurations() throws CoreException, BuildException {
String rootConfigId = "test.root.1.0";
String rootName = "Root Config";
String overrideConfigId = "test.root.1.1";
String overrideName = "Root Override Config";
// Open the test project
IProject project = createProject(projectName);
@ -237,10 +280,17 @@ public class ManagedBuildTests extends TestCase {
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length);
IConfiguration baseConfig = definedConfigs[0];
assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId);
assertEquals(definedConfigs[1].getName(), overrideName);
// Create a new configuration
IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigName);
// Create a new configuration and test the rename function
IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigId);
assertEquals(3, rootTarget.getConfigurations().length);
newConfig.setName(testConfigName);
assertEquals(newConfig.getId(), testConfigId);
assertEquals(newConfig.getName(), testConfigName);
// There is only one tool
ITool[] definedTools = newConfig.getTools();
@ -270,6 +320,20 @@ public class ManagedBuildTests extends TestCase {
// Test the values in the new configuration
checkOptionReferences(project);
// Now delete the new configuration and test the target
definedTargets = ManagedBuildManager.getTargets(project);
assertEquals(1, definedTargets.length);
rootTarget = definedTargets[0];
definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length);
rootTarget.removeConfiguration(testConfigId);
definedConfigs = rootTarget.getConfigurations();
assertEquals(2, definedConfigs.length);
assertEquals(definedConfigs[0].getId(), rootConfigId);
assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getId(), overrideConfigId);
assertEquals(definedConfigs[1].getName(), overrideName);
}
public void testConfigurationReset() {
@ -485,7 +549,7 @@ public class ManagedBuildTests extends TestCase {
// Now get the configs
IConfiguration[] definedConfigs = rootTarget.getConfigurations();
assertEquals(3, definedConfigs.length);
IConfiguration newConfig = rootTarget.getConfiguration(testConfigName);
IConfiguration newConfig = rootTarget.getConfiguration(testConfigId);
assertNotNull(newConfig);
// Now get the tool options and make sure the values are correct
@ -532,12 +596,11 @@ public class ManagedBuildTests extends TestCase {
private void checkRootTarget(ITarget target, String oicValue) throws BuildException {
// Target stuff
String expectedCleanCmd = "del /myworld";
String expectedMakeCommand = "make";
String expectedParserId = "org.eclipse.cdt.core.PE";
assertTrue(target.isTestTarget());
assertEquals(target.getDefaultExtension(), rootExt);
assertEquals(expectedCleanCmd, target.getCleanCommand());
assertEquals(expectedMakeCommand, target.getMakeCommand());
assertEquals("make", target.getMakeCommand());
assertEquals(expectedParserId, target.getBinaryParserId());
// Tools
@ -651,7 +714,9 @@ public class ManagedBuildTests extends TestCase {
private void checkSubSubTarget(ITarget target) {
// Check the inherited clean command
assertEquals("rm -yourworld", target.getCleanCommand());
// Check that the make command is overridden from parent
assertEquals("nmake", target.getMakeCommand());
// Make sure we get the proper binary parser
assertEquals("org.eclipse.cdt.core.ELF", target.getBinaryParserId());
}
@ -663,9 +728,11 @@ public class ManagedBuildTests extends TestCase {
* in the sub target, the test does a sanity check just to be complete.
*/
private void checkSubTarget(ITarget target) throws BuildException {
// Check the overridden clan command
// Check the overridden clean command
assertEquals("rm -yourworld", target.getCleanCommand());
assertEquals("gmake", target.getMakeCommand());
// Make sure the target inherits the make command
assertEquals("make", target.getMakeCommand());
// Make sure the binary parser is hard-coded and available
assertEquals("org.eclipse.cdt.core.PE", target.getBinaryParserId());
// Make sure this is a test target
@ -788,7 +855,7 @@ public class ManagedBuildTests extends TestCase {
* Test that the build artifact of a <code>ITarget</code> can be modified
* programmatically.
*/
public void testTargetArtifacts () throws CoreException {
public void testTargetBuildArtifact () throws CoreException {
// Open the test project
IProject project = createProject(projectName);

View file

@ -126,7 +126,6 @@
isTest="true"
defaultExtension="bus"
isAbstract="false"
makeCommand="gmake"
binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-d"
parent="test.root">