1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fixes for 41590, 44159, 51640, and 51646

This commit is contained in:
Sean Evoy 2004-02-17 14:20:11 +00:00
parent 8cf9302004
commit aba55c1109
17 changed files with 2526 additions and 2014 deletions

View file

@ -1,3 +1,39 @@
2004-02-17 Sean Evoy
Fix for critical bug 44163.
The managed build info would become confused when the project it was associated
with was renamed. The project still stored the build information in its session
data, but the internal reference to the owner project was not updated in the
build info. Now, when the build info is retrieved from a project, the manager
asks the info to do a sanity test to check the identity of the true owner against
the owner the it thinks it has. If they differ, the build information updates its
owner and the owner of all the targets it maintains for the project.
* src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
* src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
* src/org/eclipse/cdt/managedbuilder/core/ITarget.java
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
Fixes for 51646
Moved the makefile comment character out of the hard-coded strings and into
the makefile generator.
* src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
Fixes for bug 49590:
The target maintains the default extension and the overridden extension. There
is an interface to get and set the extension, but the method to get the default
extension is deprecated.
* src/org/eclipse/cdt/managedbuilder/core/ITarget.java
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
The build information now has a method to get at the extension
* src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
* src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
The makefile generator now asks for both the name and the extension when
generating targets and dependencies.
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
2003-10-23 Bogdan Gheorghe
Updated the indexManager.perfomConcurrentJob call in MakefileGenerator

View file

