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 9da856c4818..b1761380717 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 @@ -1102,7 +1102,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI try { // Request a value change and set dirty if real change results retOpt = resConfig.setOption(holder, option, value); - if (retOpt.getValueHandler().handleValue( + if (retOpt != null && retOpt.getValueHandler().handleValue( resConfig, holder, retOpt, 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 3f8d117698b..9c7867558c8 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 @@ -55,10 +55,16 @@ public class MultiConfiguration extends MultiItemsHolder implements private static final String[] EMPTY_STR_ARRAY = new String[0]; protected IConfiguration[] fCfgs = null; + private int curr = 0; public MultiConfiguration(IConfiguration[] cfs, int mode) { fCfgs = cfs; setStringListMode(mode); + for (int i=0; i 1) + ms[i] = (ITool)new MultiTool(lst, curr); + else + ms[i] = ts[i]; + } + */ + return ts; } /* (non-Javadoc) @@ -551,7 +585,7 @@ public class MultiConfiguration extends MultiItemsHolder implements IResourceInfo ris[] = new IResourceInfo[fCfgs.length]; for (int i=0; i 0) { + id = id.substring(0, n); + option = getToolSettingsPrefStore().getOption(id); + } + } if(option != null){ changedOption = (IOption)option[1]; @@ -560,4 +606,65 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI { ((BuildOptionComboFieldEditor)fieldEditor).setOptions(enumValidNames); fieldEditor.load(); } + + /** + * + * + * + */ + class TriStateBooleanFieldEditor extends BooleanFieldEditor { + protected Button button = null; + protected IHoldsOptions[] holders = null; + private boolean enable3 = true; + protected int current = 0; + public TriStateBooleanFieldEditor(String name, String labelText, String tooltip, Composite parent, String contextId, IHoldsOptions[] ho, int curr) { + super(name, labelText, parent); + holders = ho; + current = curr; + button = (Button)getChangeControl(parent); + button.setToolTipText(tooltip); + if (!contextId.equals(AbstractPage.EMPTY_STR)) PlatformUI.getWorkbench().getHelpSystem().setHelp(button, contextId); + + } + protected void valueChanged(boolean oldValue, boolean newValue) { + if (button.getGrayed()) + button.setGrayed(false); + super.valueChanged(!newValue, newValue); + } + protected void doLoad() { + if (enable3 && holders != null && button != null) { + String id = getPreferenceName(); + IOption op = holders[current].getOptionById(id); + if (op != null) { + if (op.getSuperClass() != null) + id = op.getSuperClass().getId(); + int[] vals = new int[2]; + for (int i=0; i 0) { + value = true; + if (vals[0] > 0) + gray = true; + } + button.setGrayed(gray); + button.setSelection(value); + return; + } + } + super.doLoad(); // default case + } + + void set3(boolean state) { + enable3 = state; + } + } + + } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuilderSettingsTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuilderSettingsTab.java index 9b21002522c..5815112fb98 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuilderSettingsTab.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuilderSettingsTab.java @@ -19,7 +19,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.Builder; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; -import org.eclipse.cdt.ui.newui.TriButton; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -41,12 +40,12 @@ import org.eclipse.swt.widgets.Widget; public class BuilderSettingsTab extends AbstractCBuildPropertyTab { // Widgets //1 - private TriButton b_useDefault; + private Button b_useDefault; private Combo c_builderType; private Text t_buildCmd; //2 - private TriButton b_genMakefileAuto; - private TriButton b_expandVars; + private Button b_genMakefileAuto; + private Button b_expandVars; //5 private Text t_dir; private Button b_dirWsp; @@ -74,7 +73,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { updateButtons(); }}); - b_useDefault = setupTri(g1, Messages.getString("BuilderSettingsTab.4"), 3, GridData.BEGINNING); //$NON-NLS-1$ + b_useDefault = setupCheck(g1, Messages.getString("BuilderSettingsTab.4"), 3, GridData.BEGINNING); //$NON-NLS-1$ setupLabel(g1, Messages.getString("BuilderSettingsTab.5"), 1, GridData.BEGINNING); //$NON-NLS-1$ t_buildCmd = setupBlock(g1, b_useDefault); @@ -93,8 +92,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { Group g2 = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.6"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$ ((GridLayout)(g2.getLayout())).makeColumnsEqualWidth = true; - b_genMakefileAuto = setupTri(g2, Messages.getString("BuilderSettingsTab.7"), 1, GridData.BEGINNING); //$NON-NLS-1$ - b_expandVars = setupTri(g2, Messages.getString("BuilderSettingsTab.8"), 1, GridData.BEGINNING); //$NON-NLS-1$ + b_genMakefileAuto = setupCheck(g2, Messages.getString("BuilderSettingsTab.7"), 1, GridData.BEGINNING); //$NON-NLS-1$ + b_expandVars = setupCheck(g2, Messages.getString("BuilderSettingsTab.8"), 1, GridData.BEGINNING); //$NON-NLS-1$ // Build location group group_dir = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.21"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$ @@ -131,8 +130,11 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { b_genMakefileAuto.setEnabled(icfg.supportsBuild(true)); if (extStates == null) { // no extended states available + b_genMakefileAuto.setGrayed(false); b_genMakefileAuto.setSelection(bldr.isManagedBuildOn()); + b_useDefault.setGrayed(false); b_useDefault.setSelection(bldr.isDefaultBuildCmd()); + b_expandVars.setGrayed(false); if(!bldr.canKeepEnvironmentVariablesInBuildfile()) b_expandVars.setEnabled(false); else { @@ -140,13 +142,13 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { b_expandVars.setSelection(!bldr.keepEnvironmentVariablesInBuildfile()); } } else { - b_genMakefileAuto.setTriSelection(extStates[0]); - b_useDefault.setTriSelection(extStates[1]); - if(extStates[2] != TriButton.YES) + BuildBehaviourTab.setTriSelection(b_genMakefileAuto, extStates[0]); + BuildBehaviourTab.setTriSelection(b_useDefault, extStates[1]); + if(extStates[2] != BuildBehaviourTab.TRI_YES) b_expandVars.setEnabled(false); else { b_expandVars.setEnabled(true); - b_expandVars.setTriSelection(extStates[3]); + BuildBehaviourTab.setTriSelection(b_expandVars, extStates[3]); } } c_builderType.select(isInternalBuilderEnabled() ? 1 : 0); @@ -174,7 +176,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { ((Control)t_buildCmd.getData()).setEnabled(external & ! b_useDefault.getSelection()); b_genMakefileAuto.setEnabled(external && icfg.supportsBuild(true)); - b_expandVars.setEnabled(external && b_genMakefileAuto.getSelection()); + if (b_expandVars.getEnabled()) + b_expandVars.setEnabled(external && b_genMakefileAuto.getSelection()); if (external) { checkPressed(b_useDefault); @@ -243,7 +246,6 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab { boolean val = false; if (b instanceof Button) val = ((Button)b).getSelection(); - else if (b instanceof TriButton) val = ((TriButton)b).getSelection(); if (b.getData() instanceof Text) { Text t = (Text)b.getData(); 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 8480220cc12..5b41101ab50 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 @@ -168,7 +168,11 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe } } if (currentSettingsPage == null) { - currentSettingsPage = new BuildOptionSettingsUI(this, fInfo, optionHolder, category); + currentSettingsPage = new BuildOptionSettingsUI( + this, + fInfo, + optionHolder, + category); pages.add(currentSettingsPage); currentSettingsPage.setContainer(this); if (currentSettingsPage.getControl() == null) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java index 2a71abf9aca..a34f29256c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java @@ -91,8 +91,9 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { public static final String WORKSPACE_FILE_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.file.dlg.err"); //$NON-NLS-1$ public static final String WORKSPACE_DIR_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$ - // use 3-state buttons in property pages - protected final boolean USE_TRI_STATE = CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI) && CDTPrefUtil.getBool(CDTPrefUtil.KEY_3STATE); + public static final int TRI_UNKNOWN = 2; + public static final int TRI_YES = 1; + public static final int TRI_NO = 0; protected Composite usercomp; // space where user can create widgets protected Composite buttoncomp; // space for buttons on the right @@ -321,17 +322,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { setupControl(b, span, mode); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { - checkPressed(event); - }}); - return b; - } - - protected TriButton setupTri(Composite c, String name, int span, int mode) { - TriButton b = new TriButton(c, 0, USE_TRI_STATE); - b.setText(name); - setupControl(b, span, mode); - b.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { + ((Button)event.widget).setGrayed(false); checkPressed(event); }}); return b; @@ -535,5 +526,23 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { return fFontMetrics; } + public static void setTriSelection(Button b, int state) { + switch (state) { + case TRI_NO: + b.setGrayed(false); + b.setSelection(false); + break; + case TRI_YES: + b.setGrayed(false); + b.setSelection(true); + break; + case TRI_UNKNOWN: + b.setSelection(true); + b.setGrayed(true); + break; + } + } + + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java index 6cea040709e..87b3ed41e62 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CDTPrefUtil.java @@ -24,7 +24,6 @@ public class CDTPrefUtil { public static final String KEY_OTHERS = "wizard.group.others.enable"; //$NON-NLS-1$ public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$ public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$ - public static final String KEY_3STATE = "properties.multi.3state.enable"; //$NON-NLS-1$ public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$ public static final String KEY_NOTOOLM = "properties.toolchain.modification.disable"; //$NON-NLS-1$ public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties index d5eb17fbcad..dc0da1a4fe8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties @@ -338,6 +338,17 @@ ProjectConvert.noConverterErrordialog.title=Project Conversion Error ProjectConvert.noConverterErrordialog.message=There are no converters available to convert the project {0} . ProjectConvert.title=Project Converters for {0} +PropertyMultiCfgTab.0=* This functionality is experimental * +PropertyMultiCfgTab.1=Enable multiple configurations setting +PropertyMultiCfgTab.10=Add/remove/change affected elements, do not touch others +PropertyMultiCfgTab.11=Replace existing string lists with string list shown to user +PropertyMultiCfgTab.3=String list Display mode +PropertyMultiCfgTab.4=Define how string lists from different configurations\nshould be combined for display, when lists are not equal +PropertyMultiCfgTab.5=Show empty list +PropertyMultiCfgTab.6=Show common elements (conjunction) +PropertyMultiCfgTab.7=Show all elements except doubles (disjunction) +PropertyMultiCfgTab.8=String list Write mode +PropertyMultiCfgTab.9=Define how to save changes in string lists \nfor different configurations PropertyPageDefsTab.0=Show button PropertyPageDefsTab.1=Display "Data hierarchy" tab PropertyPageDefsTab.10=Display "Export settings" tab diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/TriButton.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/TriButton.java deleted file mode 100644 index e6011ad9045..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/TriButton.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Intel Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.newui; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; - -public class TriButton extends Composite implements SelectionListener { - private static final String[] ITEMS = {"No", "Yes"}; //$NON-NLS-1$ //$NON-NLS-2$ - private static final String QMARK = "?"; //$NON-NLS-1$ - - public static final int NO = 0; - public static final int YES = 1; - public static final int UNKNOWN = 2; - - private boolean triMode = false; - private Button button = null; - private Combo combo = null; - private Label label = null; - private List listeners = new LinkedList(); - - public TriButton(Composite parent, int style) { - this(parent, style, true); - } - - public TriButton(Composite parent, int style, boolean _triMode) { - super(parent, style); - triMode = _triMode; - if (triMode) { - setLayout(new GridLayout(2, false)); - combo = new Combo(this, style | SWT.READ_ONLY | SWT.DROP_DOWN); - combo.setLayoutData(new GridData(GridData.BEGINNING)); - combo.setItems(ITEMS); - combo.addSelectionListener(this); - label = new Label(this, SWT.NONE); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - label.addMouseListener(new MouseListener() { - public void mouseDoubleClick(MouseEvent e) {} - public void mouseDown(MouseEvent e) {} - public void mouseUp(MouseEvent e) { - processMouseUp(e); - }}); - } else { - setLayout(new GridLayout()); - button = new Button(this, style | SWT.CHECK); - button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - button.addSelectionListener(this); - } - } - - public String getText () { - return triMode ? label.getText() : button.getText(); - } - public void setText (String string) { - if (triMode) label.setText(string); - else button.setText(string); - } - - public String getToolTipText () { - return triMode ? label.getToolTipText() : button.getToolTipText(); - } - public void setToolTipText (String string) { - if (triMode) { - label.setToolTipText(string); - combo.setToolTipText(string); - } else button.setToolTipText(string); - } - - public boolean getSelection () { - return triMode ? (combo.getSelectionIndex() == YES) : button.getSelection(); - } - public void setSelection (boolean selected) { - if (triMode) combo.select(selected ? YES : NO); - else button.setSelection(selected); - } - - public int getTriSelection () { - return triMode ? combo.getSelectionIndex(): (button.getSelection() ? YES : NO); - } - public void setTriSelection(int selection) { - if (selection != NO && - selection != YES && - selection != UNKNOWN) - selection = NO; - if (triMode) { - if (selection == UNKNOWN) { - combo.setText(QMARK); - combo.select(-1); - } else - combo.select(selection); - } - else button.setSelection(selection == 1); - } - - public int getAlignment () { - return triMode ? label.getAlignment() : button.getAlignment(); - } - public void setAlignment (int alignment) { - if (triMode) label.setAlignment(alignment); - else button.setAlignment(alignment); - } - - public Image getImage () { - return triMode ? label.getImage() : button.getImage(); - } - public void setImage (Image image) { - if (triMode) label.setImage(image); - else button.setImage(image); - } - - public void setEnabled(boolean enabled) { - if (triMode) { - label.setEnabled(enabled); - combo.setEnabled(enabled); - } else button.setEnabled(enabled); - } - - public void addSelectionListener (SelectionListener listener) { - listeners.add(listener); - } - public void removeSelectionListener (SelectionListener listener) { - listeners.remove(listener); - } - - public void widgetDefaultSelected(SelectionEvent e) { - e.widget = this; - Iterator it = listeners.iterator(); - while (it.hasNext()) - ((SelectionListener)it.next()).widgetDefaultSelected(e); - } - public void widgetSelected(SelectionEvent e) { - e.widget = this; - Iterator it = listeners.iterator(); - while (it.hasNext()) - ((SelectionListener)it.next()).widgetSelected(e); - } - - private void processMouseUp(MouseEvent me) { - int x = combo.getSelectionIndex() + 1; - if (x < 0 || x > 2) x = 0; - combo.select(x); - - Event e = new Event(); - e.button = me.button; - e.count = me.count; - e.data = me.data; - e.display = me.display; - e.stateMask = me.stateMask; - e.time = me.time; - e.x = me.x; - e.y = me.y; - e.type = SWT.Selection; - e.doit = true; - e.item = this; - e.widget = this; - SelectionEvent se = new SelectionEvent(e); - widgetSelected(se); - } - - public boolean in3mode() { - return triMode; - } -}