1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36:01 +02:00

UI for Discrete custom build steps

Filter configs based upon OS list and Arch list
This commit is contained in:
Leo Treggiari 2005-05-09 23:51:39 +00:00
parent ff1dee0158
commit 509ee1af20
10 changed files with 527 additions and 65 deletions

View file

@ -29,10 +29,10 @@ import org.eclipse.core.resources.IResource;
public interface IConfiguration extends IBuildObject { public interface IConfiguration extends IBuildObject {
public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$ public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$ public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$ public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$
public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$ public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$
public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$ public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$
public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$ public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$
// Schema element names // Schema element names
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$ public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$ public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
@ -106,28 +106,28 @@ public interface IConfiguration extends IBuildObject {
public String getBuildCommand(); public String getBuildCommand();
/** /**
* Returns the prebuild step from this configuration's builder * Returns the prebuild step command
* *
* @return String * @return String
*/ */
public String getPrebuildStep(); public String getPrebuildStep();
/** /**
* Returns the postbuild step from this configuration's builder * Returns the postbuild step command
* *
* @return String * @return String
*/ */
public String getPostbuildStep(); public String getPostbuildStep();
/** /**
* Returns the display string associated with the prebuild step from this configuration's builder * Returns the display string associated with the prebuild step
* *
* @return String * @return String
*/ */
public String getPreannouncebuildStep(); public String getPreannouncebuildStep();
/** /**
* Returns the display string associated with the postbuild step from this configuration's builder * Returns the display string associated with the postbuild step
* *
* @return String * @return String
*/ */

View file

@ -271,7 +271,7 @@ public class Configuration extends BuildObject implements IConfiguration {
preannouncebuildStep = new String(cloneConfig.preannouncebuildStep); preannouncebuildStep = new String(cloneConfig.preannouncebuildStep);
} }
if (cloneConfig.postannouncebuildStep != null) { if (cloneConfig.postannouncebuildStep != null) {
postannouncebuildStep = new String( cloneConfig.postannouncebuildStep); postannouncebuildStep = new String(cloneConfig.postannouncebuildStep);
} }
// Clone the configuration's children // Clone the configuration's children
@ -1140,9 +1140,9 @@ public class Configuration extends BuildObject implements IConfiguration {
public void setPrebuildStep(String step) { public void setPrebuildStep(String step) {
if (step == null && prebuildStep == null) return; if (step == null && prebuildStep == null) return;
if (prebuildStep == null || step == null || !prebuildStep.equals(step)) { if (prebuildStep == null || step == null || !prebuildStep.equals(step)) {
prebuildStep = step; prebuildStep = step;
setRebuildState(true); setRebuildState(true);
isDirty = true; isDirty = true;
} }
} }
@ -1153,9 +1153,9 @@ public class Configuration extends BuildObject implements IConfiguration {
public void setPostbuildStep(String step) { public void setPostbuildStep(String step) {
if (step == null && postbuildStep == null) return; if (step == null && postbuildStep == null) return;
if (postbuildStep == null || step == null || !postbuildStep.equals(step)) { if (postbuildStep == null || step == null || !postbuildStep.equals(step)) {
postbuildStep = step; postbuildStep = step;
setRebuildState(true); setRebuildState(true);
isDirty = true; isDirty = true;
} }
} }
@ -1165,9 +1165,9 @@ public class Configuration extends BuildObject implements IConfiguration {
public void setPreannouncebuildStep(String announceStep) { public void setPreannouncebuildStep(String announceStep) {
if (announceStep == null && preannouncebuildStep == null) return; if (announceStep == null && preannouncebuildStep == null) return;
if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) { if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) {
preannouncebuildStep = announceStep; preannouncebuildStep = announceStep;
setRebuildState(true); setRebuildState(true);
isDirty = true; isDirty = true;
} }
} }
@ -1177,9 +1177,9 @@ public class Configuration extends BuildObject implements IConfiguration {
public void setPostannouncebuildStep(String announceStep) { public void setPostannouncebuildStep(String announceStep) {
if (announceStep == null && postannouncebuildStep == null) return; if (announceStep == null && postannouncebuildStep == null) return;
if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) { if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) {
postannouncebuildStep = announceStep; postannouncebuildStep = announceStep;
setRebuildState(true); setRebuildState(true);
isDirty = true; isDirty = true;
} }
} }

View file

@ -655,10 +655,8 @@ public class GeneratedMakefileBuilder extends ACBuilder {
boolean quit = false; boolean quit = false;
premakeArgs.add("-q"); //$NON-NLS-1$ premakeArgs.add("-q"); //$NON-NLS-1$
premakeArgs.add("main-build"); //$NON-NLS-1$ premakeArgs.add("main-build"); //$NON-NLS-1$
premakeTargets = (String[]) premakeArgs premakeTargets = (String[]) premakeArgs.toArray(new String[premakeArgs.size()]);
.toArray(new String[premakeArgs.size()]); proc = launcher.execute(makeCommand, premakeTargets, env, workingDirectory);
proc = launcher.execute(makeCommand, premakeTargets,
env, workingDirectory);
if (proc != null) { if (proc != null) {
try { try {
// Close the input of the process since we will never write to it // Close the input of the process since we will never write to it
@ -674,8 +672,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
errMsg = launcher.getErrorMessage(); errMsg = launcher.getErrorMessage();
} }
if ((errMsg != null && errMsg.length() > 0) if ((errMsg != null && errMsg.length() > 0) || proc == null) {
|| proc == null) {
// Can't tell if the build is needed, so assume it is, and let any errors be triggered // Can't tell if the build is needed, so assume it is, and let any errors be triggered
// when the "real" build is invoked below // when the "real" build is invoked below
makeArgs.add("pre-build"); //$NON-NLS-1$ makeArgs.add("pre-build"); //$NON-NLS-1$
@ -687,14 +684,13 @@ public class GeneratedMakefileBuilder extends ACBuilder {
isuptodate = true; isuptodate = true;
// Report that the build was up to date, and thus nothing needs to be built // Report that the build was up to date, and thus nothing needs to be built
String uptodateMsg = ManagedMakeMessages String uptodateMsg = ManagedMakeMessages
.getFormattedString(NOTHING_BUILT, .getFormattedString(NOTHING_BUILT, currentProject.getName());
currentProject.getName()); buf = new StringBuffer();
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
buf.append(uptodateMsg); buf.append(uptodateMsg);
buf.append(System.getProperty( buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
"line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
// Write message on the console // Write message on the console
consoleOutStream.write(buf.toString() consoleOutStream.write(buf.toString().getBytes());
.getBytes());
consoleOutStream.flush(); consoleOutStream.flush();
consoleOutStream.close(); consoleOutStream.close();
stdout.close(); stdout.close();
@ -725,13 +721,12 @@ public class GeneratedMakefileBuilder extends ACBuilder {
makeArgs.addAll(Arrays.asList(getMakeTargets(buildType))); makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
} }
makeTargets = (String[]) makeArgs.toArray(new String[makeArgs makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
.size()]);
// Launch make - main invocation // Launch make - main invocation
if (!isuptodate) { if (!isuptodate) {
proc = launcher.execute(makeCommand, makeTargets, env, proc = launcher.execute(makeCommand, makeTargets, env,
workingDirectory); workingDirectory);
if (proc != null) { if (proc != null) {
try { try {
// Close the input of the process since we will never write to it // Close the input of the process since we will never write to it

View file

@ -63,6 +63,7 @@ MakefileGenerator.comment.source.list = All of the sources participating in the
MakefileGenerator.comment.build.rule = Each subdirectory must supply rules for building sources it contributes MakefileGenerator.comment.build.rule = Each subdirectory must supply rules for building sources it contributes
MakefileGenerator.comment.build.toprules = Tool invocations MakefileGenerator.comment.build.toprules = Tool invocations
MakefileGenerator.comment.build.alltarget = All Target MakefileGenerator.comment.build.alltarget = All Target
MakefileGenerator.comment.build.mainbuildtarget = Main-build Target
MakefileGenerator.comment.build.toptargets = Other Targets MakefileGenerator.comment.build.toptargets = Other Targets
MakefileGenerator.comment.module.make.includes = Include the makefiles for each source subdirectory MakefileGenerator.comment.module.make.includes = Include the makefiles for each source subdirectory
MakefileGenerator.comment.module.dep.includes = Include automatically-generated dependency list: MakefileGenerator.comment.module.dep.includes = Include automatically-generated dependency list:

View file

@ -232,6 +232,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$ private static final String MOD_RULES = COMMENT + ".build.rule"; //$NON-NLS-1$
private static final String BUILD_TOP = COMMENT + ".build.toprules"; //$NON-NLS-1$ private static final String BUILD_TOP = COMMENT + ".build.toprules"; //$NON-NLS-1$
private static final String ALL_TARGET = COMMENT + ".build.alltarget"; //$NON-NLS-1$ private static final String ALL_TARGET = COMMENT + ".build.alltarget"; //$NON-NLS-1$
private static final String MAINBUILD_TARGET = COMMENT + ".build.mainbuildtarget"; //$NON-NLS-1$
private static final String BUILD_TARGETS = COMMENT + ".build.toptargets"; //$NON-NLS-1$ private static final String BUILD_TARGETS = COMMENT + ".build.toptargets"; //$NON-NLS-1$
private static final String SRC_LISTS = COMMENT + ".source.list"; //$NON-NLS-1$ private static final String SRC_LISTS = COMMENT + ".source.list"; //$NON-NLS-1$
@ -1119,6 +1120,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String defaultTarget = "all:"; //$NON-NLS-1$ String defaultTarget = "all:"; //$NON-NLS-1$
if (prebuildStep.length() > 0) { if (prebuildStep.length() > 0) {
// Add the comment for the "All" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE);
buffer.append(defaultTarget + WHITESPACE); buffer.append(defaultTarget + WHITESPACE);
buffer.append(PREBUILD + WHITESPACE); buffer.append(PREBUILD + WHITESPACE);
@ -1130,13 +1134,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// needed below // needed below
defaultTarget = defaultTarget.concat(COLON); defaultTarget = defaultTarget.concat(COLON);
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE + NEWLINE);
// Add the comment for the "main-build" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MAINBUILD_TARGET) + NEWLINE);
} }
else
// Add the comment for the "All" target
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE);
// Write out the all target first in case someone just runs make // Write out the all target first in case someone just runs make
// all: <target_name> or mainbuild: <target_name> // all: <target_name> or mainbuild: <target_name>
// Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(ALL_TARGET) + NEWLINE);
String outputPrefix = EMPTY_STRING; String outputPrefix = EMPTY_STRING;
if (targetTool != null) { if (targetTool != null) {
@ -1279,20 +1286,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Get the target tool and generate the rule // Get the target tool and generate the rule
if (targetTool != null) { if (targetTool != null) {
if (addRuleForTool(targetTool, buffer, true, buildTargetName, buildTargetExt, if (addRuleForTool(targetTool, buffer, true, buildTargetName, buildTargetExt,
outputVarsAdditionsList, managedProjectOutputs)) { outputVarsAdditionsList, managedProjectOutputs, postbuildStep)) {
// Mark the target tool as processed // Mark the target tool as processed
for (int i=0; i<buildTools.length; i++) { for (int i=0; i<buildTools.length; i++) {
if (targetTool == buildTools[i]) { if (targetTool == buildTools[i]) {
buildToolsUsed[i] = true; buildToolsUsed[i] = true;
} }
} }
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
// the makefile originally
if (postbuildStep) {
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE);
}
} }
} else { } else {
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_NO_TARGET_TOOL + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_NO_TARGET_TOOL + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
@ -1306,7 +1306,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
IInputType type = tool.getPrimaryInputType(); IInputType type = tool.getPrimaryInputType();
if (type != null && type.getMultipleOfType()) { if (type != null && type.getMultipleOfType()) {
if (!buildToolsUsed[i]) { if (!buildToolsUsed[i]) {
addRuleForTool(tool, buffer, false, null, null, outputVarsAdditionsList, null); addRuleForTool(tool, buffer, false, null, null, outputVarsAdditionsList, null, false);
// Mark the target tool as processed // Mark the target tool as processed
buildToolsUsed[i] = true; buildToolsUsed[i] = true;
// Look for tools that consume the output // Look for tools that consume the output
@ -1352,9 +1352,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
* @param targetName If this is the "targetTool", the target file extension, else <code>null</code> * @param targetName If this is the "targetTool", the target file extension, else <code>null</code>
* @param outputVarsAdditionsList list to add needed build output variables to * @param outputVarsAdditionsList list to add needed build output variables to
* @param managedProjectOutputs Other projects in the workspace that this project depends upon * @param managedProjectOutputs Other projects in the workspace that this project depends upon
* @param bPostBuildStep Emit post-build step invocation
*/ */
protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName, String targetExt, protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName, String targetExt,
List outputVarsAdditionsList, Vector managedProjectOutputs) { List outputVarsAdditionsList, Vector managedProjectOutputs, boolean bEmitPostBuildStepCall) {
// Get the tool's inputs and outputs // Get the tool's inputs and outputs
Vector inputs = new Vector(); Vector inputs = new Vector();
@ -1454,7 +1455,18 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} else { } else {
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
} }
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE); buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE);
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
// the makefile originally
if (bEmitPostBuildStepCall) {
buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE);
}
else {
// Just emit a blank line
buffer.append(NEWLINE);
}
// If we have secondary outputs, output dependency rules without commands // If we have secondary outputs, output dependency rules without commands
if (enumeratedSecondaryOutputs.size() > 0) { if (enumeratedSecondaryOutputs.size() > 0) {
@ -1465,7 +1477,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
} }
return true; return true;
} }
@ -1491,7 +1502,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
(outVariable != null && inVariable != null && (outVariable != null && inVariable != null &&
outVariable.equals(inVariable))) { outVariable.equals(inVariable))) {
if (addRuleForTool(buildTools[k], buffer, false, null, null, if (addRuleForTool(buildTools[k], buffer, false, null, null,
outputVarsAdditionsList, null)) { outputVarsAdditionsList, null, false)) {
buildToolsUsed[k] = true; buildToolsUsed[k] = true;
// Look for tools that consume the output // Look for tools that consume the output
generateRulesForConsumers(buildTools[k], outputVarsAdditionsList, buffer); generateRulesForConsumers(buildTools[k], outputVarsAdditionsList, buffer);

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.AccessibleAdapter;
@ -30,6 +31,7 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.DisposeListener;
@ -250,6 +252,16 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults() * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
*/ */
public void performDefaults() { public void performDefaults() {
// Display a "Confirm" dialog box, since:
// 1. The defaults are immediately applied
// 2. The action cannot be undone
Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
boolean shouldDefault = MessageDialog.openConfirm(shell,
ManagedBuilderUIMessages.getResourceString("BuildSettingsBlock.defaults.title"), //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString("BuildSettingsBlock.defaults.message")); //$NON-NLS-1$
if (!shouldDefault) return;
IConfiguration config = parent.getSelectedConfiguration(); IConfiguration config = parent.getSelectedConfiguration();
config.setArtifactName(config.getManagedProject().getDefaultArtifactName()); config.setArtifactName(config.getManagedProject().getDefaultArtifactName());
config.setArtifactExtension(null); config.setArtifactExtension(null);
@ -257,9 +269,15 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
if (!builder.isExtensionElement()) { if (!builder.isExtensionElement()) {
config.getToolChain().removeLocalBuilder(); config.getToolChain().removeLocalBuilder();
} }
// Save the information that was reset
ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
setValues(); setValues();
makeCommandDefault.setSelection(true); makeCommandDefault.setSelection(true);
makeCommandEntry.setEditable(false); makeCommandEntry.setEditable(false);
setDirty(false); setDirty(false);
} }

View file

@ -0,0 +1,337 @@
/*******************************************************************************
* Copyright (c) 2005 Intel 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
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.ui;
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
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.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class BuildStepSettingsBlock extends AbstractCOptionPage {
/*
* String constants
*/
private static final String PREFIX = "BuildStepSettingsBlock"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
private static final String PREBUILD_GROUP = LABEL + ".prebuildstep.group"; //$NON-NLS-1$
private static final String PREBUILD_CMD = LABEL + ".prebuildstep.cmd"; //$NON-NLS-1$
private static final String PREBUILD_DESC = LABEL + ".prebuildstep.desc"; //$NON-NLS-1$
private static final String POSTBUILD_GROUP = LABEL + ".postbuildstep.group"; //$NON-NLS-1$
private static final String POSTBUILD_CMD = LABEL + ".postbuildstep.cmd"; //$NON-NLS-1$
private static final String POSTBUILD_DESC = LABEL + ".postbuildstep.desc"; //$NON-NLS-1$
private static final String EMPTY_STRING = new String();
/*
* Dialog widgets
*/
protected Text preBuildCmd;
protected Text preBuildAnnc;
protected Text postBuildCmd;
protected Text postBuildAnnc;
/*
* Bookeeping variables
*/
private BuildPropertyPage parent;
private String preBuildCommand;
private String preBuildAnnounce;
private String postBuildCommand;
private String postBuildAnnounce;
// Has the page been changed?
private boolean dirty = false;
private ModifyListener widgetModified = new ModifyListener() {
public void modifyText(ModifyEvent e) {
setDirty(true);
}
};
/*
* Constructor
*/
public BuildStepSettingsBlock(BuildPropertyPage parent)
{
super(ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL));
super.setContainer(parent);
this.parent = parent;
}
public void createControl(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));
setControl(comp);
// Create a group for the prebuild step
createPreBuildStepGroup(comp);
// Create a group for the postbuild step
createPostBuildStepGroup(comp);
}
/* (non-Javadoc)
* Creates the group that contains the pre-build step controls.
*/
private void createPreBuildStepGroup(Composite parent) {
final Group preBuildStepGroup = new Group(parent, SWT.NONE);
preBuildStepGroup.setFont(parent.getFont());
preBuildStepGroup.setText(ManagedBuilderUIMessages.getResourceString(PREBUILD_GROUP));
preBuildStepGroup.setLayout(new GridLayout(1, true));
preBuildStepGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Pre-build command label
final Label cmdLabel = new Label(preBuildStepGroup, SWT.LEFT);
cmdLabel.setFont(preBuildStepGroup.getFont());
cmdLabel.setText(ManagedBuilderUIMessages.getResourceString(PREBUILD_CMD));
cmdLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Text widget for pre-build command
preBuildCmd = new Text(preBuildStepGroup, SWT.SINGLE | SWT.BORDER);
preBuildCmd.setFont(preBuildStepGroup.getFont());
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
preBuildCmd.setLayoutData(data);
preBuildCmd.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
preBuildCmd = null;
}
});
preBuildCmd.getAccessible().addAccessibleListener(new AccessibleAdapter(){
public void getName(AccessibleEvent e) {
e.result = ManagedBuilderUIMessages.getResourceString(PREBUILD_CMD);
}
});
preBuildCmd.addModifyListener(widgetModified);
final Label descLabel = new Label(preBuildStepGroup, SWT.LEFT);
descLabel.setFont(preBuildStepGroup.getFont());
descLabel.setText(ManagedBuilderUIMessages.getResourceString(PREBUILD_DESC));
descLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Text widget for the pre-build description
preBuildAnnc = new Text(preBuildStepGroup, SWT.SINGLE | SWT.BORDER);
preBuildAnnc.setFont(preBuildStepGroup.getFont());
data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = (IDialogConstants.ENTRY_FIELD_WIDTH);
preBuildAnnc.setLayoutData(data);
preBuildAnnc.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
preBuildAnnc = null;
}
});
preBuildAnnc.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = ManagedBuilderUIMessages.getResourceString(PREBUILD_DESC);
}
});
preBuildAnnc.addModifyListener(widgetModified);
}
/* (non-Javadoc)
* Creates the group that contains the post-build step controls.
*/
private void createPostBuildStepGroup(Composite parent) {
final Group postBuildStepGroup = new Group(parent, SWT.NONE);
postBuildStepGroup.setFont(parent.getFont());
postBuildStepGroup.setText(ManagedBuilderUIMessages.getResourceString(POSTBUILD_GROUP));
postBuildStepGroup.setLayout(new GridLayout(1, true));
postBuildStepGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Post-build command label
final Label cmdLabel = new Label(postBuildStepGroup, SWT.LEFT);
cmdLabel.setFont(postBuildStepGroup.getFont());
cmdLabel.setText(ManagedBuilderUIMessages.getResourceString(POSTBUILD_CMD));
cmdLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Text widget for the post-build command
postBuildCmd = new Text(postBuildStepGroup, SWT.SINGLE | SWT.BORDER);
postBuildCmd.setFont(postBuildStepGroup.getFont());
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
postBuildCmd.setLayoutData(data);
postBuildCmd.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
postBuildCmd = null;
}
});
postBuildCmd.getAccessible().addAccessibleListener(new AccessibleAdapter(){
public void getName(AccessibleEvent e) {
e.result = ManagedBuilderUIMessages.getResourceString(POSTBUILD_CMD);
}
});
postBuildCmd.addModifyListener(widgetModified);
// Post-build description label
final Label descLabel = new Label(postBuildStepGroup, SWT.LEFT);
descLabel.setFont(postBuildStepGroup.getFont());
descLabel.setText(ManagedBuilderUIMessages.getResourceString(POSTBUILD_DESC));
descLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Text widget for the post-build description
postBuildAnnc = new Text(postBuildStepGroup, SWT.SINGLE | SWT.BORDER);
postBuildAnnc.setFont(postBuildStepGroup.getFont());
data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = (IDialogConstants.ENTRY_FIELD_WIDTH);
postBuildAnnc.setLayoutData(data);
postBuildAnnc.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
postBuildAnnc = null;
}
});
postBuildAnnc.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = ManagedBuilderUIMessages.getResourceString(POSTBUILD_DESC);
}
});
postBuildAnnc.addModifyListener(widgetModified);
}
protected void initializeValues() {
setValues();
}
public void updateValues() {
setValues();
}
protected void setValues() {
// Fetch values from the current configuration and set in the UI
preBuildCommand = parent.getSelectedConfiguration().getPrebuildStep();
preBuildCmd.setText(preBuildCommand);
preBuildAnnounce = parent.getSelectedConfiguration().getPreannouncebuildStep();
preBuildAnnc.setText(preBuildAnnounce);
postBuildCommand = parent.getSelectedConfiguration().getPostbuildStep();
postBuildCmd.setText(postBuildCommand);
postBuildAnnounce = parent.getSelectedConfiguration().getPostannouncebuildStep();
postBuildAnnc.setText(postBuildAnnounce);
setDirty(false); //Indicate that the UI state is consistent with internal state
}
public void removeValues(String id) {
// Nothing to do...
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
*/
public void performDefaults() {
IConfiguration config = parent.getSelectedConfiguration();
boolean mustSetValue = false;
// Display a "Confirm" dialog box, since:
// 1. The defaults are immediately applied
// 2. The action cannot be undone
Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
boolean shouldDefault = MessageDialog.openConfirm(shell,
ManagedBuilderUIMessages.getResourceString("BuildStepsSettingsBlock.defaults.title"), //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString("BuildStepsSettingsBlock.defaults.message")); //$NON-NLS-1$
if (!shouldDefault) return;
// Set the build step entries to null; this will force the next fetch of the entries to get the
// values from the parent of this configuration, which should be the values from the .xml manifest
// file
config.setPrebuildStep(null);
config.setPreannouncebuildStep(null);
config.setPostbuildStep(null);
config.setPostannouncebuildStep(null);
// Save the information that was reset
ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
// Fetch and set the default values to be displayed in the UI
setValues();
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
*/
public void performApply(IProgressMonitor monitor) throws CoreException {
// Fetch the build step values from the UI and store
preBuildCommand = preBuildCmd.getText().trim();
preBuildAnnounce = preBuildAnnc.getText().trim();
postBuildCommand = postBuildCmd.getText().trim();
postBuildAnnounce = postBuildAnnc.getText().trim();
IConfiguration selectedConfiguration = parent.getSelectedConfiguration();
boolean mustSetValue = false;
if (!selectedConfiguration.getPrebuildStep().equals(preBuildCommand)) {
mustSetValue = true;
}
else if (!selectedConfiguration.getPreannouncebuildStep().equals(preBuildAnnounce)) {
mustSetValue = true;
}
else if (!selectedConfiguration.getPostbuildStep().equals(postBuildCommand)) {
mustSetValue = true;
}
else if (!selectedConfiguration.getPostannouncebuildStep().equals(postBuildAnnounce)) {
mustSetValue = true;
}
if (mustSetValue) {
// Set all the build step values in the current configuration
selectedConfiguration.setPrebuildStep(preBuildCommand);
selectedConfiguration.setPreannouncebuildStep(preBuildAnnounce);
selectedConfiguration.setPostbuildStep(postBuildCommand);
selectedConfiguration.setPostannouncebuildStep(postBuildAnnounce);
}
setDirty(false); //Indicate that the UI state is consistent with internal state
}
public IPreferenceStore getPreferenceStore() {
return null;
}
/**
* Sets the "dirty" state, which indicates whether or not the state of the build step UI is consistent
* with its corresponding internal state
*/
public void setDirty(boolean b) {
dirty = b;
}
/**
* Returns the "dirty" state, which indicates whether or not the state of the build step UI is consistent
* with its corresponding internal state
*/
public boolean isDirty() {
return dirty;
}
}

View file

@ -32,6 +32,7 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
private ToolsSettingsBlock toolsSettingsBlock; private ToolsSettingsBlock toolsSettingsBlock;
private BuildSettingsBlock buildSettingsBlock; private BuildSettingsBlock buildSettingsBlock;
private BuildStepSettingsBlock buildStepSettingsBlock;
private ErrorParserBlock errParserBlock; private ErrorParserBlock errParserBlock;
private BinaryParserBlock binaryParserBlock; private BinaryParserBlock binaryParserBlock;
private EnvironmentSetBlock environmentBlock; private EnvironmentSetBlock environmentBlock;
@ -72,6 +73,7 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (element instanceof IProject) { if (element instanceof IProject) {
addTab(toolsSettingsBlock = new ToolsSettingsBlock((BuildPropertyPage) fParent, element)); addTab(toolsSettingsBlock = new ToolsSettingsBlock((BuildPropertyPage) fParent, element));
addTab(buildSettingsBlock = new BuildSettingsBlock((BuildPropertyPage) fParent)); addTab(buildSettingsBlock = new BuildSettingsBlock((BuildPropertyPage) fParent));
addTab(buildStepSettingsBlock = new BuildStepSettingsBlock((BuildPropertyPage) fParent));
addTab(errParserBlock = new ErrorParserBlock()); addTab(errParserBlock = new ErrorParserBlock());
addTab(binaryParserBlock = new BinaryParserBlock()); addTab(binaryParserBlock = new BinaryParserBlock());
addTab(environmentBlock = new EnvironmentSetBlock((BuildPropertyPage) fParent)); addTab(environmentBlock = new EnvironmentSetBlock((BuildPropertyPage) fParent));
@ -89,6 +91,10 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
public BuildSettingsBlock getBuildSettingsBlock() { public BuildSettingsBlock getBuildSettingsBlock() {
return buildSettingsBlock; return buildSettingsBlock;
} }
public BuildStepSettingsBlock getBuildStepSettingsBlock() {
return buildStepSettingsBlock;
}
public BinaryParserBlock getBinaryParserBlock() { public BinaryParserBlock getBinaryParserBlock() {
return binaryParserBlock; return binaryParserBlock;
@ -125,6 +131,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (getBuildSettingsBlock()!= null) { if (getBuildSettingsBlock()!= null) {
getBuildSettingsBlock().initializeValues(); getBuildSettingsBlock().initializeValues();
} }
if (getBuildStepSettingsBlock()!= null) {
getBuildStepSettingsBlock().initializeValues();
}
if (getErrorParserBlock()!= null) { if (getErrorParserBlock()!= null) {
// TODO // TODO
//getErrorParserBlock().initializeValues(); //getErrorParserBlock().initializeValues();
@ -145,6 +154,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (getBuildSettingsBlock() != null) { if (getBuildSettingsBlock() != null) {
getBuildSettingsBlock().updateValues(); getBuildSettingsBlock().updateValues();
} }
if (getBuildStepSettingsBlock() != null) {
getBuildStepSettingsBlock().updateValues();
}
if (getErrorParserBlock() != null) { if (getErrorParserBlock() != null) {
getErrorParserBlock().updateValues(); getErrorParserBlock().updateValues();
} }
@ -174,6 +186,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (getBuildSettingsBlock() != null) { if (getBuildSettingsBlock() != null) {
getBuildSettingsBlock().setValues(); getBuildSettingsBlock().setValues();
} }
if (getBuildStepSettingsBlock() != null) {
getBuildStepSettingsBlock().setValues();
}
if (getErrorParserBlock() != null) { if (getErrorParserBlock() != null) {
// TODO // TODO
//getErrorParserBlock().setValues(); //getErrorParserBlock().setValues();
@ -204,6 +219,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (getBuildSettingsBlock() != null) { if (getBuildSettingsBlock() != null) {
getBuildSettingsBlock().removeValues(id); getBuildSettingsBlock().removeValues(id);
} }
if (getBuildStepSettingsBlock() != null) {
getBuildStepSettingsBlock().removeValues(id);
}
if (getErrorParserBlock() != null) { if (getErrorParserBlock() != null) {
// TODO // TODO
//getErrorParserBlock().removeValues(id); //getErrorParserBlock().removeValues(id);
@ -233,6 +251,9 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (getCurrentPage() instanceof BuildSettingsBlock) { if (getCurrentPage() instanceof BuildSettingsBlock) {
return buildSettingsBlock.getPreferenceStore(); return buildSettingsBlock.getPreferenceStore();
} }
if (getCurrentPage() instanceof BuildStepSettingsBlock) {
return buildStepSettingsBlock.getPreferenceStore();
}
if (getCurrentPage() instanceof ErrorParserBlock) { if (getCurrentPage() instanceof ErrorParserBlock) {
return errParserBlock.getPreferenceStore(); return errParserBlock.getPreferenceStore();
} }
@ -292,6 +313,8 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
((BuildSettingsBlock)tab).setDirty(b); ((BuildSettingsBlock)tab).setDirty(b);
} else if (tab instanceof ToolsSettingsBlock) { } else if (tab instanceof ToolsSettingsBlock) {
((ToolsSettingsBlock)tab).setDirty(b); ((ToolsSettingsBlock)tab).setDirty(b);
} else if (tab instanceof BuildStepSettingsBlock) {
((BuildStepSettingsBlock)tab).setDirty(b);
} else if (tab instanceof ErrorParserBlock) { } else if (tab instanceof ErrorParserBlock) {
((ErrorParserBlock)tab).setDirty(b); ((ErrorParserBlock)tab).setDirty(b);
} else if (tab instanceof BinaryParserBlock) { } else if (tab instanceof BinaryParserBlock) {
@ -314,6 +337,8 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
if (((BuildSettingsBlock)tab).isDirty()) return true; if (((BuildSettingsBlock)tab).isDirty()) return true;
} else if (tab instanceof ToolsSettingsBlock) { } else if (tab instanceof ToolsSettingsBlock) {
if (((ToolsSettingsBlock)tab).isDirty()) return true; if (((ToolsSettingsBlock)tab).isDirty()) return true;
} else if (tab instanceof BuildStepSettingsBlock) {
if (((BuildStepSettingsBlock)tab).isDirty()) return true;
} else if (tab instanceof ErrorParserBlock) { } else if (tab instanceof ErrorParserBlock) {
if (((ErrorParserBlock)tab).isDirty()) return true; if (((ErrorParserBlock)tab).isDirty()) return true;
} else if (tab instanceof BinaryParserBlock) { } else if (tab instanceof BinaryParserBlock) {

View file

@ -32,6 +32,7 @@ MngCCWizardSettings.description=Define the Managed Make C++ build settings.
MngMakeProjectWizard.config.title=Select a type of project MngMakeProjectWizard.config.title=Select a type of project
MngMakeProjectWizard.config.desc=Select the platform and configurations you wish to deploy on MngMakeProjectWizard.config.desc=Select the platform and configurations you wish to deploy on
PlatformBlock.tip.platform=Select the type of project for the build goal PlatformBlock.tip.platform=Select the type of project for the build goal
PlatformBlock.tip.forcedconfigs=There are no buildable configurations on this platform for this project type.\n By default, all configurations selected.
PlatformBlock.label.platform=Project Type: PlatformBlock.label.platform=Project Type:
PlatformBlock.label.configs=Configurations: PlatformBlock.label.configs=Configurations:
PlatformBlock.label.showall=Show All Project Types PlatformBlock.label.showall=Show All Project Types
@ -86,6 +87,19 @@ BuildSettingsBlock.label.makecmddef=Use default command
BuildSettingsBlock.label.output.group=Build output BuildSettingsBlock.label.output.group=Build output
BuildSettingsBlock.label.output.name=Artifact name: BuildSettingsBlock.label.output.name=Artifact name:
BuildSettingsBlock.label.output.extension=Artifact extension: BuildSettingsBlock.label.output.extension=Artifact extension:
BuildSettingsBlock.defaults.title=Reset Build Settings
BuildSettingsBlock.defaults.message=This action will reset the build settings to their default settings.\n\nDo you want to proceed?
# ----------- Build Steps Block -----------
BuildStepSettingsBlock.label.Settings=Build Steps
BuildStepSettingsBlock.label.prebuildstep.group=Pre-build step:
BuildStepSettingsBlock.label.prebuildstep.cmd=Command:
BuildStepSettingsBlock.label.prebuildstep.desc=Description:
BuildStepSettingsBlock.label.postbuildstep.group=Post-build step:
BuildStepSettingsBlock.label.postbuildstep.cmd=Command:
BuildStepSettingsBlock.label.postbuildstep.desc=Description:
BuildStepsSettingsBlock.defaults.title=Reset Build Steps
BuildStepsSettingsBlock.defaults.message=This action will reset the pre-build and post-build steps to their default settings.\n\nDo you want to proceed?
# ----------- Environment Set Block ----------- # ----------- Environment Set Block -----------
EnvironmentSetBlock.label.environment=Environment EnvironmentSetBlock.label.environment=Environment

View file

@ -62,6 +62,8 @@ public class CProjectPlatformPage extends WizardPage {
private static final String SHOWALL_CONFIG_LABEL = LABEL + ".showall.config"; //$NON-NLS-1$ private static final String SHOWALL_CONFIG_LABEL = LABEL + ".showall.config"; //$NON-NLS-1$
private static final String TARGET_LABEL = LABEL + ".platform"; //$NON-NLS-1$ private static final String TARGET_LABEL = LABEL + ".platform"; //$NON-NLS-1$
private static final String TARGET_TIP = TIP + ".platform"; //$NON-NLS-1$ private static final String TARGET_TIP = TIP + ".platform"; //$NON-NLS-1$
private static final String FORCEDCONFIG_TIP = TIP + ".forcedconfigs"; //$NON-NLS-1$
protected NewManagedProjectWizard parentWizard; protected NewManagedProjectWizard parentWizard;
protected Combo platformSelection; protected Combo platformSelection;
@ -69,6 +71,7 @@ public class CProjectPlatformPage extends WizardPage {
protected IProjectType selectedProjectType; protected IProjectType selectedProjectType;
protected Button showAllProjTypes; protected Button showAllProjTypes;
protected Button showAllConfigs; protected Button showAllConfigs;
protected boolean showAllConfigsForced;
protected CheckboxTableViewer tableViewer; protected CheckboxTableViewer tableViewer;
protected String[] projectTypeNames; protected String[] projectTypeNames;
protected ArrayList projectTypes; protected ArrayList projectTypes;
@ -85,6 +88,7 @@ public class CProjectPlatformPage extends WizardPage {
selectedProjectType = null; selectedProjectType = null;
selectedConfigurations = new ArrayList(0); selectedConfigurations = new ArrayList(0);
this.parentWizard = parentWizard; this.parentWizard = parentWizard;
showAllConfigsForced = false;
} }
/** /**
@ -187,7 +191,7 @@ public class CProjectPlatformPage extends WizardPage {
showAllConfigs.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_CONFIG_LABEL)); showAllConfigs.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_CONFIG_LABEL));
showAllConfigs.addListener(SWT.Selection, new Listener() { showAllConfigs.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) { public void handleEvent(Event e) {
populateConfigurations(); populateConfigurations(true);
} }
}); });
showAllConfigs.addDisposeListener(new DisposeListener() { showAllConfigs.addDisposeListener(new DisposeListener() {
@ -279,30 +283,73 @@ public class CProjectPlatformPage extends WizardPage {
parentWizard.updateProjectTypeProperties(); parentWizard.updateProjectTypeProperties();
} }
} }
populateConfigurations(); populateConfigurations(false);
setPageComplete(validatePage()); setPageComplete(validatePage());
} }
/** /**
* Populate the table viewer with either all known configurations * Populate the table viewer with either all known configurations
* or only with the supported configurations depending on whether a user * or only with the supported configurations depending on whether a user
* has chosen to diaplay unsupported configurations or not * has chosen to display unsupported configurations or not
* By default, only supported configurations are selected. * By default, only supported configurations are selected.
*/ */
private void populateConfigurations() { private void populateConfigurations(boolean showallconfigsevent) {
if(selectedProjectType == null) if (selectedProjectType == null)
return; return;
boolean showAll = showAllConfigs != null ? showAllConfigs.getSelection() : false; boolean showAll = showAllConfigs != null ? showAllConfigs.getSelection() : false;
IConfiguration selected[] = null; IConfiguration selected[] = null;
if(showAll){ if (showAll) {
configurations = selectedProjectType.getConfigurations(); configurations = selectedProjectType.getConfigurations();
selected = filterSupportedConfigurations(configurations); selected = filterSupportedConfigurations(configurations);
} }
else{ else {
configurations = filterSupportedConfigurations(selectedProjectType.getConfigurations()); configurations = filterSupportedConfigurations(selectedProjectType.getConfigurations());
selected = configurations; selected = configurations;
} }
// Check for buildable configs on this platform
if (selected.length == 0) {
// No buildable configs on this platform
if (showallconfigsevent) {
// "Show All Configurations" button pressed by user
if (showAll) {
// "Show All Configurations" check box "checked" by user
// For a project with no buildable configs, all available
// configs should be displayed and checked
configurations = selectedProjectType.getConfigurations();
selected = configurations;
}
if (showAllConfigsForced) {
// The previous setting of this check box was done automatically when a project type
// with no buildable configs was encountered; undo this state now and honor the
// user's button click
setMessage(null, NONE);
showAllConfigsForced = false;
}
}
else {
configurations = selectedProjectType.getConfigurations();
selected = configurations;
if (!showAll) {
showAllConfigsForced = true;
showAllConfigs.setSelection(true);
}
}
// Indicate that there are no buildable configurations on this platform for this project
// type and that all configurations will be selected
setMessage(ManagedBuilderUIMessages.getResourceString(FORCEDCONFIG_TIP), WARNING);
}
else {
setMessage(null, NONE);
if (showAllConfigsForced) {
showAllConfigsForced = false;
showAllConfigs.setSelection(false);
// Redo filtering in light of reset of "show all configs" to false
configurations = filterSupportedConfigurations(selectedProjectType.getConfigurations());
selected = configurations;
}
}
tableViewer.setInput(configurations); tableViewer.setInput(configurations);
tableViewer.setCheckedElements(selected); tableViewer.setCheckedElements(selected);
@ -310,14 +357,28 @@ public class CProjectPlatformPage extends WizardPage {
} }
/** /**
* Returns the array of supported configurations found in the configuurations * Returns the array of supported configurations found in the configurations
* passes to this method * passed to this method
*/ */
IConfiguration[] filterSupportedConfigurations(IConfiguration cfgs[]){ IConfiguration[] filterSupportedConfigurations(IConfiguration cfgs[]){
ArrayList supported = new ArrayList(); ArrayList supported = new ArrayList();
for(int i = 0; i < cfgs.length; i++){ String os = Platform.getOS();
if(cfgs[i].isSupported()) String arch = Platform.getOSArch();
supported.add(cfgs[i]);
for (int i = 0; i < cfgs.length; i++) {
// First, filter on supported state
if (cfgs[i].isSupported()) {
// Now, apply the OS and ARCH filters to determine if the configuration should be shown
// Determine if the configuration's tool-chain supports this OS & Architecture.
IToolChain tc = cfgs[i].getToolChain();
List osList = Arrays.asList(tc.getOSList());
if (osList.contains("all") || osList.contains(os)) { //$NON-NLS-1$
List archList = Arrays.asList(tc.getArchList());
if (archList.contains("all") || archList.contains(arch)) { //$NON-NLS-1$
supported.add(cfgs[i]);
}
}
}
} }
return (IConfiguration[])supported.toArray(new IConfiguration[supported.size()]); return (IConfiguration[])supported.toArray(new IConfiguration[supported.size()]);
} }