diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 572730ff419..9da856c4818 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -57,6 +57,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; @@ -81,6 +82,8 @@ import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator; import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages; import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; +import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration; +import org.eclipse.cdt.managedbuilder.internal.core.MultiResourceInfo; import org.eclipse.cdt.managedbuilder.internal.core.Option; import org.eclipse.cdt.managedbuilder.internal.core.OptionCategory; import org.eclipse.cdt.managedbuilder.internal.core.OutputType; @@ -3892,6 +3895,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI private static IConfiguration getConfigurationForDescription(ICConfigurationDescription cfgDes, boolean checkConsistance){ if(cfgDes == null) return null; + + if (cfgDes instanceof ICMultiConfigDescription) { + ICMultiConfigDescription mcd = (ICMultiConfigDescription)cfgDes; + ICConfigurationDescription[] cfds = (ICConfigurationDescription[])mcd.getItems(); + return new MultiConfiguration(cfds, mcd.getStringListMode()); + } + CConfigurationData cfgData = cfgDes.getConfigurationData(); if(cfgData instanceof BuildConfigurationData){ IConfiguration cfg = ((BuildConfigurationData)cfgData).getConfiguration(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java index f7e6d1d5c06..3f8d117698b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel 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 @@ -10,9 +10,11 @@ *******************************************************************************/ package org.eclipse.cdt.managedbuilder.internal.core; +import java.util.ArrayList; import java.util.Arrays; import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICSourceEntry; import org.eclipse.cdt.core.settings.model.MultiItemsHolder; import org.eclipse.cdt.core.settings.model.extension.CBuildData; @@ -35,6 +37,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration; import org.eclipse.cdt.managedbuilder.core.IResourceInfo; 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.envvar.IConfigurationEnvironmentVariableSupplier; import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier; import org.eclipse.core.resources.IFile; @@ -44,8 +47,8 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.PluginVersionIdentifier; /** - * - * + * This class represents a set of configurations + * to be edited simultaneously on property pages. */ public class MultiConfiguration extends MultiItemsHolder implements IMultiConfiguration { @@ -58,6 +61,18 @@ public class MultiConfiguration extends MultiItemsHolder implements setStringListMode(mode); } + public MultiConfiguration(ICConfigurationDescription[] cfds, int mode) { + this(cfds2cfs(cfds),mode); + } + + public static IConfiguration[] cfds2cfs(ICConfigurationDescription[] cfgds) { + IConfiguration[] cfs = new IConfiguration[cfgds.length]; + for (int i=0; i 0) ? enumId : enumVal); - // Reset the preference store since the Id may have changed -// if (setOption != option) { -// getToolSettingsPrefStore().setValue(setOption.getId(), enumVal); -// } - break; - case IOption.STRING : - String strVal = clonedOption.getStringValue(); -// setOption = ManagedBuildManager.setOption(realCfg, realTool, realOption, strVal); - // Reset the preference store since the Id may have changed -// if (setOption != option) { -// getToolSettingsPrefStore().setValue(setOption.getId(), strVal); -// } - break; - case IOption.STRING_LIST : - case IOption.INCLUDE_PATH : - case IOption.PREPROCESSOR_SYMBOLS : - case IOption.LIBRARIES : - case IOption.OBJECTS : -// String listStr = getToolSettingsPreferenceStore().getString(option.getId()); - String[] listVal = (String[])((List)clonedOption.getValue()).toArray(new String[0]); -// setOption = ManagedBuildManager.setOption(realCfg, realTool, realOption, listVal); - // Reset the preference store since the Id may have changed -// if (setOption != option) { -// getToolSettingsPreferenceStore().setValue(setOption.getId(), listStr); -// } - 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) { - } - } - - // Save the tool command if it has changed - // Get the actual value out of the field editor - String command = clonedTool.getToolCommand(); - if (command.length() > 0 && - (!command.equals(tool.getToolCommand()))) { - -// if ( isItResourceConfigPage ) { -// ManagedBuildManager.setToolCommand(realRcCfg, tool, command); -// } else { -// ManagedBuildManager.setToolCommand(realCfg, tool, command); -// } - - } - - // Save the tool command line pattern if it has changed - // Get the actual value out of the field editor - String commandLinePattern = clonedTool.getCommandLinePattern(); - if (commandLinePattern.length() > 0 && - (!commandLinePattern.equals(tool.getCommandLinePattern()))) { - tool.setCommandLinePattern(commandLinePattern); - } - */ - - return result; + return super.performOk(); } /** @@ -603,12 +493,23 @@ public class BuildToolSettingUI extends AbstractToolSettingUI { // allow superclass to handle as well super.propertyChange(event); - if(event.getSource() == commandStringField){ - fTool.setToolCommand(commandStringField.getStringValue()); - updateFields(); - } - else if(event.getSource() == commandLinePatternField){ - fTool.setCommandLinePattern(commandLinePatternField.getStringValue()); + if (fInfo instanceof MultiResourceInfo) { + MultiResourceInfo mri = (MultiResourceInfo)fInfo; + if(event.getSource() == commandStringField){ + mri.setToolsCommand(fTool, commandStringField.getStringValue()); + updateFields(); + } + else if(event.getSource() == commandLinePatternField){ + mri.setCommandLinePattern(fTool, commandLinePatternField.getStringValue()); + } + } else { + if(event.getSource() == commandStringField){ + fTool.setToolCommand(commandStringField.getStringValue()); + updateFields(); + } + else if(event.getSource() == commandLinePatternField){ + fTool.setCommandLinePattern(commandLinePatternField.getStringValue()); + } } } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java index e3b4b5fc92f..8480220cc12 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel 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 @@ -28,6 +28,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration; import org.eclipse.cdt.managedbuilder.core.IResourceInfo; import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration; import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider; import org.eclipse.cdt.ui.newui.AbstractPage; import org.eclipse.cdt.ui.newui.PageLayout; @@ -592,14 +593,9 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe } public void updateData(ICResourceDescription cfgd) { - if (page.isMultiCfg()) { - usercomp.setVisible(false); - } else { - usercomp.setVisible(true); fInfo = getResCfg(cfgd); setValues(); handleOptionSelection(); - } } protected void performApply(ICResourceDescription src, ICResourceDescription dst) { @@ -626,8 +622,10 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe public void updateTitle() {} public boolean canBeVisible() { - if (page.isMultiCfg()) - return false; - return getCfg().getBuilder().isManagedBuildOn(); + IConfiguration cfg = getCfg(); + if (cfg instanceof MultiConfiguration) + return ((MultiConfiguration)cfg).isManagedBuildOn(); + else + return cfg.getBuilder().isManagedBuildOn(); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java index 4621d54ea26..7e45991941b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/MultiResourceDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel 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 @@ -52,7 +52,7 @@ public class MultiResourceDescription extends MultiItemsHolder implements ICMult * @see org.eclipse.cdt.core.settings.model.ICResourceDescription#getParentFolderDescription() */ public ICFolderDescription getParentFolderDescription() { - System.out.println("Bad multi access: MultiResourceDescription.getParentFolderDescription()"); + System.out.println("Bad multi access: MultiResourceDescription.getParentFolderDescription()"); //$NON-NLS-1$ throw new UnsupportedOperationException(); } @@ -60,7 +60,13 @@ public class MultiResourceDescription extends MultiItemsHolder implements ICMult * @see org.eclipse.cdt.core.settings.model.ICResourceDescription#getPath() */ public IPath getPath() { - System.out.println("Bad multi access: MultiResourceDescription.getPath()"); + IPath p = fRess[0].getPath(); + if (p != null) { + for (int i=1; i= cfgDescs.length) { - ICConfigurationDescription[] multiCfgs = null; // selected multi cfg if ((selectionIndex - cfgDescs.length) == 0) { // all multiCfgs = cfgDescs; cfgIndex = selectionIndex; - } else { - ICConfigurationDescription[] mcfgs = ConfigMultiSelectionDialog.select(cfgDescs); - if (mcfgs == null || mcfgs.length == 0) { - // return back to previous selection - if (cfgIndex > configSelector.getItemCount()) { - cfgIndex = 0; - configSelector.select(0); - cfgChanged(cfgDescs[0]); - } else { - configSelector.select(cfgIndex); + } else { // multiple + if (cfgIndex != selectionIndex) { // to avoid re-request on page change + ICConfigurationDescription[] mcfgs = ConfigMultiSelectionDialog.select(cfgDescs); + if (mcfgs == null || mcfgs.length == 0) { + // return back to previous selection + if (cfgIndex > configSelector.getItemCount()) { + cfgIndex = 0; + configSelector.select(0); + cfgChanged(cfgDescs[0]); + } else { + configSelector.select(cfgIndex); + } + return; } - return; + multiCfgs = mcfgs; + cfgIndex = selectionIndex; } - multiCfgs = mcfgs; } // TODO: avoid repeated update like for single cfg cfgChanged(MultiItemsHolder.createCDescription(multiCfgs, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java index 513b7d626b4..a4d8a017d34 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/BinaryParsTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel 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 @@ -39,6 +39,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CoreModelUtil; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICMultiResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; import org.eclipse.cdt.ui.CUIPlugin; @@ -300,9 +301,13 @@ public class BinaryParsTab extends AbstractCPropertyTab { } public void performApply(ICResourceDescription src, ICResourceDescription dst) { + if (page.isMultiCfg()) { + src = ((ICResourceDescription[])((ICMultiResourceDescription)src).getItems())[0]; + dst = ((ICResourceDescription[])((ICMultiResourceDescription)dst).getItems())[0]; + } ICTargetPlatformSetting tps1 = src.getConfiguration().getTargetPlatformSetting(); ICTargetPlatformSetting tps2 = dst.getConfiguration().getTargetPlatformSetting(); - if (tps1 != null && tps2 != null) { // temporary + if (tps1 != null && tps2 != null) { tps2.setBinaryParserIds(tps1.getBinaryParserIds()); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ConfigMultiSelectionDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ConfigMultiSelectionDialog.java index daad8c9acf9..cb4bc28cca2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ConfigMultiSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ConfigMultiSelectionDialog.java @@ -40,12 +40,13 @@ public class ConfigMultiSelectionDialog extends Dialog { private CheckboxTableViewer tv; private Button b_ok; private Label message; + private static ICConfigurationDescription[] result = null; public static ICConfigurationDescription[] select(ICConfigurationDescription[] _cfgds) { cfgds = _cfgds; ConfigMultiSelectionDialog d = new ConfigMultiSelectionDialog(CUIPlugin.getActiveWorkbenchShell()); if (d.open() == OK) - return (ICConfigurationDescription[])d.tv.getCheckedElements(); + return result; return null; } @@ -104,6 +105,12 @@ public class ConfigMultiSelectionDialog extends Dialog { boolean enabled = (tv.getCheckedElements().length > 1); if (b_ok != null) b_ok.setEnabled(enabled); message.setVisible(!enabled); + if (enabled) { + Object[] ob = tv.getCheckedElements(); + result = new ICConfigurationDescription[ob.length]; + System.arraycopy(ob, 0, result, 0, ob.length); + } else + result = null; }}); tv.setLabelProvider(new ITableLabelProvider() { public Image getColumnImage(Object element, int columnIndex) { return null; }