Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Sennikovsky2005-09-30 19:09:20 +0000
committerMikhail Sennikovsky2005-09-30 19:09:20 +0000
commitca2e8c288e0d3b7b382d3418afbe110662fcfed4 (patch)
tree08fa0bc6380a17623dda69c76a233b925cad0e76 /build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal
parentee2db04840937c2ed2e9f4ba6fc23e68fc6e5e37 (diff)
downloadorg.eclipse.cdt-ca2e8c288e0d3b7b382d3418afbe110662fcfed4.tar.gz
org.eclipse.cdt-ca2e8c288e0d3b7b382d3418afbe110662fcfed4.tar.xz
org.eclipse.cdt-ca2e8c288e0d3b7b382d3418afbe110662fcfed4.zip
1. The “temporary configuration” concept is implemented
2. Managed build property page is adopted to use the “clone” configuration. 3. When the value of any option is changed by the user in UI, the values and enabled/disabled state of all the options on the current page is updated 4. Each time the given page becomes visible, its values get updated 5. The bug# 106036 is fixed 6. The FileListControlFieldEditor is now disabled properly 7. Notification mechanism for the FileListControlFieldEditor implemented. 8. Restore defaults now works correctly for the error parsers block. 9. Restore defaults does not sets the defaults to the real configuration immediately, so if “cancel” is pressed after “restore defaults”, no changes are made to the real configuration. 10. Restore defaults for the tool settings page now restores the tool commands also 11. Build macros and environment settings are copied from the source configuration to the configuration clone when the clone constructor is invoked 12. When the resource build property page contains default values, the resource configuration is removed for the resource. 13. The build is invoked in case the build command or builder arguments are changed. The build info is persisted also in case only the build command is changed. 14. The new resource configuration id is now calculated in the way: <configuration_id> + “.” + <random_number> instead of <configuration_id> + “.” + <resource_path>. 15. the calculateChildId method is added to the managed build manager, Core and UI code is updated to use the ManagedBuildManager.calculateChildId method. Some other fixes of id calculation. 16. Some minor fixes for the managed build path entries calculation 17. Some Build Environment persistence issues were fixed 18. The managed build revision and version of the managed project and of all its children is now updated after the project conversion is performed. Configuration now obtains the version from the toolchain
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java189
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildStepSettingsBlock.java128
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentBlock.java128
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentSetBlock.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java85
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosBlock.java163
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosSetBlock.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java22
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ResourceCustomBuildStepBlock.java417
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java428
11 files changed, 973 insertions, 603 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java
index 836cd5dc1a6..e4872ef1cc5 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java
@@ -76,19 +76,38 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
* Bookeeping variables
*/
private BuildPropertyPage parent;
- // The name of the build artifact
- private String artifactExt;
- private String artifactName;
- // The make command associated with the target
- private String makeCommand;
- // State of the check box on exit
- private boolean useDefaultMake;
// Has the page been changed?
private boolean dirty = false;
private ModifyListener widgetModified = new ModifyListener() {
public void modifyText(ModifyEvent e) {
- setDirty(true);
+ IConfiguration config = parent.getSelectedConfigurationClone();
+ if(e.widget == buildArtifactName){
+ String val = buildArtifactName.getText().trim();
+ if(!val.equals(config.getArtifactName())){
+ config.setArtifactName(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == buildArtifactExt){
+ String val = buildArtifactExt.getText().trim();
+ if(!val.equals(config.getArtifactExtension())){
+ config.setArtifactExtension(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == makeCommandEntry) {
+ String fullCommand = makeCommandEntry.getText().trim();
+ String buildCommand = parseMakeCommand(fullCommand);
+ String buildArgs = parseMakeArgs(fullCommand);
+ if(!buildCommand.equals(config.getBuildCommand())
+ || !buildArgs.equals(config.getBuildArguments())){
+ parent.getSelectedConfigurationClone().setBuildCommand(buildCommand);
+ parent.getSelectedConfigurationClone().setBuildArguments(buildArgs);
+ setValues();
+ setDirty(true);
+ }
+ }
}
};
@@ -205,7 +224,6 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
makeCommandDefault.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
handleUseDefaultPressed();
- setDirty(true);
}
});
makeCommandDefault.addDisposeListener(new DisposeListener() {
@@ -243,7 +261,14 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
buildMacrosExpand.setForeground(buildMacrosExpandGroup.getForeground());
buildMacrosExpand.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
- setDirty(true);
+ BuildMacroProvider provider = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
+ IConfiguration config = BuildSettingsBlock.this.parent.getSelectedConfigurationClone();
+ if(buildMacrosExpand.getSelection() != provider.areMacrosExpandedInBuildfile(config)){
+ provider.expandMacrosInBuildfile(config,
+ buildMacrosExpand.getSelection());
+ setValues();
+ setDirty(true);
+ }
}
});
buildMacrosExpand.addDisposeListener(new DisposeListener() {
@@ -255,36 +280,39 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
protected void initializeValues() {
setValues();
+ setDirty(false);
}
public void updateValues() {
setValues();
- useDefaultMake = !parent.getSelectedConfiguration().hasOverriddenBuildCommand();
- makeCommandDefault.setSelection(useDefaultMake);
+ makeCommandDefault.setSelection(!parent.getSelectedConfigurationClone().hasOverriddenBuildCommand());
makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
}
protected void setValues() {
- artifactName = parent.getSelectedConfiguration().getArtifactName();
- buildArtifactName.setText(artifactName);
- artifactExt = parent.getSelectedConfiguration().getArtifactExtension();
- buildArtifactExt.setText(artifactExt);
- makeCommand = parent.getSelectedConfiguration().getBuildCommand();
- String makeArgs = parent.getSelectedConfiguration().getBuildArguments();
+ IConfiguration config = parent.getSelectedConfigurationClone();
+ if(!config.getArtifactName().equals(buildArtifactName.getText()))
+ buildArtifactName.setText(config.getArtifactName());
+
+ if(!config.getArtifactExtension().equals(buildArtifactExt.getText()))
+ buildArtifactExt.setText(config.getArtifactExtension());
+ String makeCommand = config.getBuildCommand();
+ String makeArgs = config.getBuildArguments();
if (makeArgs != null) {
makeCommand += " " + makeArgs; //$NON-NLS-1$
}
- makeCommandEntry.setText(makeCommand);
+ if(!makeCommand.equals(makeCommandEntry.getText()))
+ makeCommandEntry.setText(makeCommand);
BuildMacroProvider provider = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
- if(!provider.canKeepMacrosInBuildfile(this.parent.getSelectedConfiguration()))
+ if(!provider.canKeepMacrosInBuildfile(config))
buildMacrosExpandGroup.setVisible(false);
else {
buildMacrosExpandGroup.setVisible(true);
- buildMacrosExpand.setSelection(provider.areMacrosExpandedInBuildfile(parent.getSelectedConfiguration()));
+ buildMacrosExpand.setSelection(provider.areMacrosExpandedInBuildfile(config));
}
- setDirty(false);
+// setDirty(false);
}
public void removeValues(String id) {
@@ -297,36 +325,24 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
*/
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();
- config.setArtifactName(config.getManagedProject().getDefaultArtifactName());
- config.setArtifactExtension(null);
- IBuilder builder = config.getToolChain().getBuilder();
- if (!builder.isExtensionElement()) {
- config.getToolChain().removeLocalBuilder();
+ IConfiguration cloneConfig = parent.getSelectedConfigurationClone();
+ cloneConfig.setArtifactName(cloneConfig.getManagedProject().getDefaultArtifactName());
+ cloneConfig.setArtifactExtension(null);
+ IBuilder cloneBuilder = cloneConfig.getToolChain().getBuilder();
+ if (!cloneBuilder.isExtensionElement()) {
+ cloneConfig.getToolChain().removeLocalBuilder();
}
-
- // Save the information that was reset
- ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
+
//set the expand macros state to false
BuildMacroProvider provider = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
- provider.expandMacrosInBuildfile(config,false);
+ provider.expandMacrosInBuildfile(cloneConfig,false);
setValues();
makeCommandDefault.setSelection(true);
makeCommandEntry.setEditable(false);
- setDirty(false);
+ setDirty(true);
}
/*
@@ -334,74 +350,33 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
*/
public void performApply(IProgressMonitor monitor) throws CoreException {
- useDefaultMake = makeCommandDefault.getSelection();
- makeCommand = makeCommandEntry.getText().trim();
- artifactName = buildArtifactName.getText().trim();
- artifactExt = buildArtifactExt.getText().trim();
-
IConfiguration selectedConfiguration = parent.getSelectedConfiguration();
- IBuilder builder = selectedConfiguration.getToolChain().getBuilder();
- boolean setBuilderValues = false;
-
+ IConfiguration cloneConfig = parent.getSelectedConfigurationClone();
+
+ String buildCommand = cloneConfig.getBuildCommand();
+ String buildArgs = cloneConfig.getBuildArguments();
+ String artifactName = cloneConfig.getArtifactName();
+ String artifactExt = cloneConfig.getArtifactExtension();
+
// Set the build output name
if (!selectedConfiguration.getArtifactName().equals(artifactName)) {
- setBuilderValues = true;
+ selectedConfiguration.setArtifactName(artifactName);
}
// Set the build output extension
if (!selectedConfiguration.getArtifactExtension().equals(artifactExt)) {
- setBuilderValues = true;
- }
- // Set the new make command
- String makeCommandOnly = null;
- String makeArguments = null;
- if (useDefaultMake) {
- if (!builder.isExtensionElement()) {
- setBuilderValues = true;
- }
- } else {
- // Parse for command and arguments
- String rawCommand = makeCommand;
- makeCommandOnly = parseMakeCommand(rawCommand);
- if (!selectedConfiguration.getBuildCommand().equals(makeCommandOnly)) {
- setBuilderValues = true;
- }
- makeArguments = parseMakeArgs(rawCommand);
- if (!selectedConfiguration.getBuildArguments().equals(makeArguments)) {
- setBuilderValues = true;
- }
- }
-
- if (setBuilderValues) {
- // If the configuration does not already have a "local" builder, we
- // need to create it.
- if (builder.isExtensionElement()) {
- IToolChain tc = selectedConfiguration.getToolChain();
- int nnn = ManagedBuildManager.getRandomNumber();
- String subId;
- String tmpId;
- String version;
-
- tmpId = builder.getId();
- version = ManagedBuildManager.getVersionFromIdAndVersion(tmpId);
- if ( version != null) { // If the 'tmpId' contains version information
- subId = ManagedBuildManager.getIdFromIdAndVersion(tmpId) + "." + nnn + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- subId = tmpId + "." + nnn; //$NON-NLS-1$
- }
- String name = builder.getName() + "." + selectedConfiguration.getName(); //$NON-NLS-1$
- tc.createBuilder(builder, subId, name, false);
- }
-
- // Set the builder values
- selectedConfiguration.setArtifactName(artifactName);
selectedConfiguration.setArtifactExtension(artifactExt);
- selectedConfiguration.setBuildCommand(makeCommandOnly);
- selectedConfiguration.setBuildArguments(makeArguments);
}
+ // Set the new make command
+ if(!selectedConfiguration.getBuildCommand().equals(buildCommand))
+ selectedConfiguration.setBuildCommand(buildCommand);
+ if(!selectedConfiguration.getBuildArguments().equals(buildArgs))
+ selectedConfiguration.setBuildArguments(buildArgs);
+
BuildMacroProvider provider = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
- if(provider.canKeepMacrosInBuildfile(this.parent.getSelectedConfiguration()))
- provider.expandMacrosInBuildfile(selectedConfiguration,buildMacrosExpand.getSelection());
+ provider.expandMacrosInBuildfile(
+ selectedConfiguration,
+ provider.areMacrosExpandedInBuildfile(cloneConfig));
setDirty(false);
}
@@ -534,9 +509,7 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
*/
public void setVisible(boolean visible) {
if (visible) {
- useDefaultMake = !parent.getSelectedConfiguration().hasOverriddenBuildCommand();
- makeCommandDefault.setSelection(useDefaultMake);
- makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
+ setValues();
}
super.setVisible(visible);
}
@@ -547,16 +520,16 @@ public class BuildSettingsBlock extends AbstractCOptionPage {
protected void handleUseDefaultPressed() {
// If the state of the button is unchecked, then we want to enable the edit widget
boolean checked = makeCommandDefault.getSelection();
+ IConfiguration config = parent.getSelectedConfigurationClone();
if (checked == true) {
- // TODO: This should NOT change the configuration immediately -
- // it should set an intermediate variable and wait for OK/Apply
- parent.getSelectedConfiguration().setBuildCommand(null);
- parent.getSelectedConfiguration().setBuildArguments(null);
+ config.setBuildCommand(null);
+ config.setBuildArguments(null);
makeCommandEntry.setEditable(false);
} else {
makeCommandEntry.setEditable(true);
}
setValues();
+ setDirty(true);
}
/**
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildStepSettingsBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildStepSettingsBlock.java
index 8c3978971a0..e11187a1155 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildStepSettingsBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildStepSettingsBlock.java
@@ -62,17 +62,43 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
* 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);
+ IConfiguration config = parent.getSelectedConfigurationClone();
+ if(e.widget == preBuildCmd){
+ String val = preBuildCmd.getText().trim();
+ if(!val.equals(config.getPrebuildStep())){
+ config.setPrebuildStep(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == preBuildAnnc){
+ String val = preBuildAnnc.getText().trim();
+ if(!val.equals(config.getPreannouncebuildStep())){
+ config.setPreannouncebuildStep(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == postBuildCmd){
+ String val = postBuildCmd.getText().trim();
+ if(!val.equals(config.getPostbuildStep())){
+ config.setPostbuildStep(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == postBuildAnnc){
+ String val = postBuildAnnc.getText().trim();
+ if(!val.equals(config.getPostannouncebuildStep())){
+ config.setPostannouncebuildStep(val);
+ setValues();
+ setDirty(true);
+ }
+ }
+
}
};
@@ -219,6 +245,7 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
protected void initializeValues() {
setValues();
+ setDirty(false);
}
public void updateValues() {
@@ -227,15 +254,18 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
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
+ IConfiguration config = parent.getSelectedConfigurationClone();
+ if(!config.getPrebuildStep().equals(preBuildCmd.getText()))
+ preBuildCmd.setText(config.getPrebuildStep());
+
+ if(!config.getPreannouncebuildStep().equals(preBuildAnnc.getText()))
+ preBuildAnnc.setText(config.getPreannouncebuildStep());
+
+ if(!config.getPostbuildStep().equals(postBuildCmd.getText()))
+ postBuildCmd.setText(config.getPostbuildStep());
+
+ if(!config.getPostannouncebuildStep().equals(postBuildAnnc.getText()))
+ postBuildAnnc.setText(config.getPostannouncebuildStep());
}
public void removeValues(String id) {
@@ -247,32 +277,16 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
* @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;
+ IConfiguration cloneConfig = parent.getSelectedConfigurationClone();
- // 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);
+ cloneConfig.setPrebuildStep(null);
+ cloneConfig.setPreannouncebuildStep(null);
+ cloneConfig.setPostbuildStep(null);
+ cloneConfig.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();
+ setDirty(true);
}
@@ -282,36 +296,26 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
*/
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;
+ IConfiguration cloneConfig = parent.getSelectedConfigurationClone();
- if (!selectedConfiguration.getPrebuildStep().equals(preBuildCommand)) {
- mustSetValue = true;
+ if (!selectedConfiguration.getPrebuildStep().equals(
+ cloneConfig.getPrebuildStep())) {
+ selectedConfiguration.setPrebuildStep(cloneConfig.getPrebuildStep());
}
- else if (!selectedConfiguration.getPreannouncebuildStep().equals(preBuildAnnounce)) {
- mustSetValue = true;
+ if (!selectedConfiguration.getPreannouncebuildStep().equals(
+ cloneConfig.getPreannouncebuildStep())) {
+ selectedConfiguration.setPreannouncebuildStep(cloneConfig.getPreannouncebuildStep());
}
- else if (!selectedConfiguration.getPostbuildStep().equals(postBuildCommand)) {
- mustSetValue = true;
+ if (!selectedConfiguration.getPostbuildStep().equals(
+ cloneConfig.getPostbuildStep())) {
+ selectedConfiguration.setPostbuildStep(cloneConfig.getPostbuildStep());
}
- else if (!selectedConfiguration.getPostannouncebuildStep().equals(postBuildAnnounce)) {
- mustSetValue = true;
+ if (!selectedConfiguration.getPostannouncebuildStep().equals(
+ cloneConfig.getPostannouncebuildStep())) {
+ selectedConfiguration.setPostannouncebuildStep(cloneConfig.getPostannouncebuildStep());
}
- 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
}
@@ -334,4 +338,10 @@ public class BuildStepSettingsBlock extends AbstractCOptionPage {
public boolean isDirty() {
return dirty;
}
+
+ public void setVisible(boolean visible){
+ if(visible)
+ setValues();
+ super.setVisible(visible);
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentBlock.java
index 44632206723..a725c33bcb6 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentBlock.java
@@ -42,6 +42,7 @@ import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacro;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus;
+import org.eclipse.cdt.managedbuilder.ui.properties.AbstractBuildPropertyPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPreferencePage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
@@ -253,6 +254,9 @@ public class EnvironmentBlock extends AbstractCOptionPage {
*/
public IEnvironmentVariableSupplier[] getSuppliers(Object context){
IEnvironmentVariableSupplier suppliers[] = super.getSuppliers(context);
+
+ if(context == fContext && storeDirectly())
+ return suppliers;
if(suppliers == null || suppliers.length == 0)
return suppliers;
@@ -288,7 +292,7 @@ public class EnvironmentBlock extends AbstractCOptionPage {
if(context != fContext)
return null;
- return (IBuildEnvironmentVariable)getUserVariables().get(name);
+ return getUserVariable(name);
}
/* (non-Javadoc)
@@ -298,8 +302,7 @@ public class EnvironmentBlock extends AbstractCOptionPage {
if(context != fContext)
return null;
- Collection vars = getUserVariables().values();
- return (IBuildEnvironmentVariable[])vars.toArray(new IBuildEnvironmentVariable[vars.size()]);
+ return getUserVariables();
}
}
@@ -457,7 +460,7 @@ public class EnvironmentBlock extends AbstractCOptionPage {
/*
* returns the map containing the user-defined variables
*/
- private Map getUserVariables(){
+ private Map getUserVariablesMap(){
Map map = new HashMap();
if(fUserSupplier != null) {
if(!fDeleteAll){
@@ -489,6 +492,14 @@ public class EnvironmentBlock extends AbstractCOptionPage {
return map;
}
+ private IBuildEnvironmentVariable[] getUserVariables(){
+ if(storeDirectly() && fUserSupplier != null)
+ return fUserSupplier.getVariables(fContext);
+
+ Collection vars = getUserVariablesMap().values();
+ return (IBuildEnvironmentVariable[])vars.toArray(new IBuildEnvironmentVariable[vars.size()]);
+ }
+
/*
* returns the HashSet holding the names of the user-deleted variables
*/
@@ -515,28 +526,41 @@ public class EnvironmentBlock extends AbstractCOptionPage {
private void addUserVariable(String name, String value, int op, String delimiter){
if(!canCreate(name))
return;
- fDeleteAll = false;
- BuildEnvVar newVar = new BuildEnvVar(name,value,op,delimiter);
- if(!ManagedBuildManager.getEnvironmentVariableProvider().isVariableCaseSensitive())
- name = name.toUpperCase();
- getDeletedUserVariableNames().remove(name);
- getAddedUserVariables().put(name,newVar);
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.createVariable(name,value, op, delimiter, fContext);
+ } else {
+ fDeleteAll = false;
+ BuildEnvVar newVar = new BuildEnvVar(name,value,op,delimiter);
+ if(!ManagedBuildManager.getEnvironmentVariableProvider().isVariableCaseSensitive())
+ name = name.toUpperCase();
+ getDeletedUserVariableNames().remove(name);
+ getAddedUserVariables().put(name,newVar);
+ }
fModified = true;
}
+ protected boolean storeDirectly(){
+ if(fContext instanceof IConfiguration)
+ return ((IConfiguration)fContext).isTemporary();
+ return false;
+ }
+
/*
* deletes a user variable
* the variables deleted are stored in the fDeletedUserVariableNames HashSet, and are not actually deleted from the user supplier
* the applyUserVariables() should be called to delete those variabes from the user supplier
*/
private void deleteUserVariable(String name){
- fDeleteAll = false;
- if(!ManagedBuildManager.getEnvironmentVariableProvider().isVariableCaseSensitive())
- name = name.toUpperCase();
- getAddedUserVariables().remove(name);
- getDeletedUserVariableNames().add(name);
-
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.deleteVariable(name, fContext);
+ } else {
+ fDeleteAll = false;
+ if(!ManagedBuildManager.getEnvironmentVariableProvider().isVariableCaseSensitive())
+ name = name.toUpperCase();
+ getAddedUserVariables().remove(name);
+ getDeletedUserVariableNames().add(name);
+ }
fModified = true;
}
@@ -545,10 +569,13 @@ public class EnvironmentBlock extends AbstractCOptionPage {
* the applyUserVariables() should be called to delete those variabes from the user supplier
*/
private void deleteAllUserVariables(){
- fDeleteAll = true;
- getDeletedUserVariableNames().clear();
- getAddedUserVariables().clear();
-
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.deleteAll(fContext);
+ } else {
+ fDeleteAll = true;
+ getDeletedUserVariableNames().clear();
+ getAddedUserVariables().clear();
+ }
fModified = true;
}
@@ -570,13 +597,13 @@ public class EnvironmentBlock extends AbstractCOptionPage {
* returns a user variable of a given name
*/
private IBuildEnvironmentVariable getUserVariable(String name){
- Map vars = getUserVariables();
- if(vars == null)
- return null;
-
if(!ManagedBuildManager.getEnvironmentVariableProvider().isVariableCaseSensitive())
name = name.toUpperCase();
- return (IBuildEnvironmentVariable)vars.get(name);
+
+ if(fUserSupplier != null && storeDirectly())
+ return fUserSupplier.getVariable(name, fContext);
+
+ return (IBuildEnvironmentVariable)getUserVariablesMap().get(name);
}
/*
@@ -585,23 +612,34 @@ public class EnvironmentBlock extends AbstractCOptionPage {
*/
private void applyUserVariables(){
if(fUserSupplier != null){
- if(fDeleteAll){
- fUserSupplier.deleteAll(fContext);
- }
- else{
- Iterator iter = getDeletedUserVariableNames().iterator();
- while(iter.hasNext()){
- fUserSupplier.deleteVariable((String)iter.next(),fContext);
+ if(storeDirectly()){
+ if(getContainer() instanceof AbstractBuildPropertyPage
+ && fContext instanceof IConfiguration){
+ AbstractBuildPropertyPage page = (AbstractBuildPropertyPage)getContainer();
+ IConfiguration realCfg = page.getRealConfig((IConfiguration)fContext);
+ IBuildEnvironmentVariable vars[] = getUserVariables();
+ UserDefinedEnvironmentSupplier supplier = EnvironmentVariableProvider.fUserSupplier;
+ supplier.setVariables(vars,realCfg);
}
-
- iter = getAddedUserVariables().values().iterator();
- while(iter.hasNext()){
- IBuildEnvironmentVariable var = (IBuildEnvironmentVariable)iter.next();
- fUserSupplier.createVariable(var.getName(),var.getValue(),var.getOperation(),var.getDelimiter(),fContext);
+ } else {
+ if(fDeleteAll){
+ fUserSupplier.deleteAll(fContext);
+ }
+ else{
+ Iterator iter = getDeletedUserVariableNames().iterator();
+ while(iter.hasNext()){
+ fUserSupplier.deleteVariable((String)iter.next(),fContext);
+ }
+
+ iter = getAddedUserVariables().values().iterator();
+ while(iter.hasNext()){
+ IBuildEnvironmentVariable var = (IBuildEnvironmentVariable)iter.next();
+ fUserSupplier.createVariable(var.getName(),var.getValue(),var.getOperation(),var.getDelimiter(),fContext);
+ }
+
+ getDeletedUserVariableNames().clear();
+ getAddedUserVariables().clear();
}
-
- getDeletedUserVariableNames().clear();
- getAddedUserVariables().clear();
}
}
}
@@ -611,6 +649,7 @@ public class EnvironmentBlock extends AbstractCOptionPage {
*/
private void storeUserVariables(){
applyUserVariables();
+
if(fUserSupplier != null)
fUserSupplier.serialize(false);
}
@@ -813,12 +852,11 @@ public class EnvironmentBlock extends AbstractCOptionPage {
// handleSelectionChanged(fEditableList);
if(fUserSupplier != null) {
- Collection vars = getUserVariables().values();
- Iterator iter = vars.iterator();
+ IBuildEnvironmentVariable variables[] = getUserVariables();
- List list = new ArrayList(vars.size());
- while(iter.hasNext()){
- IBuildEnvironmentVariable userVar = (IBuildEnvironmentVariable)iter.next();
+ List list = new ArrayList(variables.length);
+ for( int i = 0; i < variables.length; i++ ){
+ IBuildEnvironmentVariable userVar = variables[i];
if(userVar != null){
IBuildEnvironmentVariable sysVar = getSystemVariable(userVar.getName(),true);
IBuildEnvironmentVariable var = EnvVarOperationProcessor.performOperation(sysVar,userVar);
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentSetBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentSetBlock.java
index 996ff0bbde3..53efc1a0724 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentSetBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/EnvironmentSetBlock.java
@@ -150,10 +150,10 @@ public class EnvironmentSetBlock extends AbstractCOptionPage {
if(fParentContainer instanceof BuildPropertyPage){
BuildPropertyPage page = (BuildPropertyPage)fParentContainer;
- if(page.getSelectedConfiguration() != null)
- fFolderTabs[1].setContext(page.getSelectedConfiguration().getManagedProject());
+ if(page.getSelectedConfigurationClone() != null)
+ fFolderTabs[1].setContext(page.getSelectedConfigurationClone().getManagedProject());
- fFolderTabs[0].setContext(page.getSelectedConfiguration());
+ fFolderTabs[0].setContext(page.getSelectedConfigurationClone());
fFolderTabs[0].setParentContextInfo(fFolderTabs[1].getContextInfo());
}
else {
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
index 7c3de7e7081..1f86d805e8f 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
+ * Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,10 +12,11 @@
package org.eclipse.cdt.managedbuilder.internal.ui;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
-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.cdt.managedbuilder.ui.wizards.NewManagedProjectOptionPage;
import org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedProjectWizard;
import org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock;
@@ -26,9 +27,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
public class ErrorParserBlock extends AbstractErrorParserBlock {
-
- public ErrorParserBlock() {
+ private BuildPropertyPage parent;
+ private String errorParsers[];
+
+ public ErrorParserBlock(BuildPropertyPage parent) {
super();
+ this.parent = parent;
}
protected String[] getErrorParserIDs(IConfiguration config) {
@@ -45,8 +49,11 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
}
protected String[] getErrorParserIDs(IProject project) {
- IConfiguration config = ManagedBuildManager.getSelectedConfiguration(project);
- if (config == null) {
+
+ IConfiguration config = null;
+ if(parent != null)
+ config = parent.getSelectedConfigurationClone();
+ else if ((config = ManagedBuildManager.getSelectedConfiguration(project)) == null) {
// This case occurs when modifying the properties of an existing
// managed build project, and the user selects the error parsers
// page before the "C/C++ Build" page.
@@ -66,6 +73,9 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
// Get the currently selected configuration from the page's container
// This is invoked by the managed builder new project wizard before the
// project is created.
+ if(parent != null){
+ return getErrorParserIDs(parent.getSelectedConfigurationClone());
+ }
ICOptionContainer container = getContainer();
if (container instanceof NewManagedProjectOptionPage) {
NewManagedProjectOptionPage parent = (NewManagedProjectOptionPage)getContainer();
@@ -82,7 +92,11 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
}
public void saveErrorParsers(IProject project, String[] parsers) {
- IConfiguration config = ManagedBuildManager.getSelectedConfiguration(project);
+ IConfiguration config = null;
+ if(parent != null)
+ config = parent.getSelectedConfigurationClone();
+ else
+ config = ManagedBuildManager.getSelectedConfiguration(project);
if (config != null) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < parsers.length; i++) {
@@ -96,10 +110,32 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
public IPreferenceStore getPreferenceStore() {
return null;
}
+
+ protected boolean checkIds(String ids1[], String ids2[]){
+ if(ids1.length != ids2.length)
+ return true;
+
+ for(int i = 0; i < ids1.length; i++){
+ String id = ids1[i];
+ int j;
+ for(j = 0; j < ids2.length; j++){
+ if(id.equals(ids2[j]))
+ break;
+ }
+
+ if(j == ids2.length)
+ return true;
+ }
+
+ return false;
+ }
protected void setValues() {
super.setValues();
+ if(parent != null && parent.getSelectedConfigurationClone() != null)
+ errorParsers = getErrorParserIDs(parent.getSelectedConfigurationClone());
+
// TODO: This reset belongs in AbstractErrorParserBlock.java?
// Reset the "dirty" flag
listDirty = false;
@@ -108,6 +144,11 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
public void performApply(IProgressMonitor monitor) throws CoreException {
super.performApply(monitor);
+ if(parent != null){
+ IConfiguration realConfig = ManagedBuildManager.getSelectedConfiguration(parent.getProject());
+ realConfig.setErrorParserIds(parent.getSelectedConfigurationClone().getErrorParserIds());
+ errorParsers = getErrorParserIDs(parent.getSelectedConfigurationClone());
+ }
// TODO: This reset belongs in AbstractErrorParserBlock.java?
// Reset the "dirty" flag
listDirty = false;
@@ -127,4 +168,32 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
public boolean isDirty() {
return listDirty;
}
+
+ public void setVisible(boolean visible){
+ if(parent != null){
+ if(visible){
+ boolean dirtyState = listDirty;
+ updateListControl(parent.getSelectedConfigurationClone().getErrorParserList());
+ if(dirtyState != listDirty)
+ listDirty = checkIds(parent.getSelectedConfigurationClone().getErrorParserList(),errorParsers);
+ } else {
+ try {
+ super.performApply(null);
+ } catch (CoreException e) {
+ }
+ }
+ }
+ super.setVisible(visible);
+ }
+
+ protected void setDefaults() {
+ if(parent != null){
+ IConfiguration cfg = parent.getSelectedConfigurationClone();
+ cfg.setErrorParserIds(null);
+ updateListControl(cfg.getErrorParserList());
+ listDirty = true;
+ } else
+ super.setDefaults();
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosBlock.java
index 3b47c49dc49..9a8ae9ca746 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosBlock.java
@@ -20,9 +20,9 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.internal.ui.util.SWTUtil;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.internal.envvar.EnvVarOperationProcessor;
import org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableProvider;
-import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacro;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroContextInfo;
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor;
@@ -36,6 +36,7 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacro;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroStatus;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier;
+import org.eclipse.cdt.managedbuilder.ui.properties.AbstractBuildPropertyPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPreferencePage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
@@ -328,6 +329,10 @@ public class MacrosBlock extends AbstractCOptionPage {
*/
public IBuildMacroSupplier[] getSuppliers(int contextType, Object contextData){
IBuildMacroSupplier suppliers[] = super.getSuppliers(contextType,contextData);
+
+ if(contextType == fContextType && contextData == fContextData && storeDirectly())
+ return suppliers;
+
if(suppliers == null || suppliers.length == 0)
return suppliers;
if(!(suppliers[0] instanceof UserDefinedMacroSupplier))
@@ -362,7 +367,7 @@ public class MacrosBlock extends AbstractCOptionPage {
if(contextType != fContextType || contextData != fContextData)
return null;
- return (IBuildMacro)getUserMacros().get(name);
+ return getUserMacro(name);
}
/* (non-Javadoc)
@@ -372,8 +377,7 @@ public class MacrosBlock extends AbstractCOptionPage {
if(contextType != fContextType || contextData != fContextData)
return null;
- Collection macros = getUserMacros().values();
- return (IBuildMacro[])macros.toArray(new IBuildMacro[macros.size()]);
+ return getUserMacros();
}
}
@@ -557,10 +561,7 @@ public class MacrosBlock extends AbstractCOptionPage {
fIsEditable = editable;
}
- /*
- * returns the map containing the user-defined macros
- */
- private Map getUserMacros(){
+ private Map getUserMacrosMap(){
Map map = new HashMap();
if(fUserSupplier != null) {
if(!fDeleteAll){
@@ -587,6 +588,18 @@ public class MacrosBlock extends AbstractCOptionPage {
}
return map;
}
+
+ /*
+ * returns the map containing the user-defined macros
+ */
+ private IBuildMacro[] getUserMacros(){
+ if(storeDirectly() && fUserSupplier != null)
+ return fUserSupplier.getMacros(fContextType,fContextData);
+
+ Collection macros = getUserMacrosMap().values();
+ return (IBuildMacro[])macros.toArray(new IBuildMacro[macros.size()]);
+
+ }
/*
* returns the HashSet holding the names of the user-deleted macros
@@ -611,17 +624,20 @@ public class MacrosBlock extends AbstractCOptionPage {
* the macros created are stored in the fAddedUserMacros Map, and are not actually added to the user supplier
* the applyUserMacros() should be called to store those macros to the user supplier
*/
- private void addUserMacro(String name, int type, String value){
+/* private void addUserMacro(String name, int type, String value){
if(!canCreate(name))
return;
- fDeleteAll = false;
- BuildMacro newMacro = new BuildMacro(name,type,value);
- getDeletedUserMacroNames().remove(name);
- getAddedUserMacros().put(name,newMacro);
-
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.createMacro(newMacro, fContextType, fContextData);
+ } else {
+ fDeleteAll = false;
+ BuildMacro newMacro = new BuildMacro(name,type,value);
+ getDeletedUserMacroNames().remove(name);
+ getAddedUserMacros().put(name,newMacro);
+ }
fModified = true;
}
-
+*/
/*
* creates a user macro
* the macros created are stored in the fAddedUserMacros Map, and are not actually added to the user supplier
@@ -631,9 +647,14 @@ public class MacrosBlock extends AbstractCOptionPage {
String name = newMacro.getName();
if(!canCreate(name))
return;
- fDeleteAll = false;
- getDeletedUserMacroNames().remove(name);
- getAddedUserMacros().put(name,newMacro);
+
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.createMacro(newMacro, fContextType, fContextData);
+ } else {
+ fDeleteAll = false;
+ getDeletedUserMacroNames().remove(name);
+ getAddedUserMacros().put(name,newMacro);
+ }
fModified = true;
}
@@ -643,27 +664,34 @@ public class MacrosBlock extends AbstractCOptionPage {
* the macros created are stored in the fAddedUserMacros Map, and are not actually added to the user supplier
* the applyUserMacros() should be called to store those macros to the user supplier
*/
- private void addUserMacro(String name, int type, String value[]){
+/* private void addUserMacro(String name, int type, String value[]){
if(!canCreate(name))
return;
- fDeleteAll = false;
- BuildMacro newMacro = new BuildMacro(name,type,value);
- getDeletedUserMacroNames().remove(name);
- getAddedUserMacros().put(name,newMacro);
-
+
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.createMacro(newMacro, fContextType, fContextData);
+ } else {
+ fDeleteAll = false;
+ BuildMacro newMacro = new BuildMacro(name,type,value);
+ getDeletedUserMacroNames().remove(name);
+ getAddedUserMacros().put(name,newMacro);
+ }
fModified = true;
}
-
+*/
/*
* deletes a user macro
* the macros deleted are stored in the fDeletedUserMacroNames HashSet, and are not actually deleted from the user supplier
* the applyUserMacros() should be called to delete those macros from the user supplier
*/
private void deleteUserMacro(String name){
- fDeleteAll = false;
- getAddedUserMacros().remove(name);
- getDeletedUserMacroNames().add(name);
-
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.deleteMacro(name, fContextType, fContextData);
+ } else {
+ fDeleteAll = false;
+ getAddedUserMacros().remove(name);
+ getDeletedUserMacroNames().add(name);
+ }
fModified = true;
}
@@ -672,10 +700,13 @@ public class MacrosBlock extends AbstractCOptionPage {
* the applyUserMacros() should be called to delete those macros from the user supplier
*/
private void deleteAllUserMacros(){
- fDeleteAll = true;
- getDeletedUserMacroNames().clear();
- getAddedUserMacros().clear();
-
+ if(storeDirectly() && fUserSupplier != null){
+ fUserSupplier.deleteAll(fContextType, fContextData);
+ } else {
+ fDeleteAll = true;
+ getDeletedUserMacroNames().clear();
+ getAddedUserMacros().clear();
+ }
fModified = true;
}
@@ -697,7 +728,10 @@ public class MacrosBlock extends AbstractCOptionPage {
* returns a user macro of a given name
*/
private IBuildMacro getUserMacro(String name){
- Map macros = getUserMacros();
+ if(storeDirectly() && fUserSupplier != null)
+ return fUserSupplier.getMacro(name,fContextType,fContextData);
+
+ Map macros = getUserMacrosMap();
if(macros == null)
return null;
@@ -710,23 +744,35 @@ public class MacrosBlock extends AbstractCOptionPage {
*/
private void applyUserMacros(){
if(fUserSupplier != null){
- if(fDeleteAll){
- fUserSupplier.deleteAll(fContextType,fContextData);
- }
- else{
- Iterator iter = getDeletedUserMacroNames().iterator();
- while(iter.hasNext()){
- fUserSupplier.deleteMacro((String)iter.next(),fContextType,fContextData);
+ if(storeDirectly()){
+ if(getContainer() instanceof AbstractBuildPropertyPage
+ && fContextType == IBuildMacroProvider.CONTEXT_CONFIGURATION
+ && fContextData instanceof IConfiguration){
+ AbstractBuildPropertyPage page = (AbstractBuildPropertyPage)getContainer();
+ IConfiguration realCfg = page.getRealConfig((IConfiguration)fContextData);
+ IBuildMacro macros[] = getUserMacros();
+ UserDefinedMacroSupplier supplier = BuildMacroProvider.fUserDefinedMacroSupplier;
+ supplier.setMacros(macros, IBuildMacroProvider.CONTEXT_CONFIGURATION, realCfg);
}
-
- iter = getAddedUserMacros().values().iterator();
- while(iter.hasNext()){
- IBuildMacro macro = (IBuildMacro)iter.next();
- fUserSupplier.createMacro(macro,fContextType,fContextData);
+ } else {
+ if(fDeleteAll){
+ fUserSupplier.deleteAll(fContextType,fContextData);
+ }
+ else{
+ Iterator iter = getDeletedUserMacroNames().iterator();
+ while(iter.hasNext()){
+ fUserSupplier.deleteMacro((String)iter.next(),fContextType,fContextData);
+ }
+
+ iter = getAddedUserMacros().values().iterator();
+ while(iter.hasNext()){
+ IBuildMacro macro = (IBuildMacro)iter.next();
+ fUserSupplier.createMacro(macro,fContextType,fContextData);
+ }
+
+ getDeletedUserMacroNames().clear();
+ getAddedUserMacros().clear();
}
-
- getDeletedUserMacroNames().clear();
- getAddedUserMacros().clear();
}
}
}
@@ -906,12 +952,11 @@ public class MacrosBlock extends AbstractCOptionPage {
if(fEditableTable == null || fContextType == 0)
return;
- Collection values = getUserMacros().values();
- ArrayList list = new ArrayList(values.size());
- for(Iterator iter = values.iterator(); iter.hasNext();){
- Object next = iter.next();
- if(next != null)
- list.add(next);
+ IBuildMacro macros[] = getUserMacros();
+ ArrayList list = new ArrayList(macros.length);
+ for(int i = 0; i < macros.length; i++){
+ if(macros[i] != null)
+ list.add(macros[i]);
}
fEditableTable.setInput(list.toArray(new IBuildMacro[list.size()]));
}
@@ -1238,4 +1283,12 @@ public class MacrosBlock extends AbstractCOptionPage {
}
return null;
}
+
+ protected boolean storeDirectly(){
+ if(fContextType == IBuildMacroProvider.CONTEXT_CONFIGURATION
+ && fContextData instanceof IConfiguration)
+ return ((IConfiguration)fContextData).isTemporary();
+ return false;
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosSetBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosSetBlock.java
index 8eb9455e86a..300cdd449ce 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosSetBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/MacrosSetBlock.java
@@ -153,10 +153,10 @@ import org.eclipse.swt.widgets.Group;
if(fParentContainer instanceof BuildPropertyPage){
BuildPropertyPage page = (BuildPropertyPage)fParentContainer;
- if(page.getSelectedConfiguration() != null)
- fFolderTabs[1].setContext(IBuildMacroProvider.CONTEXT_PROJECT,page.getSelectedConfiguration().getManagedProject());
+ if(page.getSelectedConfigurationClone() != null)
+ fFolderTabs[1].setContext(IBuildMacroProvider.CONTEXT_PROJECT,page.getSelectedConfigurationClone().getManagedProject());
- fFolderTabs[0].setContext(IBuildMacroProvider.CONTEXT_CONFIGURATION,page.getSelectedConfiguration());
+ fFolderTabs[0].setContext(IBuildMacroProvider.CONTEXT_CONFIGURATION,page.getSelectedConfigurationClone());
fFolderTabs[0].setParentContextInfo(fFolderTabs[1].getContextInfo());
}
/* else {
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java
index bd697a43738..16d119a8934 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java
@@ -14,6 +14,7 @@ import java.util.Iterator;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPreferencePage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolSettingsPreferenceStore;
import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
import org.eclipse.cdt.ui.dialogs.BinaryParserBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
@@ -76,7 +77,7 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
addTab(toolsSettingsBlock = new ToolsSettingsBlock((BuildPropertyPage) fParent, element));
addTab(buildSettingsBlock = new BuildSettingsBlock((BuildPropertyPage) fParent));
addTab(buildStepSettingsBlock = new BuildStepSettingsBlock((BuildPropertyPage) fParent));
- addTab(errParserBlock = new ErrorParserBlock());
+ addTab(errParserBlock = new ErrorParserBlock((BuildPropertyPage) fParent));
addTab(binaryParserBlock = new BinaryParserBlock());
addTab(environmentBlock = new EnvironmentSetBlock((BuildPropertyPage) fParent));
addTab(macrosBlock = new MacrosSetBlock((BuildPropertyPage) fParent));
@@ -331,11 +332,11 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
return null;
}
- public IPreferenceStore getToolSettingsPreferenceStore()
+ public BuildToolSettingsPreferenceStore getToolSettingsPreferenceStore()
{
return toolsSettingsBlock.getPreferenceStore();
}
-
+
public void update() {
super.update();
ICOptionPage tab = getCurrentPage();
@@ -419,4 +420,19 @@ public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
return false;
}
+ public boolean containsDefaults(){
+ Iterator iter = getOptionPages().iterator();
+ while (iter.hasNext()) {
+ ICOptionPage tab = (ICOptionPage)iter.next();
+ if(tab instanceof ToolsSettingsBlock){
+ if(!((ToolsSettingsBlock)tab).containsDefaults())
+ return false;
+ } else if(tab instanceof ResourceCustomBuildStepBlock) {
+ if(!((ResourceCustomBuildStepBlock)tab).containsDefaults())
+ return false;
+ } else
+ return false;
+ }
+ return true;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
index 801942dcea6..7e6340edaf1 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2004 IBM Corporation and others.
+ * Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,7 +35,7 @@ public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
* @see org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock#addTabs()
*/
protected void addTabs() {
- errParserBlock = new ErrorParserBlock();
+ errParserBlock = new ErrorParserBlock(null);
addTab(errParserBlock);
addTab(binaryParserBlock = new BinaryParserBlock());
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ResourceCustomBuildStepBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ResourceCustomBuildStepBlock.java
index 70569f1ce9e..ee7b8add7d7 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ResourceCustomBuildStepBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ResourceCustomBuildStepBlock.java
@@ -10,14 +10,17 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.ui;
-import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
-import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IInputType;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
+import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IOutputType;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
+import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -26,18 +29,20 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-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.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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
@@ -88,7 +93,7 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
private static final String rcbsToolInputTypeName = new String("Resource Custom Build Step Input Type"); //$NON-NLS-1$
private static final String rcbsToolOutputTypeId = new String("org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype"); //$NON-NLS-1$
private static final String rcbsToolOutputTypeName = new String("Resource Custom Build Step Output Type"); //$NON-NLS-1$
-
+ private static final String PATH_SEPERATOR = ";"; //$NON-NLS-1$
/*
* Dialog widgets
*/
@@ -102,16 +107,54 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
* Bookeeping variables
*/
private ResourceBuildPropertyPage resParent;
- private String resBuildInputs;
- private String resBuildOutputs;
- private String resBuildAnnouncement;
- private String resBuildCommand;
// Has the page been changed?
private boolean dirty = false;
private ModifyListener widgetModified = new ModifyListener() {
public void modifyText(ModifyEvent e) {
- setDirty(true);
+ if(e.widget == buildInputs){
+ String val = buildInputs.getText().trim();
+ IResourceConfiguration rcCfg = resParent.getCurrentResourceConfigClone();
+ ITool rcbs = getRcbsTool(rcCfg,!"".equals(val)); //$NON-NLS-1$
+ if(rcbs != null){
+ IAdditionalInput input = rcbs.getInputTypes()[0].getAdditionalInputs()[0];
+ if(!createList(input.getPaths()).equals(val)){
+ input.setPaths(val);
+ setValues();
+ setDirty(true);
+ }
+ }
+ } else if(e.widget == buildOutputs){
+ String val = buildOutputs.getText().trim();
+ IResourceConfiguration rcCfg = resParent.getCurrentResourceConfigClone();
+ ITool rcbs = getRcbsTool(rcCfg,!"".equals(val)); //$NON-NLS-1$
+ if(rcbs != null){
+ IOutputType output = rcbs.getOutputTypes()[0];
+ if(!createList(output.getOutputNames()).equals(val)){
+ output.setOutputNames(val);
+ setValues();
+ setDirty(true);
+ }
+ }
+ } else if(e.widget == buildCommand){
+ String val = buildCommand.getText().trim();
+ IResourceConfiguration rcCfg = resParent.getCurrentResourceConfigClone();
+ ITool rcbs = getRcbsTool(rcCfg,!"".equals(val)); //$NON-NLS-1$
+ if(rcbs != null && !rcbs.getToolCommand().equals(val)){
+ rcbs.setToolCommand(val);
+ setValues();
+ setDirty(true);
+ }
+ } else if(e.widget == buildDescription){
+ String val = buildDescription.getText().trim();
+ IResourceConfiguration rcCfg = resParent.getCurrentResourceConfigClone();
+ ITool rcbs = getRcbsTool(rcCfg,!"".equals(val)); //$NON-NLS-1$
+ if(rcbs != null && !rcbs.getAnnouncement().equals(val)){
+ rcbs.setAnnouncement(val);
+ setValues();
+ setDirty(true);
+ }
+ }
}
};
@@ -177,6 +220,14 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
gd1.horizontalSpan = 1;
gd1.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
rcbsApplicabilitySelector.setLayoutData(gd1);
+ rcbsApplicabilitySelector.addSelectionListener(
+ new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ resParent.getCurrentResourceConfigClone().setRcbsApplicability(
+ selectionToApplicability(rcbsApplicabilitySelector.getSelectionIndex()));
+ setDirty(true);
+ }
+ });
}
/* (non-Javadoc)
@@ -297,6 +348,7 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
protected void initializeValues() {
setValues();
+ setDirty(false);
}
public void updateValues() {
@@ -304,11 +356,8 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
}
protected void setValues() {
- IResourceConfiguration resConfig;
- String[] buildInputsPaths;
- String[] buildOutputsPaths;
- boolean foundRcbsTool = false;
- int idx;
+ IResourceConfiguration resConfig = resParent.getCurrentResourceConfigClone();
+
/*
* Examine the tools defined for the resource configuration.
* There should be at most one tool defined for a custom build step which was not an
@@ -317,44 +366,25 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
* If the rcbs tool has not been defined yet, clear the field values.
* Finally, set the rcbsApplicability selector from the current value in the resource configuration.
*/
- resConfig = resParent.getCurrentResourceConfig();
- ITool [] tools = resConfig.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
- buildInputsPaths = tool.getInputTypes()[0].getAdditionalInputs()[0].getPaths();
- resBuildInputs = ""; //$NON-NLS-1$
- for ( int j = 0; j < buildInputsPaths.length; j++ ){
- resBuildInputs += buildInputsPaths[j] + ";"; //$NON-NLS-1$
- }
- int len = resBuildInputs.length();
- resBuildInputs = resBuildInputs.substring(0,len-1);
- buildInputs.setText(resBuildInputs);
-
- buildOutputsPaths = tool.getOutputTypes()[0].getOutputNames();
- resBuildOutputs = ""; //$NON-NLS-1$
- for ( int j = 0; j < buildOutputsPaths.length; j++ ){
- resBuildOutputs += buildOutputsPaths[j] + ";"; //$NON-NLS-1$
- }
- len = resBuildOutputs.length();
- resBuildOutputs = resBuildOutputs.substring(0,len-1);
- buildOutputs.setText(resBuildOutputs);
-
- resBuildCommand = tool.getToolCommand();
- buildCommand.setText(resBuildCommand);
-
- resBuildAnnouncement = tool.getAnnouncement();
- buildDescription.setText(resBuildAnnouncement);
-
- foundRcbsTool = true;
- break;
- }
- }
-
- /*
- * If an rcbs tool has not been created yet, just blank the fields.
- */
- if(!foundRcbsTool) {
+ ITool tool = getRcbsTool(resConfig,false);
+
+ if(tool != null){
+ String tmp = createList(tool.getInputTypes()[0].getAdditionalInputs()[0].getPaths());
+ if(!tmp.equals(buildInputs.getText()))
+ buildInputs.setText(tmp);
+
+ tmp = createList(tool.getOutputTypes()[0].getOutputNames());
+ if(!tmp.equals(buildOutputs.getText()))
+ buildOutputs.setText(tmp);
+
+ tmp = tool.getToolCommand();
+ if(!tmp.equals(buildCommand.getText()))
+ buildCommand.setText(tmp);
+
+ tmp = tool.getAnnouncement();
+ if(!tmp.equals(buildDescription.getText()))
+ buildDescription.setText(tmp);
+ } else {
buildInputs.setText(""); //$NON-NLS-1$
buildOutputs.setText(""); //$NON-NLS-1$
buildCommand.setText(""); //$NON-NLS-1$
@@ -364,31 +394,38 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
/*
* Set the state of the rcbs applicability selector.
*/
- switch(resConfig.getRcbsApplicability()){
- case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE:
- idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
- break;
+ rcbsApplicabilitySelector.select(applicabilityToSelection(resConfig.getRcbsApplicability()));
+
+// setDirty(false);
+ }
+
+ private int selectionToApplicability(int index){
+ String sel = rcbsApplicabilitySelector.getItem(index);
+ if(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE).equals(sel)){
+ return IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE;
+ } else if(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER).equals(sel)){
+ return IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AFTER;
+ } else if(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE).equals(sel)){
+ return IResourceConfiguration.KIND_APPLY_RCBS_TOOL_BEFORE;
+ }
+ return IResourceConfiguration.KIND_DISABLE_RCBS_TOOL;
+ }
+
+ private int applicabilityToSelection(int val){
+ switch(val){
case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AFTER:
- idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER));
- break;
+ return rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER));
case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_BEFORE:
- idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE));
- break;
+ return rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE));
case IResourceConfiguration.KIND_DISABLE_RCBS_TOOL:
- idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE));
- break;
+ return rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE));
+ case IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE:
default:
- /*
- * If we get an unexpected value, use the normal default of override.
- */
- idx = rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
- break;
+ return rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_OVERRIDE));
}
- rcbsApplicabilitySelector.select(idx);
-
- setDirty(false);
+
}
-
+
public void removeValues(String id) {
// Nothing to do...
}
@@ -398,46 +435,13 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
*/
public void performDefaults() {
- IResourceConfiguration resConfig;
+ IResourceConfiguration cloneResConfig;
- // 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(CONFIRM_DEFAULT_TITLE),
- ManagedBuilderUIMessages.getResourceString(CONFIRM_DEFAULT_MESSAGE));
- if (!shouldDefault) return;
-
- /*
- * Examine the tools defined for the resource configuration.
- * There should be at most one tool defined for a custom build step which was not an
- * extension element (not defined by a tool integrator in a manifest).
- * If the rcbs tool has been defined, remove the tool from the resource configuration.
- * If the rcbs tool was not disabled before now, indicate that a rebuild will be needed.
- * Set the rcbsApplicability in the resource configuration to "disabled" by default.
- * Update the field values.
- */
- resConfig = resParent.getCurrentResourceConfig();
- ITool [] tools = resConfig.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
- resConfig.removeTool(tool);
- break;
- }
- }
-
- /*
- * If the rcbs tool was not disabled, it will be after restoring defaults.
- * This transition implies a rebuild is needed.
- */
- if(resConfig.getRcbsApplicability() != IResourceConfiguration.KIND_DISABLE_RCBS_TOOL){
- resConfig.getParent().setRebuildState(true);
- }
- resConfig.setRcbsApplicability(IResourceConfiguration.KIND_DISABLE_RCBS_TOOL);
+ cloneResConfig = resParent.getCurrentResourceConfigClone();
+ removeRcbsTools(cloneResConfig);
+
setValues();
- setDirty(false);
+ setDirty(true);
}
/*
@@ -445,11 +449,10 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
*/
public void performApply(IProgressMonitor monitor) throws CoreException {
- IResourceConfiguration resConfig;
- boolean foundRcbsTool = false;
+ IResourceConfiguration cloneResConfig;
+ IResourceConfiguration rcConfig;
boolean rebuildNeeded = false;
boolean rcbsStillDisabledSoNoRebuild = false;
- int idx;
/*
* Gather the users input.
@@ -464,77 +467,116 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
* selection.
*/
- resBuildInputs = buildInputs.getText().trim();
- resBuildOutputs = buildOutputs.getText().trim();
- resBuildCommand = buildCommand.getText().trim();
- resBuildAnnouncement = buildDescription.getText().trim();
-
- resConfig = resParent.getCurrentResourceConfig();
- ITool [] tools = resConfig.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
- tool.getInputTypes()[0].getAdditionalInputs()[0].setPaths(resBuildInputs);
- tool.getOutputTypes()[0].setOutputNames(resBuildOutputs);
- tool.setToolCommand(resBuildCommand);
- tool.setAnnouncement(resBuildAnnouncement);
- if (tool.isDirty()) {
- rebuildNeeded = true;
- }
- foundRcbsTool = true;
- break;
+ cloneResConfig = resParent.getCurrentResourceConfigClone();
+ ITool cloneTool = getRcbsTool(cloneResConfig, false);
+
+ rcConfig = resParent.getCurrentResourceConfig(false);
+ if(cloneTool == null){
+ if(rcConfig != null)
+ rebuildNeeded = removeRcbsTools(rcConfig);
+ } else {
+ if(rcConfig == null)
+ rcConfig = resParent.getCurrentResourceConfig(true);
+
+
+ ITool realTool = getRcbsTool(rcConfig,true);
+
+ realTool.getInputTypes()[0].getAdditionalInputs()[0].setPaths(
+ createList(
+ cloneTool.getInputTypes()[0].getAdditionalInputs()[0].getPaths()));
+ realTool.getOutputTypes()[0].setOutputNames(
+ createList(
+ cloneTool.getOutputTypes()[0].getOutputNames()));
+ realTool.setToolCommand(
+ cloneTool.getToolCommand());
+ realTool.setAnnouncement(
+ cloneTool.getAnnouncement());
+ if (realTool.isDirty()) {
+ rebuildNeeded = true;
}
- }
- if(!foundRcbsTool) {
- ITool rcbsTool;
- IInputType rcbsToolInputType;
- IAdditionalInput rcbsToolInputTypeAdditionalInput;
- IOutputType rcbsToolOutputType;
-
- rcbsTool = resConfig.createTool(null,rcbsToolId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolName,false); //$NON-NLS-1$
- rcbsToolInputType = rcbsTool.createInputType(null,rcbsToolInputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolInputTypeName,false); //$NON-NLS-1$
- rcbsToolInputTypeAdditionalInput = rcbsToolInputType.createAdditionalInput(resBuildInputs);
- rcbsToolInputTypeAdditionalInput.setKind(IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY);
- rcbsToolOutputType = rcbsTool.createOutputType(null,rcbsToolOutputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolOutputTypeName,false); //$NON-NLS-1$
- rcbsToolOutputType.setOutputNames(resBuildOutputs);
- rcbsTool.setCustomBuildStep(true);
- rcbsTool.setToolCommand(resBuildCommand);
- rcbsTool.setAnnouncement(resBuildAnnouncement);
- rebuildNeeded = true;
- }
- /*
- * Get the state of the rcbs applicability selector and set the rcbsApplicability attribute in the
- * resource configuration.
- */
- idx = rcbsApplicabilitySelector.getSelectionIndex();
- if(idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_AFTER))) {
- resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AFTER);
- } else
- if(idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_BEFORE))) {
- resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_BEFORE);
- } else
- if (idx == rcbsApplicabilitySelector.indexOf(ManagedBuilderUIMessages.getResourceString(RCBS_DISABLE))) {
/*
- * If the rcbs tool was disabled and will remain disabled, no rebuild is required.
+ * Get the state of the rcbs applicability selector and set the rcbsApplicability attribute in the
+ * resource configuration.
*/
- if(resConfig.getRcbsApplicability() == IResourceConfiguration.KIND_DISABLE_RCBS_TOOL){
+ rcConfig.setRcbsApplicability(
+ cloneResConfig.getRcbsApplicability());
+
+ if(rcConfig.getRcbsApplicability() == IResourceConfiguration.KIND_DISABLE_RCBS_TOOL)
rcbsStillDisabledSoNoRebuild = true;
+
+ if (rcConfig.isDirty()) {
+ rebuildNeeded = true;
}
- resConfig.setRcbsApplicability(IResourceConfiguration.KIND_DISABLE_RCBS_TOOL);
- } else {
- resConfig.setRcbsApplicability(IResourceConfiguration.KIND_APPLY_RCBS_TOOL_AS_OVERRIDE);
+
+ if (rebuildNeeded && !rcbsStillDisabledSoNoRebuild) {
+ rcConfig.getParent().setRebuildState(true);
+ }
+
+ setDirty(false);
}
- if (resConfig.isDirty()) {
- rebuildNeeded = true;
+ }
+
+ private String createList(String[] items) {
+ if(items == null)
+ return new String();
+
+ StringBuffer path = new StringBuffer(""); //$NON-NLS-1$
+
+ for (int i = 0; i < items.length; i++) {
+ path.append(items[i]);
+ if (i < (items.length - 1)) {
+ path.append(PATH_SEPERATOR);
+ }
}
+ return path.toString();
+ }
+
+ private boolean removeRcbsTools(IResourceConfiguration rcConfig){
+ ITool tools[] = getRcbsTools(rcConfig);
+ if(tools != null){
+ for(int i = 0; i < tools.length; i++)
+ rcConfig.removeTool(tools[i]);
+
+ boolean rebuildNeeded =
+ rcConfig.getRcbsApplicability() != IResourceConfiguration.KIND_DISABLE_RCBS_TOOL;
+
+ rcConfig.setRcbsApplicability(IResourceConfiguration.KIND_DISABLE_RCBS_TOOL);
+
+ return rebuildNeeded;
+ }
+ return false;
+ }
- if (rebuildNeeded && !rcbsStillDisabledSoNoRebuild) {
- resConfig.getParent().setRebuildState(true);
+ private ITool getRcbsTool(IResourceConfiguration rcConfig, boolean create){
+ ITool rcbsTools[] = getRcbsTools(rcConfig);
+ ITool rcbsTool = null;
+ if(rcbsTools != null)
+ rcbsTool = rcbsTools[0];
+ else if (create) {
+ rcbsTool = rcConfig.createTool(null,rcbsToolId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolName,false); //$NON-NLS-1$
+ rcbsTool.setCustomBuildStep(true);
+ IInputType rcbsToolInputType = rcbsTool.createInputType(null,rcbsToolInputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolInputTypeName,false); //$NON-NLS-1$
+ IAdditionalInput rcbsToolInputTypeAdditionalInput = rcbsToolInputType.createAdditionalInput(new String());
+ rcbsToolInputTypeAdditionalInput.setKind(IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY);
+ rcbsTool.createOutputType(null,rcbsToolOutputTypeId + "." + ManagedBuildManager.getRandomNumber(),rcbsToolOutputTypeName,false); //$NON-NLS-1$
}
-
- setDirty(false);
+ return rcbsTool;
+ }
+
+ private ITool[] getRcbsTools(IResourceConfiguration rcConfig){
+ List list = new ArrayList();
+ ITool tools[] = rcConfig.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ if (tool.getCustomBuildStep() && !tool.isExtensionElement()) {
+ list.add(tool);
+ }
}
+ if(list.size() != 0)
+ return (ITool[])list.toArray(new ITool[list.size()]);
+ return null;
+ }
public IPreferenceStore getPreferenceStore() {
return null;
@@ -553,5 +595,24 @@ public class ResourceCustomBuildStepBlock extends AbstractCOptionPage {
public boolean isDirty() {
return dirty;
}
+
+ public void setVisible(boolean visible){
+ if(visible)
+ setValues();
+ super.setVisible(visible);
+ }
+
+ public boolean containsDefaults(){
+ return containsDefaults(resParent.getCurrentResourceConfigClone());
+ }
+
+ protected boolean containsDefaults(IResourceConfiguration rcCfg){
+ ITool tools[] = getRcbsTools(rcCfg);
+
+ if(tools == null)
+ return true;
+
+ return false;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
index 58208cece9e..95ef2279bfe 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
@@ -17,21 +17,25 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
+import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
+import org.eclipse.cdt.managedbuilder.ui.properties.AbstractBuildPropertyPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionSettingsPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPreferencePage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildSettingsPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolSettingsPage;
-import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolsSettingsStore;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolSettingsPreferenceStore;
import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
import org.eclipse.cdt.managedbuilder.ui.properties.ToolListContentProvider;
import org.eclipse.cdt.managedbuilder.ui.properties.ToolListLabelProvider;
@@ -43,15 +47,13 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
@@ -62,7 +64,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
public class ToolsSettingsBlock extends AbstractCOptionPage {
@@ -90,8 +91,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
* Bookeeping variables
*/
private Map configToPageListMap;
- private BuildToolsSettingsStore settingsStore;
- private Map settingsStoreMap;
+ private BuildToolSettingsPreferenceStore settingsStore;
private BuildPropertyPage parent;
private ResourceBuildPropertyPage resParent;
private BuildSettingsPage currentSettingsPage;
@@ -99,6 +99,8 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
private ToolListContentProvider provider;
private ITool selectedTool;
private Object element;
+
+ private boolean defaultNeeded;
/**
* The minimum page size; 200 by 200 by default.
@@ -152,6 +154,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
this.parent = parent;
configToPageListMap = new HashMap();
this.element = element;
+ settingsStore = new BuildToolSettingsPreferenceStore(this);
}
public ToolsSettingsBlock(ResourceBuildPropertyPage resParent, Object element)
@@ -161,6 +164,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
this.resParent = resParent;
configToPageListMap = new HashMap();
this.element = element;
+ settingsStore = new BuildToolSettingsPreferenceStore(this);
}
public void createControl(Composite parent) {
@@ -232,11 +236,11 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
}
if (currentSettingsPage == null) {
if ( this.element instanceof IProject) {
- currentSettingsPage = new BuildOptionSettingsPage(parent.getSelectedConfiguration(), category);
+ currentSettingsPage = new BuildOptionSettingsPage(parent,parent.getSelectedConfigurationClone(), category);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(parent);
} else if ( this.element instanceof IFile) {
- currentSettingsPage = new BuildOptionSettingsPage(resParent.getCurrentResourceConfig(), category);
+ currentSettingsPage = new BuildOptionSettingsPage(resParent,resParent.getCurrentResourceConfigClone(), category);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(resParent);
}
@@ -254,18 +258,6 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
}
currentSettingsPage.setVisible(true);
- // save the last page build options.
- // If the last page is tool page then parse all the options
- // and put it in the appropriate preference store.
- if (oldPage != null && oldPage != currentSettingsPage){
- if(oldPage instanceof BuildOptionSettingsPage) {
- ((BuildOptionSettingsPage)oldPage).storeSettings();
- }
- else if(oldPage instanceof BuildToolSettingsPage) {
- ((BuildToolSettingsPage)oldPage).storeSettings();
- //((BuildToolSettingsPage)oldPage).parseAllOptions();
- }
- }
//update the field editors in the current page
if(currentSettingsPage instanceof BuildOptionSettingsPage)
((BuildOptionSettingsPage)currentSettingsPage).updateFields();
@@ -305,11 +297,13 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
}
if (currentSettingsPage == null) {
if ( this.element instanceof IProject) {
- currentSettingsPage = new BuildToolSettingsPage(parent.getSelectedConfiguration(), tool, obtainMacroProvider());
+ currentSettingsPage = new BuildToolSettingsPage(parent,
+ parent.getSelectedConfigurationClone(), tool);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(parent);
} else if(this.element instanceof IFile) {
- currentSettingsPage = new BuildToolSettingsPage(resParent.getCurrentResourceConfig(), tool, obtainMacroProvider());
+ currentSettingsPage = new BuildToolSettingsPage(resParent,
+ resParent.getCurrentResourceConfigClone(), tool);
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(resParent);
}
@@ -340,7 +334,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
}
// Update the field editor that displays all the build options
if(currentSettingsPage instanceof BuildToolSettingsPage)
- ((BuildToolSettingsPage)currentSettingsPage).updateAllOptionField();
+ ((BuildToolSettingsPage)currentSettingsPage).setValues();
if (oldPage != null && oldPage != currentSettingsPage)
oldPage.setVisible(false);
@@ -384,9 +378,12 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
}
public void setVisible(boolean visible){
- // Update the field editor that displays all the build options
- if(visible && currentSettingsPage instanceof BuildToolSettingsPage)
- ((BuildToolSettingsPage)currentSettingsPage).updateAllOptionField();
+ if(visible){
+ selectedCategory = null;
+ selectedTool = null;
+ handleOptionSelection();
+ }
+ super.setVisible(visible);
}
protected void setValues() {
@@ -401,32 +398,15 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
optionList.setContentProvider(provider);
}
if ( element instanceof IProject ) {
- config = parent.getSelectedConfiguration();
+ config = parent.getSelectedConfigurationClone();
optionList.setInput(config);
} else if ( element instanceof IFile){
- resConfig = resParent.getCurrentResourceConfig();
+ resConfig = resParent.getCurrentResourceConfigClone();
optionList.setInput(resConfig);
}
optionList.expandAll();
- // Create (or retrieve) the settings store for the configuration/resource configuration
- BuildToolsSettingsStore store = null;
- if ( element instanceof IProject ) {
- store = (BuildToolsSettingsStore) getSettingsStoreMap().get(parent.getSelectedConfiguration().getId());
- if (store == null) {
- store = new BuildToolsSettingsStore(parent.getSelectedConfiguration());
- getSettingsStoreMap().put(parent.getSelectedConfiguration().getId(), store);
- }
- } else if ( element instanceof IFile) {
- store = (BuildToolsSettingsStore) getSettingsStoreMap().get(resParent.getCurrentResourceConfig().getId());
- if (store == null) {
- store = new BuildToolsSettingsStore(resParent.getCurrentResourceConfig());
- getSettingsStoreMap().put(resParent.getCurrentResourceConfig().getId(), store);
- }
- }
- settingsStore = store;
-
// Determine what the selection in the tree should be
Object primary = null;
if (selectedTool != null) {
@@ -476,20 +456,25 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// Select the first tool in the list
Object[] elements = null;
if( element instanceof IProject){
- elements = provider.getElements(parent.getSelectedConfiguration());
+ elements = provider.getElements(parent.getSelectedConfigurationClone());
} else if ( element instanceof IFile) {
- elements = provider.getElements(resParent.getCurrentResourceConfig());
+ elements = provider.getElements(resParent.getCurrentResourceConfigClone());
}
primary = elements.length > 0 ? elements[0] : null;
}
if (primary != null) {
+ if(primary instanceof IOptionCategory){
+ if(resConfig != null)
+ settingsStore.setSelection(resConfig,(IOptionCategory)primary);
+ else
+ settingsStore.setSelection(config,(IOptionCategory)primary);
+ }
optionList.setSelection(new StructuredSelection(primary), true);
}
}
public void removeValues(String id) {
- getSettingsStoreMap().remove(id);
}
private void handleOptionSelection() {
@@ -498,6 +483,12 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// Set the option page based on the selection
Object element = selection.getFirstElement();
+ if(element instanceof IOptionCategory){
+ if(resParent != null)
+ settingsStore.setSelection(resParent.getCurrentResourceConfigClone(),(IOptionCategory)element);
+ else
+ settingsStore.setSelection(parent.getSelectedConfigurationClone(),(IOptionCategory)element);
+ }
if (element instanceof ITool) {
displayOptionsForTool((ITool)element);
} else if (element instanceof IOptionCategory) {
@@ -517,7 +508,9 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
ManagedBuildManager.performValueHandlerEvent(parent.getSelectedConfiguration(),
IManagedOptionValueHandler.EVENT_SETDEFAULT, false);
} else if ( element instanceof IFile) {
- ManagedBuildManager.performValueHandlerEvent(resParent.getCurrentResourceConfig(),
+ IResourceConfiguration rcCfg = resParent.getCurrentResourceConfig(false);
+ if(rcCfg != null)
+ ManagedBuildManager.performValueHandlerEvent(rcCfg,
IManagedOptionValueHandler.EVENT_SETDEFAULT);
}
}
@@ -532,6 +525,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
} else if ( element instanceof IFile) {
performDefaults( (IFile)element);
}
+ defaultNeeded = true;
return;
}
@@ -539,76 +533,41 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// TODO: Should this reset all tools of the configuration, or just
// the currently selected tool category? Right now it is all tools.
- // 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("BuildPropertyPage.defaults.title"), //$NON-NLS-1$
- ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.defaults.message")); //$NON-NLS-1$
- if (!shouldDefault) return;
-
- // Empty the page list
- List pages = getPagesForConfig();
- pages.clear();
// Get the build manager to reset build info for project
- ManagedBuildManager.resetConfiguration(parent.getProject(), parent.getSelectedConfiguration());
+ ManagedBuildManager.resetConfiguration(parent.getProject(), parent.getSelectedConfigurationClone());
+ ITool tools[] = parent.getSelectedConfigurationClone().getFilteredTools();
+ for( int i = 0; i < tools.length; i++ ){
+ if(!tools[i].getCustomBuildStep())
+ tools[i].setToolCommand(null);
+ }
- // Recreate the settings store for the configuration
- settingsStore = new BuildToolsSettingsStore(parent.getSelectedConfiguration());
-
- // Write out the build model info
- ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
-
- // Call an MBS CallBack function to inform that default settings have been applied.
- performSetDefaultsEventCallBack();
-
// Reset the category or tool selection and run selection event handler
selectedCategory = null;
selectedTool = null;
handleOptionSelection();
- setDirty(false);
+ setDirty(true);
}
public void performDefaults(IFile file) {
// TODO: Should this reset all options of the tool in current resource configuration, or just
// the currently selected tool category? Right now it is all options.
- // 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("ResourceBuildPropertyPage.defaults.title"), //$NON-NLS-1$
- ManagedBuilderUIMessages.getResourceString("ResourceBuildPropertyPage.defaults.message")); //$NON-NLS-1$
- if (!shouldDefault) return;
-
- // Empty the page list
- List pages = getPagesForConfig();
- pages.clear();
-
// Get the build manager to reset build info for project
- ManagedBuildManager.resetResourceConfiguration(resParent.getProject(), resParent.getCurrentResourceConfig());
-
- // Recreate the settings store for the configuration
- settingsStore = new BuildToolsSettingsStore(resParent.getCurrentResourceConfig());
-
- // Write out the build model info
- ManagedBuildManager.setDefaultConfiguration(resParent.getProject(), resParent.getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(resParent.getProject(), false);
-
- // Call an MBS CallBack function to inform that default settings have been applied.
- performSetDefaultsEventCallBack();
+ ManagedBuildManager.resetResourceConfiguration(resParent.getProject(), resParent.getCurrentResourceConfigClone());
+ ITool tools[] = resParent.getCurrentResourceConfigClone().getTools();
+ for( int i = 0; i < tools.length; i++ ){
+ if(!tools[i].getCustomBuildStep())
+ tools[i].setToolCommand(null);
+ }
// Reset the category or tool selection and run selection event handler
selectedCategory = null;
selectedTool = null;
handleOptionSelection();
- setDirty(false);
+ setDirty(true);
}
/*
@@ -617,30 +576,233 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
*/
public void performApply(IProgressMonitor monitor) throws CoreException {
- // Force each settings page to update
- List pages = getPagesForConfig();
- // Make sure we have something to work on
- if (pages == null) {
- // Nothing to do
+ if(element instanceof IFile)
+ resParent.getCurrentResourceConfig(true);
+
+ if(defaultNeeded){
+ if(element instanceof IFile)
+ ManagedBuildManager.resetResourceConfiguration(resParent.getProject(), resParent.getCurrentResourceConfig(true));
+ else
+ ManagedBuildManager.resetConfiguration(parent.getProject(), parent.getSelectedConfiguration());
+
+ performSetDefaultsEventCallBack();
+
+ defaultNeeded = false;
+ }
+ //some options might be changed that do not belong to the created pages,
+ //we need to save all options instead
+ saveAll();
+
+ setDirty(false);
+ }
+
+ private void saveAll(){
+ if(resParent != null)
+ saveResourceConfig();
+ else
+ saveConfig();
+ }
+
+ private void saveResourceConfig(){
+ IResourceConfiguration cloneRcCfg = resParent.getCurrentResourceConfigClone();
+
+ ITool tools[] = cloneRcCfg.getTools();
+
+ for(int i = 0; i < tools.length; i++){
+ saveHoldsOptions(tools[i]);
+ }
+ }
+
+ private void saveHoldsOptions(IHoldsOptions holder){
+ if(holder instanceof ITool && ((ITool)holder).getCustomBuildStep())
return;
+ AbstractBuildPropertyPage page = resParent != null ?
+ (AbstractBuildPropertyPage)resParent : (AbstractBuildPropertyPage)parent;
+
+ IHoldsOptions realHo = page.getRealHoldsOptions(holder);
+
+ if(realHo != null){
+ if(holder instanceof ITool)
+ ((ITool)realHo).setToolCommand(((ITool)holder).getToolCommand());
+
+ IOption options[] = holder.getOptions();
+ for(int i = 0; i < options.length; i++){
+ saveOption(options[i], holder);
+ }
}
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildSettingsPage page = (BuildSettingsPage) iter.next();
- if (page == null) continue;
- if (page instanceof BuildToolSettingsPage) {
- // if the currentsettings page is not the tool settings page
- // then update the all build options field editor based on the
- // build options in other options settings page.
- if (!(currentSettingsPage instanceof BuildToolSettingsPage))
- ((BuildToolSettingsPage)page).updateAllOptionField();
- ((BuildToolSettingsPage)page).performOk();
- } else if (page instanceof BuildOptionSettingsPage) {
- ((BuildOptionSettingsPage)page).performOk();
+ }
+ private void saveOption(IOption clonedOption, IHoldsOptions cloneHolder){
+ IConfiguration realCfg = null;
+ IResourceConfiguration realRcCfg = null;
+ IBuildObject handler = null;
+ IOption realOption;
+ IHoldsOptions realHolder;
+
+ if(resParent != null){
+ realOption = resParent.getRealOption(clonedOption,cloneHolder);
+ realHolder = resParent.getRealHoldsOptions(cloneHolder);
+ realRcCfg = (IResourceConfiguration)((ITool)realHolder).getParent();
+ realCfg = realRcCfg.getParent();
+ handler = realRcCfg;
+ } else {
+ realOption = parent.getRealOption(clonedOption,cloneHolder);
+ realHolder = parent.getRealHoldsOptions(cloneHolder);
+ realCfg = parent.getConfigurationFromHoldsOptions(realHolder);
+ handler = realCfg;
+ }
+
+ try {
+ // Transfer value from preference store to options
+ IOption setOption = null;
+ switch (clonedOption.getValueType()) {
+ case IOption.BOOLEAN :
+ boolean boolVal = clonedOption.getBooleanValue();
+ if(realRcCfg != null) {
+ setOption = ManagedBuildManager.setOption(realRcCfg, realHolder, realOption, boolVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption, boolVal);
+ }
+ // Reset the preference store since the Id may have changed
+// if (setOption != option) {
+// getToolSettingsPreferenceStore().setValue(setOption.getId(), boolVal);
+// FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+// fe.setPreferenceName(setOption.getId());
+// }
+ break;
+ case IOption.ENUMERATED :
+ String enumVal = clonedOption.getStringValue();
+ String enumId = clonedOption.getEnumeratedId(enumVal);
+ if(realRcCfg != null) {
+ setOption = ManagedBuildManager.setOption(realRcCfg, realHolder, realOption,
+ (enumId != null && enumId.length() > 0) ? enumId : enumVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption,
+ (enumId != null && enumId.length() > 0) ? enumId : enumVal);
+ }
+ // Reset the preference store since the Id may have changed
+// if (setOption != option) {
+// getToolSettingsPreferenceStore().setValue(setOption.getId(), enumVal);
+// FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+// fe.setPreferenceName(setOption.getId());
+// }
+ break;
+ case IOption.STRING :
+ String strVal = clonedOption.getStringValue();
+ if(realRcCfg != null){
+ setOption = ManagedBuildManager.setOption(realRcCfg, realHolder, realOption, strVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption, strVal);
+ }
+
+ // Reset the preference store since the Id may have changed
+// if (setOption != option) {
+// getToolSettingsPreferenceStore().setValue(setOption.getId(), strVal);
+// FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+// fe.setPreferenceName(setOption.getId());
+// }
+ break;
+ case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ case IOption.OBJECTS :
+ String[] listVal = (String[])((List)clonedOption.getValue()).toArray(new String[0]);
+ if( realRcCfg != null){
+ setOption = ManagedBuildManager.setOption(realRcCfg, realHolder, realOption, listVal);
+ }else {
+ setOption = ManagedBuildManager.setOption(realCfg, realHolder, realOption, listVal);
+ }
+
+ // Reset the preference store since the Id may have changed
+// if (setOption != option) {
+// getToolSettingsPreferenceStore().setValue(setOption.getId(), listStr);
+// FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+// fe.setPreferenceName(setOption.getId());
+// }
+ break;
+ default :
+ break;
}
+
+ // Call an MBS CallBack function to inform that Settings related to Apply/OK button
+ // press have been applied.
+ if (setOption == null)
+ setOption = realOption;
+
+ if (setOption.getValueHandler().handleValue(
+ handler,
+ setOption.getOptionHolder(),
+ setOption,
+ setOption.getValueHandlerExtraArgument(),
+ IManagedOptionValueHandler.EVENT_APPLY)) {
+ // TODO : Event is handled successfully and returned true.
+ // May need to do something here say log a message.
+ } else {
+ // Event handling Failed.
+ }
+ } catch (BuildException e) {
+ } catch (ClassCastException e) {
}
+
+ }
+
+ private void saveConfig(){
+ IConfiguration cfg = parent.getSelectedConfigurationClone();
- setDirty(false);
+ IToolChain tc = cfg.getToolChain();
+ saveHoldsOptions(tc);
+
+ ITool tools[] = tc.getTools();
+ for(int i = 0; i < tools.length; i++){
+ saveHoldsOptions(tools[i]);
+ }
+ }
+
+ public boolean containsDefaults(){
+ if(resParent == null)
+ return false;
+ return containsDefaults(resParent.getCurrentResourceConfigClone());
+ }
+
+ protected boolean containsDefaults(IResourceConfiguration rcCfg){
+ IConfiguration cfg = rcCfg.getParent();
+ ITool tools[] = rcCfg.getTools();
+ for(int i = 0; i < tools.length; i++){
+ ITool tool = tools[i];
+ if(!tool.getCustomBuildStep()){
+ IOption options[] = tool.getOptions();
+ for( int j = 0; j < options.length; j++){
+ IOption option = options[j];
+ if(option.getParent() == tool){
+ IOption ext = option;
+ do{
+ if(ext.isExtensionElement())
+ break;
+ } while((ext = ext.getSuperClass()) != null);
+
+ if(ext != null){
+ ITool cfgTool = cfg.getToolChain().getTool(tool.getSuperClass().getId());
+ if(cfgTool != null){
+ IOption defaultOpt = cfgTool.getOptionBySuperClassId(ext.getId());
+ try {
+ if(defaultOpt != null && defaultOpt.getValueType() == option.getValueType()){
+ Object value = option.getValue();
+ Object defaultVal = defaultOpt.getValue();
+
+ if(value.equals(defaultVal))
+ continue;
+ //TODO: check list also
+ }
+ }catch (BuildException e) {
+ }
+ }
+ }
+ return false;
+ }
+ }
+ }
+ }
+ return true;
}
/* (non-Javadoc)
@@ -651,44 +813,32 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
List pages = null;
if ( element instanceof IProject) {
// Make sure that something was selected
- if (parent.getSelectedConfiguration() == null) {
+ if (parent.getSelectedConfigurationClone() == null) {
return null;
}
- pages = (List) configToPageListMap.get(parent.getSelectedConfiguration().getId());
+ pages = (List) configToPageListMap.get(parent.getSelectedConfigurationClone().getId());
} else if (element instanceof IFile) {
- if ( resParent.getCurrentResourceConfig() == null ) {
+ if ( resParent.getCurrentResourceConfigClone() == null ) {
return null;
}
- pages = (List) configToPageListMap.get(resParent.getCurrentResourceConfig().getId());
+ pages = (List) configToPageListMap.get(resParent.getCurrentResourceConfigClone().getId());
}
if (pages == null) {
pages = new ArrayList();
if ( element instanceof IProject) {
- configToPageListMap.put(parent.getSelectedConfiguration().getId(), pages);
+ configToPageListMap.put(parent.getSelectedConfigurationClone().getId(), pages);
} else if ( element instanceof IFile) {
- configToPageListMap.put(resParent.getCurrentResourceConfig().getId(), pages);
+ configToPageListMap.put(resParent.getCurrentResourceConfigClone().getId(), pages);
}
}
return pages;
}
- public IPreferenceStore getPreferenceStore() {
+ public BuildToolSettingsPreferenceStore getPreferenceStore() {
return settingsStore;
}
- /* (non-Javadoc)
- * Safe accessor method
- *
- * @return Returns the Map of configurations to preference stores.
- */
- protected Map getSettingsStoreMap() {
- if (settingsStoreMap == null) {
- settingsStoreMap = new HashMap();
- }
- return settingsStoreMap;
- }
-
/**
* Sets the "dirty" state
*/
@@ -736,7 +886,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
* the user-modified macros that are not applied yet
* If the "Build Macros" tab is not available, returns the default BuildMacroProvider
*/
- protected BuildMacroProvider obtainMacroProvider(){
+ public BuildMacroProvider obtainMacroProvider(){
ICOptionContainer container = getContainer();
ManagedBuildOptionBlock optionBlock = null;
if(container instanceof BuildPropertyPage){

Back to the top