@ -1,9 +1,7 @@
package org.eclipse.cdt.managedbuilder.core;
import java.util.List;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2003,2004 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
@ -11,7 +9,9 @@ import java.util.List;
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
***********************************************************************/
import java.util.List;
public interface IManagedBuildInfo {
@ -31,6 +31,14 @@ public interface IManagedBuildInfo {
*/
public boolean buildsFileType(String srcExt);
/**
* Answers the file extension for the receivers build goal.
*
* @return
*/
public String getBuildArtifactExtension();
/**
* Returns the name of the artifact to build for the receiver.
*

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2003 IBM Corporation and others.
* Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@ -22,6 +22,7 @@ public interface ITarget extends IBuildObject {
public static final String BINARY_PARSER = "binaryParser"; //$NON-NLS-1$
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
public static final String DEFAULT_EXTENSION = "defaultExtension"; //$NON-NLS-1$
public static final String EXTENSION = "extension"; //$NON-NLS-1$
public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
public static final String IS_TEST = "isTest"; //$NON-NLS-1$
public static final String MAKE_COMMAND = "makeCommand"; //$NON-NLS-1$
@ -49,6 +50,14 @@ public interface ITarget extends IBuildObject {
*/
public IConfiguration createConfiguration(String id);
/**
* Answers the extension that should be applied to build artifacts created by
* this target.
*
* @return String
*/
public String getArtifactExtension();
/**
* Get the name of the final build artifact.
*
@ -82,6 +91,7 @@ public interface ITarget extends IBuildObject {
* created by this target.
*
* @return String
* @deprecated
*/
public String getDefaultExtension();
@ -166,6 +176,14 @@ public interface ITarget extends IBuildObject {
*
*/
public void resetMakeCommand();
/**
* Set (override) the extension that should be appended to the build artifact
* for the receiver.
*
* @param extension
*/
public void setArtifactExtension(String extension);
/**
* Set the name of the artifact that will be produced when the receiver
@ -173,7 +191,7 @@ public interface ITarget extends IBuildObject {
*
* @param name
*/
public void setBuildArtifact(String name);
public void setArtifactName(String name);
/**
* Sets the make command for the receiver to the value in the argument.
@ -182,4 +200,11 @@ public interface ITarget extends IBuildObject {
*/
public void setMakeCommand(String command);
/**
* Sets the resource that owns the receiver.
*
* @param resource
*/
public void updateOwner(IResource resource);
}

View file

@ -29,7 +29,9 @@ import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.SerializerFactory;
import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.core.parser.*;
import org.eclipse.cdt.core.parser.IScannerInfo;
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.Target;
@ -64,8 +66,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
private static Map extensionTargetMap;
// Listeners interested in build model changes
private static Map buildModelListeners;
private static Map buildModelListeners;
/**
* Returns the list of targets that are defined by this project,
* projects referenced by this project, and by the extensions.
@ -99,10 +101,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return targets;
}
/**
/* (non-Javadoc)
* @return
*/
public static Map getExtensionTargetMap() {
protected static Map getExtensionTargetMap() {
if (extensionTargetMap == null) {
extensionTargetMap = new HashMap();
}
@ -202,7 +204,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
}
/**
/* (non-Javadoc)
*
* @param config
* @param option
*/
@ -368,8 +371,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
}
// Private stuff
/**
* @param target
*/
public static void addExtensionTarget(Target target) {
if (extensionTargets == null) {
extensionTargets = new ArrayList();
@ -379,6 +384,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
getExtensionTargetMap().put(target.getId(), target);
}
// Private stuff
private static ManagedBuildInfo loadBuildInfo(IProject project) {
ManagedBuildInfo buildInfo = null;
IFile file = project.getFile(FILE_NAME);
@ -401,6 +407,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return buildInfo;
}
/* (non-Javadoc)
* Since the class does not have a constructor, but all public methods
* call this method first, it is effectively a startup method
*/
private static void loadExtensions() {
if (extensionTargetsLoaded)
return;
@ -459,6 +469,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
ManagedBuildInfo buildInfo = null;
try {
buildInfo = (ManagedBuildInfo)resource.getSessionProperty(buildInfoProperty);
// Make sure that if a project has build info, that the info is not corrupted
if (buildInfo != null) {
buildInfo.updateOwner(resource);
}
} catch (CoreException e) {
return buildInfo;
}
@ -479,10 +493,27 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return buildInfo;
}
/**
* Answers the build information for the <code>IResource</code> in the
* argument. If the <code>create</code> is true, then a new build information
* repository will be created for the resource.
*
* @param resource
* @param create
* @return IManagedBuildInfo
*/
public static IManagedBuildInfo getBuildInfo(IResource resource, boolean create) {
return (IManagedBuildInfo) findBuildInfo(resource, create);
}
/**
* Answers, but does not create, the managed build information for the
* argument.
*
* @see ManagedBuildManager#getBuildInfo(IResource, boolean)
* @param resource
* @return IManagedBuildInfo
*/
public static IManagedBuildInfo getBuildInfo(IResource resource) {
return (IManagedBuildInfo) findBuildInfo(resource, false);
}
@ -551,5 +582,4 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
map.put(project, list);
}
}
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.internal.core;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2003,2004 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
@ -61,18 +61,19 @@ public class MakefileGenerator {
private static final String AUTO_DEP = COMMENT + ".autodeps"; //$NON-NLS-1$
// String constants for makefile contents
protected static final String COLON = ":";
protected static final String COLON = ":"; //$NON-NLS-1$
protected static final String DEPFILE_NAME = "subdir.dep"; //$NON-NLS-1$
protected static final String DOT = ".";
protected static final String DOT = "."; //$NON-NLS-1$
protected static final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
protected static final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
protected static final String LINEBREAK = "\\";
protected static final String NEWLINE = System.getProperty("line.separator");
protected static final String LOGICAL_AND = "&&";
protected static final String SEPARATOR = "/";
protected static final String TAB = "\t";
protected static final String WHITESPACE = " ";
protected static final String WILDCARD = "%";
protected static final String LINEBREAK = "\\"; //$NON-NLS-1$
protected static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
protected static final String LOGICAL_AND = "&&"; //$NON-NLS-1$
protected static final String SEPARATOR = "/"; //$NON-NLS-1$
protected static final String TAB = "\t"; //$NON-NLS-1$
protected static final String WHITESPACE = " "; //$NON-NLS-1$
protected static final String WILDCARD = "%"; //$NON-NLS-1$
protected static final String COMMENT_SYMBOL = "#"; //$NON-NLS-1$
// Local variables needed by generator
protected IManagedBuildInfo info;
@ -294,7 +295,7 @@ public class MakefileGenerator {
// Get the name of the build target
target = info.getBuildArtifactName();
// Get its extension
extension = (new Path(target)).getFileExtension();
extension = info.getBuildArtifactExtension();
if (extension == null) {
extension = new String();
}
@ -316,7 +317,7 @@ public class MakefileGenerator {
// Create the buffer to hold the output for the module and a dep calculator
StringBuffer buffer = new StringBuffer();
buffer.append(ManagedBuilderCorePlugin.getResourceString(AUTO_DEP) + NEWLINE);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(AUTO_DEP) + NEWLINE);
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
/*
@ -374,7 +375,7 @@ public class MakefileGenerator {
buffer.append("RM := ");
buffer.append(info.getCleanCommand() + NEWLINE + NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
buffer.append("C_SRCS := " + NEWLINE);
buffer.append("CC_SRCS := " + NEWLINE);
buffer.append("CXX_SRCS := " + NEWLINE);
@ -409,7 +410,7 @@ public class MakefileGenerator {
protected StringBuffer addSubdirectories() {
StringBuffer buffer = new StringBuffer();
// Add the comment
buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_LIST) + NEWLINE);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(MOD_LIST) + NEWLINE);
buffer.append("SUBDIRS := " + LINEBREAK + NEWLINE);
// Get all the module names
@ -427,7 +428,7 @@ public class MakefileGenerator {
// Now add the makefile instruction to include all the subdirectory makefile fragments
buffer.append(NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_INCL) + NEWLINE);
buffer.append(COMMENT_SYMBOL +WHITESPACE + ManagedBuilderCorePlugin.getResourceString(MOD_INCL) + NEWLINE);
buffer.append("-include ${patsubst %, %/subdir.mk, $(SUBDIRS)}" + NEWLINE);
buffer.append(NEWLINE + NEWLINE);
@ -460,10 +461,10 @@ public class MakefileGenerator {
capcBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
StringBuffer cppBuffer = new StringBuffer("CPP_SRCS += \\" + NEWLINE);
cppBuffer.append("${addprefix $(ROOT)/" + relativePath + "," + LINEBREAK + NEWLINE);
StringBuffer ruleBuffer = new StringBuffer(ManagedBuilderCorePlugin.getResourceString(MOD_RULES) + NEWLINE);
StringBuffer ruleBuffer = new StringBuffer(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(MOD_RULES) + NEWLINE);
// Put the comment in
buffer.append(ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
// Visit the resources in this folder
IResource[] resources = module.members();
@ -531,8 +532,11 @@ public class MakefileGenerator {
if (deps.length > 0) {
defaultTarget += WHITESPACE + "deps";
}
buffer.append(defaultTarget + WHITESPACE + outputPrefix + target + NEWLINE);
buffer.append(NEWLINE);
buffer.append(defaultTarget + WHITESPACE + outputPrefix + target);
if (extension.length() > 0) {
buffer.append(DOT + extension);
}
buffer.append(NEWLINE + NEWLINE);
/*
* The build target may depend on other projects in the workspace. These are
@ -555,12 +559,16 @@ public class MakefileGenerator {
// Extract the build artifact to add to the dependency list
String depTarget = depInfo.getBuildArtifactName();
String depExt = (new Path(depTarget)).getFileExtension();
String depExt = depInfo.getBuildArtifactExtension();
String depPrefix = depInfo.getOutputPrefix(depExt);
if (depInfo.isDirty()) {
depTargets = "clean all";
}
managedProjectOutputs.add(buildDir + SEPARATOR + depPrefix + depTarget);
String dependency = buildDir + SEPARATOR + depPrefix + depTarget;
if (depExt.length() > 0) {
dependency += DOT + depExt;
}
managedProjectOutputs.add(dependency);
}
buffer.append(TAB + "-cd" + WHITESPACE + buildDir + WHITESPACE + LOGICAL_AND + WHITESPACE + "$(MAKE) " + depTargets + NEWLINE);
}
@ -573,7 +581,11 @@ public class MakefileGenerator {
* targ_<prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>]
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
*/
buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(OBJS)");
buffer.append(outputPrefix + target);
if (extension.length() > 0) {
buffer.append(DOT + extension);
}
buffer.append(COLON + WHITESPACE + "$(OBJS)");
Iterator iter = managedProjectOutputs.listIterator();
while (iter.hasNext()) {
buffer.append(WHITESPACE + (String)iter.next());
@ -588,7 +600,7 @@ public class MakefileGenerator {
buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
buffer.append("-include ${patsubst %, %/subdir.dep, $(SUBDIRS)}" + NEWLINE);
return buffer;
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.internal.core;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2002,2004 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
@ -74,7 +74,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
// All the available targets have been read in
defaultTarget = (ITarget) targetMap.get(defaultTargetId);
// Now we have a misserable O(N^2) operation (oh well, the data sets are small)
// 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();
@ -133,13 +133,29 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getBuildArtifactExtension()
*/
public String getBuildArtifactExtension() {
String ext = new String();
ITarget target = getDefaultTarget();
if (target != null) {
ext = target.getArtifactExtension();
}
return ext;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getBuildArtifactName()
*/
public String getBuildArtifactName() {
// Get the default target and use its value
String name = getDefaultTarget().getArtifactName();
return name == null ? new String() : name;
String name = new String();
ITarget target = getDefaultTarget();
if (target != null) {
name = target.getArtifactName();
}
return name;
}
/* (non-Javadoc)
@ -149,7 +165,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// Get from the model
String command = new String();
ITarget target = getDefaultTarget();
command = target.getCleanCommand();
if (target != null) {
command = target.getCleanCommand();
}
return command;
}
@ -359,7 +377,12 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// Return the include paths for the default configuration
ArrayList paths = new ArrayList();
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
IPath root = owner.getLocation().addTrailingSeparator().append(config.getName());
IPath location = owner.getLocation();
// If the build info is out of date this might be null
if (location == null) {
location = new Path(".");
}
IPath root = location.addTrailingSeparator().append(config.getName());
ITool[] tools = config.getTools();
for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i];
@ -867,4 +890,22 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
this.isDirty = isDirty;
}
/**
* @param resource
*/
public void updateOwner(IResource resource) {
// Check to see if the owner is the same as the argument
if (resource != null) {
if (!owner.equals(resource)) {
owner = resource;
// Do the same for the targets
Iterator iter = targets.listIterator();
while(iter.hasNext()) {
ITarget target = (ITarget) iter.next();
target.updateOwner(resource);
}
}
}
}
}

View file

@ -19,9 +19,9 @@ ManagedMakeBuilder.message.creating.markers = Generating markers...
ManagedMakeBuilder.message.error = Build error
ManagedMakeBuilder.message.error.refresh = Error refreshing project.
ManagedMakeBuilder.message.finished = Build complete for project {0}
ManagedMakeBuilder.comment.module.list = # Every subdirectory with source files must be described here
ManagedMakeBuilder.comment.source.list = # Each subdirectory must contribute its source files here
ManagedMakeBuilder.comment.build.rule = # Each subdirectory must supply rules for building sources it contributes
ManagedMakeBuilder.comment.module.make.includes = # Include the makefiles for each source subdirectory
ManagedMakeBuilder.comment.module.dep.includes = # Include automatically-generated dependency list:
ManagedMakeBuilder.comment.autodeps = # Automatically-generated dependency list:
ManagedMakeBuilder.comment.module.list = Every subdirectory with source files must be described here
ManagedMakeBuilder.comment.source.list = Each subdirectory must contribute its source files here
ManagedMakeBuilder.comment.build.rule = Each subdirectory must supply rules for building sources it contributes
ManagedMakeBuilder.comment.module.make.includes = Include the makefiles for each source subdirectory
ManagedMakeBuilder.comment.module.dep.includes = Include automatically-generated dependency list:
ManagedMakeBuilder.comment.autodeps = Automatically-generated dependency list:

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.internal.core;
/**********************************************************************
* Copyright (c) 2003 IBM Corporation and others.
* Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@ -39,6 +39,7 @@ public class Target extends BuildObject implements ITarget {
private Map configMap;
private List configurations;
private String defaultExtension;
private String extension;
private boolean isAbstract = false;
private boolean isTest = false;
private String makeCommand;
@ -77,7 +78,7 @@ public class Target extends BuildObject implements ITarget {
setName(parent.getName());
this.artifactName = parent.getArtifactName();
this.binaryParserId = parent.getBinaryParserId();
this.defaultExtension = parent.getDefaultExtension();
this.defaultExtension = parent.getArtifactExtension();
this.isTest = parent.isTestTarget();
this.cleanCommand = parent.getCleanCommand();
@ -193,8 +194,10 @@ public class Target extends BuildObject implements ITarget {
// contain what the user entered in the UI).
artifactName = element.getAttribute(ARTIFACT_NAME);
// Get the default extension
defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
// Get the overridden extension
if (element.hasAttribute(EXTENSION)) {
extension = element.getAttribute(EXTENSION);
}
// parent
String parentId = element.getAttribute(PARENT);
@ -261,7 +264,9 @@ public class Target extends BuildObject implements ITarget {
element.setAttribute(PARENT, parent.getId());
element.setAttribute(IS_ABSTRACT, isAbstract ? "true" : "false");
element.setAttribute(ARTIFACT_NAME, getArtifactName());
element.setAttribute(DEFAULT_EXTENSION, getDefaultExtension());
if (extension != null) {
element.setAttribute(EXTENSION, extension);
}
element.setAttribute(IS_TEST, isTest ? "true" : "false");
element.setAttribute(CLEAN_COMMAND, getCleanCommand());
if (makeCommand != null) {
@ -410,8 +415,9 @@ public class Target extends BuildObject implements ITarget {
return emptyConfigs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#getDefaultExtension()
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getDefaultExtension()
*/
public String getDefaultExtension() {
return defaultExtension == null ? EMPTY_STRING : defaultExtension;
@ -442,6 +448,28 @@ public class Target extends BuildObject implements ITarget {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getArtifactExtension()
*/
public String getArtifactExtension() {
// Has the user changed the extension for this target
if (extension != null) {
return extension;
}
// If not, then go through the default extension lookup
if (defaultExtension == null) {
// Ask my parent first
if (parent != null) {
return parent.getArtifactExtension();
} else {
return EMPTY_STRING;
}
} else {
return defaultExtension;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getBinaryParserId()
*/
@ -476,7 +504,7 @@ public class Target extends BuildObject implements ITarget {
configurations.add(configuration);
configMap.put(configuration.getId(), configuration);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#isAbstract()
*/
@ -506,9 +534,18 @@ public class Target extends BuildObject implements ITarget {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#setBuildArtifact(java.lang.String)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setArtifactExtension(java.lang.String)
*/
public void setBuildArtifact(String name) {
public void setArtifactExtension(String extension) {
if (extension != null) {
this.extension = extension;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#setArtifactName(java.lang.String)
*/
public void setArtifactName(String name) {
if (name != null) {
artifactName = name;
}
@ -523,4 +560,14 @@ public class Target extends BuildObject implements ITarget {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#updateOwner(org.eclipse.core.resources.IResource)
*/
public void updateOwner(IResource resource) {
if (!resource.equals(owner)) {
// Set the owner correctly
owner = resource;
}
}
}

View file

@ -1,164 +1,189 @@
2003-11-10 Tanya Wolff
I18N-Externalized strings from plugin.xml.
I18N-Added keys & strings to plugin.properties.
Fixed an id error in linux c compiler debugger options.
* plugin.xml
* plugin.properties
2003-11-11 Sean Evoy
Work to implement bugzilla 44841:
Added a scrollbar to the list control inside the custom list field editor.
Also added an Edit button to the field editor to make it easier for keyboard-only
accessibility.
Work for bugzilla 44451:
Changed the method that prompts user for information so that if the user cancels
with an empty input dialog, the method always returns an empty string. The responsibility
now rests with the caller to test the return value for length > 0 to decide whether or
not to add string to the list.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
Moved string constants from core UI plugin to build UI plugin. These values are duplicated
in the standadrd make UI plugin anyway, so the argument for keeping them in a common
plugin seems pretty weak. This removes another dependency between the builder UI and
common UI plugin. I did have to change the string resource lookup method in a few of
the UI implementation classes that use the constants.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/ui/properties/BrowseEntryDialog.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
2003-10-17 Tom Tromey
Changed -werror to -Werror
* plugin.xml
2003-10-14 Alain Magloire
ICOptionPage was added a new method
Preferences getPreferences();
This is needed to get the preference store when saving
On the plugin. We had the equivalent for project
IProject getProject();
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage
2003-10-01 Sean Evoy
Fix for bugs 43490 (trivial), 44020, and 43980.
A massive change has occurred in the plugin file. I added new C tools that apply
only to projects with C natures. I also added option overrides in the default
configurations for these new tools. The trivial fix for the new C project wizard
involved changing the icon entry in the plugin file.
* plugin.xml
In preparation for 44020, each new configuration created is assigned a truly
random ID.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
Removed a tooltip that was not being populated properly.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
2003-09-30 Sean Evoy
Fix for bug 41826.
Updated the tool specifications for Win32, Linux, and Solaris so that header
file extension info is available.
* plugin.xml
2003-09-25 Sean Evoy
For bug (really an enhancement request)43756, I added the word default to a
widget label to try and make it clear that a new configuration will be based
on default values, not user-overridden stuff. It remains to be seen if this
actually helps, but it seems reasonable.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
For bug 43220 I now display a widget just for user objects.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
I also reordered the plugin definition for the linker tools, and moved some of
the option labels to the plugin property file. I also added a user object option
to each linker tool definition.
* plugin.properties
* plugin.xml
2003-09-25 Sean Evoy
This patch contains a lot of changes needed to implement fixes for 42648 and
43122.
The properties file has been updated to externalize some of the option labels
to try and address some of the concern about continuity between UIs on
different platforms.
* plugin.properties
There are changes in the plugin XML file to accomodate showing the targets
only on the correct host platform. Option names have bee replaced with
externalized equivalents where possible. The release and debug configurations
for each configuration now apply "reasonable" defaults for debug and optimization
option. Finally, the Cygwinb tool specification has been brought closer to those
for *nix.
* plugin.xml
Only targets that correspond to the host platforms are shown in the drop-down
list.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
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.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
Added the hard-coded binary parser info to the defined targets.
* plugin.xml
Fixed the event handling for add/remove in the list widget for build settings pages.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
2003-09-16 Sean Evoy
Changed the initialization and button status logic so the list buttons are
enabled correctly on start-up and that the fist item in the list (if
any) is selected. Also changed the "Add" event handler to properly enable
the buttons and set the list selection.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
2003-09-15 Sean Evoy
First submission of code to new project. Moved all the managed
builder-specific UI elements out of the cdt.ui project. This
includes the icons, and externalized strings.
There are 2 new classes to handle the externalized strings and image
files:
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java
* src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIImages.java
The property pages have been modified to use a mix of externalized
strings from the CUIPlugin and ManagedBuilderUIPlugin. The new project
wizard has been reimplemented using the new C project classes added by
2004-2-17 Sean Evoy
Fixes for 51640
Externalized strings for the target names.
* plugin.properties
* plugin.xml
Fixes for bug 49590:
The system now makes a distinction between the name of the output and its extension.
The UI for managing the name of the build output now has a field for entering the
extension. The new project wizard does not automatically append the extension to the
name of the build output.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
Some ground work for C11:
Added a browse button and an area for selecting a path variable to the browse
dialog. However, this is still turned off since it is not fully functional.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/ui/properties/BrowseEntryDialog.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
Changed the order of the configurations in the manifest so that debug configurations are the default for every project.
* plugin.xml
2003-11-10 Tanya Wolff
I18N-Externalized strings from plugin.xml.
I18N-Added keys & strings to plugin.properties.
Fixed an id error in linux c compiler debugger options.
* plugin.xml
* plugin.properties
2003-11-11 Sean Evoy
Work to implement bugzilla 44841:
Added a scrollbar to the list control inside the custom list field editor.
Also added an Edit button to the field editor to make it easier for keyboard-only
accessibility.
Work for bugzilla 44451:
Changed the method that prompts user for information so that if the user cancels
with an empty input dialog, the method always returns an empty string. The responsibility
now rests with the caller to test the return value for length > 0 to decide whether or
not to add string to the list.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
Moved string constants from core UI plugin to build UI plugin. These values are duplicated
in the standadrd make UI plugin anyway, so the argument for keeping them in a common
plugin seems pretty weak. This removes another dependency between the builder UI and
common UI plugin. I did have to change the string resource lookup method in a few of
the UI implementation classes that use the constants.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/ui/properties/BrowseEntryDialog.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
2003-10-17 Tom Tromey
Changed -werror to -Werror
* plugin.xml
2003-10-14 Alain Magloire
ICOptionPage was added a new method
Preferences getPreferences();
This is needed to get the preference store when saving
On the plugin. We had the equivalent for project
IProject getProject();
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage
2003-10-01 Sean Evoy
Fix for bugs 43490 (trivial), 44020, and 43980.
A massive change has occurred in the plugin file. I added new C tools that apply
only to projects with C natures. I also added option overrides in the default
configurations for these new tools. The trivial fix for the new C project wizard
involved changing the icon entry in the plugin file.
* plugin.xml
In preparation for 44020, each new configuration created is assigned a truly
random ID.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
Removed a tooltip that was not being populated properly.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
2003-09-30 Sean Evoy
Fix for bug 41826.
Updated the tool specifications for Win32, Linux, and Solaris so that header
file extension info is available.
* plugin.xml
2003-09-25 Sean Evoy
For bug (really an enhancement request)43756, I added the word default to a
widget label to try and make it clear that a new configuration will be based
on default values, not user-overridden stuff. It remains to be seen if this
actually helps, but it seems reasonable.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
For bug 43220 I now display a widget just for user objects.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
I also reordered the plugin definition for the linker tools, and moved some of
the option labels to the plugin property file. I also added a user object option
to each linker tool definition.
* plugin.properties
* plugin.xml
2003-09-25 Sean Evoy
This patch contains a lot of changes needed to implement fixes for 42648 and
43122.
The properties file has been updated to externalize some of the option labels
to try and address some of the concern about continuity between UIs on
different platforms.
* plugin.properties
There are changes in the plugin XML file to accomodate showing the targets
only on the correct host platform. Option names have bee replaced with
externalized equivalents where possible. The release and debug configurations
for each configuration now apply "reasonable" defaults for debug and optimization
option. Finally, the Cygwinb tool specification has been brought closer to those
for *nix.
* plugin.xml
Only targets that correspond to the host platforms are shown in the drop-down
list.
* src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
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.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
Added the hard-coded binary parser info to the defined targets.
* plugin.xml
Fixed the event handling for add/remove in the list widget for build settings pages.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
2003-09-16 Sean Evoy
Changed the initialization and button status logic so the list buttons are
enabled correctly on start-up and that the fist item in the list (if
any) is selected. Also changed the "Add" event handler to properly enable
the buttons and set the list selection.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionListFieldEditor.java
2003-09-15 Sean Evoy
First submission of code to new project. Moved all the managed
builder-specific UI elements out of the cdt.ui project. This
includes the icons, and externalized strings.
There are 2 new classes to handle the externalized strings and image
files:
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
* src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIPlugin.java
* src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuilderUIImages.java
The property pages have been modified to use a mix of externalized
strings from the CUIPlugin and ManagedBuilderUIPlugin. The new project
wizard has been reimplemented using the new C project classes added by
QNX September 12, 2003. The UI itself has not changed.

View file

@ -7,15 +7,34 @@ MngCWizard.description=Create a new C project and let Eclipse create and manage
MngCCWizard.name=Managed Make C++ Project
MngCCWizard.description=Create a new C++ project and let Eclipse create and manage the makefile
#The property pages
MngBuildProp.name=C/C++ Build
# Build Model Names
TargetName.cygw=Cygwin
TargetName.cygw.exe=Cygwin Executable
TargetName.cygw.so=Cygwin Shared Library
TargetName.cygw.lib=Cygwin Static Library
TargetName.cygw.dll=Cygwin Export Library (DLL)
TargetName.linux=Linux
TargetName.linux.exe=Linux Executable
TargetName.linux.so=Linux Shared Library
TargetName.linux.lib=Linux Static Library
TargetName.solaris=Solaris
TargetName.solaris.exe=Solaris Executable
TargetName.solaris.so=Solaris Shared Library
TargetName.solaris.lib=Solaris Static Library
ConfigName.Rel=Release
ConfigName.Dbg=Debug
ToolName.preprocessor = Preprocessor
ToolName.compiler.c = C Compiler
ToolName.compiler.cpp = C++ Compiler
ToolName.archiver = Archiver
ToolName.linker.c = C Linker
ToolName.linker.cpp = C++ Linker
OptionCategory.Symbols = Symbols
OptionCategory.Preproc = Preprocessor
OptionCategory.Dirs = Directories

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,8 @@ NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
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.output.name=Artifact name:
ManageConfig.label.output.extension=Artifact extension:
ManageConfig.label.configs=Manage configurations
ManageConfig.label.restore=Restore
ManageConfig.label.configs.current=Current:

View file

@ -1,73 +1,102 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* 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
/*******************************************************************************
* Copyright (c) 2002,2004 IBM 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
* **********************************************************************/
* Contributors: IBM Rational Software - Initial API and implementation
******************************************************************************/
import org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
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.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
public class BrowseEntryDialog extends Dialog {
/**
* The BrowseEntryDialog allows clients to prompt the user for a path location.
* The dialog will contain a browse button to make it easy to lcate absolute
* locations onthe target file system. The user will also be able to specify a
* location using defined variables. The client must be able to deal with these
* variables.
*/
public class BrowseEntryDialog extends SelectionStatusDialog {
// String constants
private static final String PREFIX = "BuildPropertyCommon"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String BROWSE = LABEL + ".browse"; //$NON-NLS-1$
/**
private static final String PREFIX = "BuildPropertyCommon"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String BROWSE = LABEL + ".browse"; //$NON-NLS-1$
private static final String HIDE = "hideAdvanced"; //$NON-NLS-1$
private static final String SHOW = "showAdvanced"; //$NON-NLS-1$
private static final String EMPTY = "NewFolderDialog.folderNameEmpty"; //$NON-NLS-1$
/* (non-Javadoc)
* The title of the dialog.
*/
private String title = "";
/**
/* (non-Javadoc)
* The message to display, or <code>null</code> if none.
*/
private String message = "";
/**
/* (non-Javadoc)
* The input value; the empty string by default.
*/
private String value = "";
/**
* Error message label widget.
private String folderName = "";
/* (non-Javadoc)
*
*/
private Label errorMessageLabel;
private int basicShellHeight;
/* (non-Javadoc)
*
*/
// private CreateLinkedResourceGroup linkedResourceGroup;
// Widgets
private Button btnBrowse = null;
private Button btnOK = null;
private Button advancedButton = null;
private Button browseButton = null;
private Label errorMessageLabel;
private Composite macroComposite;
private Text text = null;
/**
* Creates an input dialog with OK, Cancel, and a Browse button.
* Creates an input dialog with OK, Cancel, a Browse button and a button to
* reveal path macros.
*
* @param shell the parent shell
* @param dialogTitle the title of the dialog or <code>null</code> if none
* @param dialogMessage the dialog message, or <code>null</code> if none
* @param initialValue the initial input value, or <code>null</code> if none
* (equivalent to the empty string)
* @param shell
* the parent shell
* @param dialogTitle
* the title of the dialog or <code>null</code> if none
* @param dialogMessage
* the dialog message, or <code>null</code> if none
* @param initialValue
* the initial input value, or <code>null</code> if none
* (equivalent to the empty string)
*/
public BrowseEntryDialog(Shell shell, String dialogTitle, String dialogMessage, String initialValue) {
super(shell);
@ -81,105 +110,228 @@ public class BrowseEntryDialog extends Dialog {
}
// Value for the text widget
if (initialValue != null) {
value = initialValue;
folderName = initialValue;
}
setStatusLineAboveButtons(true);
}
/* (non-Javadoc)
* Method declared on Dialog.
* @see org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog#computeResult()
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
value = text.getText().trim();
} else {
value = null;
}
super.buttonPressed(buttonId);
protected void computeResult() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* Method declared in Window.
* @see org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null)
// Set the display title the user has specified
if (title != null) {
shell.setText(title);
}
protected Control createDialogArea(Composite parent) {
Composite composite = ControlFactory.createComposite(parent, 4);
// Create the label
if (message != null) {
Label label = new Label(composite, SWT.WRAP);
label.setText(message);
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
gd.horizontalSpan = 4;
label.setLayoutData(gd);
label.setFont(parent.getFont());
}
text = new Text(composite, SWT.SINGLE | SWT.BORDER);
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 3;
text.setLayoutData(gd);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateButtonState();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog#create()
*/
public void create() {
// Disable the OK button to start
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
/* (non-Javadoc)
*
* @param parent
*/
private void createAdvancedBrowseArea(Composite parent) {
// Instantiate the macros button
advancedButton = new Button(parent, SWT.PUSH);
applyDialogFont(advancedButton);
advancedButton.setText(IDEWorkbenchMessages.getString(SHOW));
setButtonLayoutData(advancedButton);
GridData data = (GridData) advancedButton.getLayoutData();
data.horizontalAlignment = GridData.BEGINNING;
advancedButton.setLayoutData(data);
advancedButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleAdvancedPressed();
}
});
advancedButton.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
advancedButton = null;
}
});
// Instantiate the browse button
btnBrowse = ControlFactory.createPushButton(composite, ManagedBuilderUIPlugin.getResourceString(BROWSE));
setButtonLayoutData(btnBrowse);
btnBrowse.addSelectionListener(new SelectionAdapter () {
// linkedResourceGroup = new CreateLinkedResourceGroup(
// IResource.FOLDER,
// new Listener(){
// public void handleEvent(Event event) {
// // TODO Auto-generated method stub
//
// }
// });
}
/* (non-Javadoc)
*
* @param parent
*/
private void createBasicBrowseArea(Composite parent) {
Composite basicGroup = new Composite(parent, SWT.NONE);
basicGroup.setLayout(new GridLayout(2, false));
basicGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridData data;
// Create the label
if (message != null) {
Label label = new Label(basicGroup, SWT.WRAP);
label.setText(message);
data = new GridData(
GridData.FILL_HORIZONTAL |
GridData.GRAB_VERTICAL |
GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
data.horizontalSpan = 2;
label.setLayoutData(data);
applyDialogFont(label);
}
// Entry widget next
text = new Text(basicGroup, SWT.SINGLE | SWT.BORDER);
data = new GridData(GridData.FILL_BOTH);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
text.setLayoutData(data);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateLocation();
}
});
applyDialogFont(text);
// Finally make the browse button
browseButton = new Button(basicGroup, SWT.PUSH);
applyDialogFont(browseButton);
browseButton.setText(ManagedBuilderUIPlugin.getResourceString(BROWSE));
setButtonLayoutData(browseButton);
data = (GridData) browseButton.getLayoutData();
data.horizontalAlignment = GridData.BEGINNING;
browseButton.setLayoutData(data);
browseButton.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
handleBrowsePressed();
}
});
browseButton.addDisposeListener(new DisposeListener () {
public void widgetDisposed(DisposeEvent e) {
browseButton = null;
}
});
}
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
createBasicBrowseArea(composite);
createAdvancedBrowseArea(composite);
return composite;
}
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
btnOK = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
/**
* Answers the value the user has entered in the selection dialog.
*
* <p>The selection will be a folder location specified in the format appropriate
* for the platform that Eclipse is running on, i.e. <code>C:\foo\mydir</code>
* for Windows platforms and <code>/foo/mydir</code> on POSIX platforms.
*
* <p>The answer may also contain a path variable as a component of the location. It
* is the responsibility of the client to properly handle this situation.
*
* @return String
*/
public String getValue() {
return folderName;
}
text.setFocus();
if (value != null) {
text.setText(value);
/* (non-Javadoc)
* Shows/hides the path macro widgets.
*/
protected void handleAdvancedPressed() {
Shell shell = getShell();
Point shellSize = shell.getSize();
if (macroComposite == null) {
basicShellHeight = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
Composite composite = (Composite) getDialogArea();
// macroComposite = linkedResourceGroup.createContents(composite);
macroComposite = ControlFactory.createComposite(composite, 1);
shellSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
shell.setSize(shellSize);
advancedButton.setText(IDEWorkbenchMessages.getString(HIDE));
} else if (macroComposite.getVisible()) {
macroComposite.setVisible(false);
shell.setSize(shellSize.x, basicShellHeight);
advancedButton.setText(IDEWorkbenchMessages.getString(SHOW));
} else {
macroComposite.setVisible(true);
shellSize = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
shell.setSize(shellSize);
advancedButton.setText(IDEWorkbenchMessages.getString(HIDE));
}
updateButtonState();
}
protected String getValue() {
return value;
}
/* (non-Javadoc)
*
*/
protected void handleBrowsePressed() {
// Popup a file browser widget
DirectoryDialog dialog = new DirectoryDialog(getShell());
// Create a hint if text widget contains value
String widgetText;
if ((widgetText = text.getText().trim()).length() > 0) {
dialog.setFilterPath(widgetText);
}
// Open the selection dialog and populate the widget
String directory;
if ((directory = dialog.open()) != null) {
/*
* TODO: Convert the dialog to the proper format for platform (i.e.
* if platform.pathStyle == Platform.POSIX then swap \\ to / )
*/
text.setText(directory.trim());
updateButtonState();
}
// TODO Auto-generated method stub
}
protected void updateButtonState() {
if (btnOK != null)
btnOK.setEnabled(text.getText().trim().length() > 0);
/* (non-Javadoc)
* Utility method to send a status message to the status line of the dialog.
*
* @param severity
* @param message
*/
private void updateStatus(int severity, String message) {
updateStatus(new Status(severity, ManagedBuilderCorePlugin.getUniqueIdentifier(), severity, message, null));
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog#updateStatus(org.eclipse.core.runtime.IStatus)
*/
protected void updateStatus(IStatus status) {
// TODO Auto-generated method stub
super.updateStatus(status);
}
/**
*
*/
protected void validateLocation() {
folderName = text.getText();
// Empty or null string is invalid
if (folderName == null || folderName.equals("")) {
updateStatus(IStatus.ERROR, IDEWorkbenchMessages.getString(EMPTY));
return;
} else {
// Make sure that the specified location exists
IPath path = new Path(folderName);
if (!path.isValidPath(folderName)) {
updateStatus(IStatus.ERROR, "Folder name invalid");
return;
}
}
updateStatus(IStatus.OK, ""); //$NON-NLS-1$
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2002,2004 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
@ -43,13 +43,6 @@ public class BuildOptionListFieldEditor extends FieldEditor {
private static final String DOWN = "BuildPropertyCommon.label.down"; //$NON-NLS-1$
private static final String EDIT = "BuildPropertyCommon.label.editVar"; //$NON-NLS-1$
// UI constants
private static final int VERTICAL_DIALOG_UNITS_PER_CHAR = 8;
private static final int HORIZONTAL_DIALOG_UNITS_PER_CHAR = 4;
private static final int LIST_HEIGHT_IN_CHARS = 10;
private static final int LIST_HEIGHT_IN_DLUS =
LIST_HEIGHT_IN_CHARS * VERTICAL_DIALOG_UNITS_PER_CHAR;
// The top-level control for the field editor.
private Composite top;
// The list of tags.
@ -171,14 +164,6 @@ public class BuildOptionListFieldEditor extends FieldEditor {
// Make the list
list = new List(controlGroup, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
// Create a grid data that takes up the extra space in the dialog and spans one column.
GridData listData = new GridData(GridData.FILL_HORIZONTAL);
listData.heightHint =
convertVerticalDLUsToPixels(list, LIST_HEIGHT_IN_DLUS);
listData.horizontalSpan = 1;
list.setLayoutData(listData);
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
selectionChanged();
@ -222,6 +207,12 @@ public class BuildOptionListFieldEditor extends FieldEditor {
// Create the buttons
createButtons(buttonGroup);
// Create a grid data that takes up the extra space in the dialog and spans one column.
GridData listData = new GridData(GridData.FILL_HORIZONTAL);
listData.heightHint = buttonGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
listData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
list.setLayoutData(listData);
}
/* (non-Javadoc)
@ -329,9 +320,11 @@ public class BuildOptionListFieldEditor extends FieldEditor {
protected String getNewInputObject() {
// Create a dialog to prompt for a new symbol or path
InputDialog dialog = new InputDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, new String(), null);
// BrowseEntryDialog dialog = new BrowseEntryDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, new String());
String input = new String();
if (dialog.open() == InputDialog.OK) {
input = dialog.getValue();
// if (dialog.open() == BrowseEntryDialog.OK) {
input = dialog.getValue();
}
return input;
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2002,2004 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
@ -446,7 +446,11 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Get the build output name
String newBuildOutput = manageDialog.getBuildArtifactName();
if (!selectedTarget.getArtifactName().equals(newBuildOutput)) {
selectedTarget.setBuildArtifact(newBuildOutput);
selectedTarget.setArtifactName(newBuildOutput);
}
String newBuildExt = manageDialog.getBuildArtifaceExtension();
if (!selectedTarget.getArtifactExtension().equals(newBuildExt)) {
selectedTarget.setArtifactExtension(newBuildExt);
}
// Get the new make command

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2002,2004 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
@ -19,7 +19,6 @@ 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.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@ -29,6 +28,7 @@ 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.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@ -50,14 +50,16 @@ public class ManageConfigDialog extends Dialog {
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 OUTPUT_EXT = LABEL + ".output.extension"; //$NON-NLS-1$
private static final String OUTPUT_NAME = LABEL + ".output.name"; //$NON-NLS-1$
private static final String CONFIGS = LABEL + ".configs"; //$NON-NLS-1$
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 name of the build artifact
private String buildArtifact;
private String artifactExt;
private String artifactName;
// The list of configurations to delete
private SortedMap deletedConfigs;
// Map of configuration names and ids
@ -74,7 +76,8 @@ public class ManageConfigDialog extends Dialog {
private boolean useDefaultMake;
// Widgets
protected Text buildArtifactEntry;
protected Text buildArtifactExt;
protected Text buildArtifactName;
protected List currentConfigList;
protected List deletedConfigList;
protected Button makeCommandDefault;
@ -96,7 +99,8 @@ public class ManageConfigDialog extends Dialog {
makeCommand = managedTarget.getMakeCommand();
// Get the name of the build artifact
buildArtifact = managedTarget.getArtifactName();
artifactExt = managedTarget.getArtifactExtension();
artifactName = managedTarget.getArtifactName();
// Get the defined configurations from the target
getExistingConfigs().clear();
@ -117,16 +121,17 @@ public class ManageConfigDialog extends Dialog {
if (buttonId == IDialogConstants.OK_ID) {
useDefaultMake = makeCommandDefault.getSelection();
makeCommand = makeCommandEntry.getText().trim();
buildArtifact = buildArtifactEntry.getText().trim();
artifactName = buildArtifactName.getText().trim();
artifactExt = buildArtifactExt.getText().trim();
} else {
useDefaultMake = true;
buildArtifact = managedTarget.getArtifactName();
artifactName = managedTarget.getArtifactName();
}
super.buttonPressed(buttonId);
}
/* (non-Javadoc)
* Method declared in Window.
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
@ -134,6 +139,65 @@ public class ManageConfigDialog extends Dialog {
shell.setText(title);
}
/* (non-Javadoc)
* Creates the group that contains the build artifact name controls.
*/
private void createBuildArtifactGroup(Composite parent) {
final Group outputGroup = new Group(parent, SWT.NONE);
outputGroup.setFont(parent.getFont());
outputGroup.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_GROUP));
outputGroup.setLayout(new GridLayout(3, false));
outputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Three labels
final Label nameLabel = new Label(outputGroup, SWT.LEFT);
nameLabel.setFont(outputGroup.getFont());
nameLabel.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_NAME));
nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Label placeHolder = new Label(outputGroup, SWT.CENTER);
placeHolder.setText(new String());
placeHolder.setLayoutData(new GridData());
final Label extLabel = new Label(outputGroup, SWT.LEFT);
extLabel.setFont(outputGroup.getFont());
extLabel.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_EXT));
extLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Now we need two text widgets separated by a label
buildArtifactName = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
buildArtifactName.setFont(outputGroup.getFont());
buildArtifactName.setText(artifactName);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
buildArtifactName.setLayoutData(data);
buildArtifactName.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
buildArtifactName = null;
}
});
final Label dotLabel = new Label(outputGroup, SWT.CENTER);
dotLabel.setFont(outputGroup.getFont());
dotLabel.setText(new String("."));
dotLabel.setLayoutData(new GridData());
buildArtifactExt = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
buildArtifactExt.setFont(outputGroup.getFont());
buildArtifactExt.setText(artifactExt);
data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
buildArtifactExt.setLayoutData(data);
buildArtifactExt.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
buildArtifactExt = null;
}
});
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
@ -142,71 +206,40 @@ public class ManageConfigDialog extends Dialog {
updateButtons();
}
protected Control createDialogArea(Composite parent) {
Composite comp = ControlFactory.createComposite(parent, 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);
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;
}
});
/* (non-Javadoc)
* Create and lays out the group with the configuration edit controls
*/
private void createConfigListGroup(Composite parent) {
// Create the config list group area
Group configListGroup = ControlFactory.createGroup(comp, ManagedBuilderUIPlugin.getResourceString(CONFIGS), 3);
gd = new GridData(GridData.FILL_BOTH);
configListGroup.setLayoutData(gd);
final Group configListGroup = new Group(parent, SWT.NONE);
configListGroup.setFont(parent.getFont());
configListGroup.setText(ManagedBuilderUIPlugin.getResourceString(CONFIGS));
configListGroup.setLayout(new GridLayout(3, false));
configListGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
// 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));
final Label currentConfigLabel = new Label(configListGroup, SWT.LEFT);
currentConfigLabel.setFont(configListGroup.getFont());
currentConfigLabel.setText(ManagedBuilderUIPlugin.getResourceString(CURRENT_CONFIGS));
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
currentConfigLabel.setLayoutData(data);
final Label deletedConfigLabel = new Label(configListGroup, SWT.LEFT);
deletedConfigLabel.setFont(configListGroup.getFont());
deletedConfigLabel.setText(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);
final Composite currentComp = new Composite(configListGroup, SWT.NULL);
currentComp.setFont(configListGroup.getFont());
currentComp.setLayout(new GridLayout(1, true));
currentComp.setLayoutData(new GridData(GridData.FILL_BOTH));
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.setFont(currentComp.getFont());
data = new GridData(GridData.FILL_BOTH);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
currentConfigList.setLayoutData(data);
currentConfigList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
currentConfigList = null;
@ -214,10 +247,14 @@ public class ManageConfigDialog extends Dialog {
});
// Create a composite for the buttons
Composite buttonBar = ControlFactory.createComposite(configListGroup, 1);
buttonBar.setLayoutData(new GridData());
final Composite buttonBar = new Composite(configListGroup, SWT.NULL);
buttonBar.setFont(configListGroup.getFont());
buttonBar.setLayout(new GridLayout(1, true));
buttonBar.setLayoutData(new GridData(GridData.FILL_VERTICAL));
newBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(NEW));
newBtn = new Button(buttonBar, SWT.PUSH);
newBtn.setFont(buttonBar.getFont());
newBtn.setText(ManagedBuilderUIPlugin.getResourceString(NEW));
setButtonLayoutData(newBtn);
newBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -229,7 +266,10 @@ public class ManageConfigDialog extends Dialog {
newBtn = null;
}
});
removeBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(REMOVE));
removeBtn = new Button(buttonBar, SWT.PUSH);
removeBtn.setFont(buttonBar.getFont());
removeBtn.setText(ManagedBuilderUIPlugin.getResourceString(REMOVE));
setButtonLayoutData(removeBtn);
removeBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -241,7 +281,10 @@ public class ManageConfigDialog extends Dialog {
removeBtn = null;
}
});
restoreBtn = ControlFactory.createPushButton(buttonBar, ManagedBuilderUIPlugin.getResourceString(RESTORE));
restoreBtn = new Button(buttonBar, SWT.PUSH);
restoreBtn.setFont(buttonBar.getFont());
restoreBtn.setText(ManagedBuilderUIPlugin.getResourceString(RESTORE));
setButtonLayoutData(restoreBtn);
restoreBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -255,42 +298,104 @@ public class ManageConfigDialog extends Dialog {
});
// Create the deleted config list
Composite deletedComp = ControlFactory.createComposite(configListGroup, 1);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
deletedComp.setLayoutData(gd);
final Composite deletedComp = new Composite(configListGroup, SWT.NULL);
deletedComp.setFont(configListGroup.getFont());
deletedComp.setLayout(new GridLayout(1, true));
deletedComp.setLayoutData(new GridData(GridData.FILL_BOTH));
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.setFont(deletedComp.getFont());
data = new GridData(GridData.FILL_BOTH);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
deletedConfigList.setLayoutData(data);
deletedConfigList.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
deletedConfigList = null;
}
});
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite comp = new Composite(parent, SWT.NULL);
comp.setFont(parent.getFont());
comp.setLayout(new GridLayout(1, true));
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
// Create a group for the build output
createBuildArtifactGroup(comp);
// Create the make command group area
createMakeCommandGroup(comp);
// Make the configuration management area
createConfigListGroup(comp);
// Do the final widget prep
currentConfigList.setItems(getConfigurationNames());
currentConfigList.select(0);
newBtn.setFocus();
return comp;
}
/* (non-Javadoc)
* Creates the group control for the make command
* @param parent
*/
private void createMakeCommandGroup(Composite parent) {
final Group makeCommandGroup = new Group(parent, SWT.NONE);
makeCommandGroup.setFont(parent.getFont());
makeCommandGroup.setText(ManagedBuilderUIPlugin.getResourceString(GROUP));
makeCommandGroup.setLayout(new GridLayout(1, true));
makeCommandGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
makeCommandDefault = new Button(makeCommandGroup, SWT.CHECK | SWT.LEFT);
makeCommandDefault.setFont(makeCommandGroup.getFont());
makeCommandDefault.setText(ManagedBuilderUIPlugin.getResourceString(DEF_BTN));
setButtonLayoutData(makeCommandDefault);
makeCommandDefault.setBackground(makeCommandGroup.getBackground());
makeCommandDefault.setForeground(makeCommandGroup.getForeground());
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 = new Text(makeCommandGroup, SWT.SINGLE | SWT.BORDER);
makeCommandEntry.setFont(makeCommandGroup.getFont());
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
makeCommandEntry.setText(makeCommand);
makeCommandEntry.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
makeCommandEntry.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
makeCommandEntry = null;
}
});
}
/**
*
* Answers the extension for the build artifact.
* @return
*/
protected void handleUseDefaultPressed() {
// If the state of the button is unchecked, then we want to enable the edit widget
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
public String getBuildArtifaceExtension() {
return artifactExt;
}
/**
* Answers the value in the build artifact entry widget.
*
* @return
*/
public String getBuildArtifactName() {
return buildArtifact;
return artifactName;
}
private String [] getConfigurationNames() {
@ -453,6 +558,14 @@ public class ManageConfigDialog extends Dialog {
}
}
/* (non-Javadoc)
* Event handler for the use default check box in the make command group
*/
protected void handleUseDefaultPressed() {
// If the state of the button is unchecked, then we want to enable the edit widget
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
}
private void updateButtons() {
// Disable the remove button if there is only 1 configuration
removeBtn.setEnabled(currentConfigList.getItemCount() > 1);
@ -460,6 +573,10 @@ public class ManageConfigDialog extends Dialog {
restoreBtn.setEnabled(deletedConfigList.getItemCount() > 0);
}
/**
* Answers <code>true</code> if the user has left the use default check box selected.
* @return
*/
public boolean useDefaultMakeCommand () {
return useDefaultMake;
}

View file

@ -1,7 +1,7 @@
package org.eclipse.cdt.managedbuilder.ui.wizards;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* Copyright (c) 2002,2004 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
@ -111,8 +111,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
newTarget = ManagedBuildManager.createTarget(newProject, parent);
if (newTarget != null) {
String artifactName = newProject.getName();
artifactName += parent.getDefaultExtension().length() == 0 ? "" : "." + parent.getDefaultExtension();
newTarget.setBuildArtifact(artifactName);
newTarget.setArtifactName(artifactName);
IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations();
Random r = new Random();
r.setSeed(System.currentTimeMillis());