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

Bug 406545 - Restore Defaults/Apply buttons disappear in [All

configurations] mode from Project Properties

Change-Id: Iac29cd3f6d3b06bf2baae8c3bbc16cbff9c73d2e
Signed-off-by: Serge Beauchamp <sergebeauchamp@mac.com>
Reviewed-on: https://git.eclipse.org/r/16770
Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com>
IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com>
Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
This commit is contained in:
Serge Beauchamp 2013-09-25 17:08:47 +01:00 committed by Andrew Gvozdev
parent 15b11f611a
commit 02b96302a7
8 changed files with 132 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2011, 2012 IBM Corporation and others. * Copyright (c) 2011, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties; package org.eclipse.cdt.managedbuilder.ui.properties;
@ -530,6 +531,14 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
} }
/**
* @since 8.2
*/
@Override
public boolean canSupportMultiCfg() {
return false;
}
@Override @Override
protected void updateButtons() { protected void updateButtons() {
TreeItem[] sel = fTree.getTree().getSelection(); TreeItem[] sel = fTree.getTree().getSelection();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation and others. * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.properties; package org.eclipse.cdt.managedbuilder.ui.properties;
@ -197,6 +198,14 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
updateData(); updateData();
} }
/**
* @since 8.2
*/
@Override
public boolean canSupportMultiCfg() {
return false;
}
private void updateData() { private void updateData() {
showErrorMessage(); showErrorMessage();
fillToolChainCombo(); fillToolChainCombo();

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Andrew Gvozdev - Initial API and implementation * Andrew Gvozdev - Initial API and implementation
* Tom Hochstein (Freescale) - Bug 412601 - Preprocessor Entries properties tab should list languages * Tom Hochstein (Freescale) - Bug 412601 - Preprocessor Entries properties tab should list languages
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.language.settings.providers; package org.eclipse.cdt.internal.ui.language.settings.providers;
@ -1149,6 +1150,11 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
updateButtons(); updateButtons();
} }
@Override
public boolean canSupportMultiCfg() {
return false;
}
@Override @Override
protected void performDefaults() { protected void performDefaults() {
// This page restores defaults for file/folder only. // This page restores defaults for file/folder only.

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2011 Intel Corporation and others. * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation * Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* James Blackburn (Broadcom Corp.) * James Blackburn (Broadcom Corp.)
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.newui; package org.eclipse.cdt.ui.newui;
@ -561,16 +562,29 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
} }
break; break;
case ICPropertyTab.UPDATE: case ICPropertyTab.UPDATE:
if (canBeVisible()) configChanged((ICResourceDescription)data); if (canSupportMultiCfg() || !page.isMultiCfg()) {
if (canBeVisible()) {
setButtonVisible(true);
configChanged((ICResourceDescription)data);
}
}
else
setAllVisible(false, null);
break; break;
case ICPropertyTab.DISPOSE: case ICPropertyTab.DISPOSE:
dispose(); dispose();
break; break;
case ICPropertyTab.VISIBLE: case ICPropertyTab.VISIBLE:
if (canBeVisible()) if (canSupportMultiCfg() || !page.isMultiCfg()) {
setVisible(data != null); if (canBeVisible()) {
setVisible(data != null);
setButtonVisible(data != null);
}
else
setVisible(false);
}
else else
setVisible(false); setAllVisible(false, null);
break; break;
case ICPropertyTab.SET_ICON: case ICPropertyTab.SET_ICON:
icon = (Image)data; icon = (Image)data;
@ -587,6 +601,30 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
return true; return true;
} }
/**
* Method to be implemented by inherited classes to indicate whether or not the tab supports displaying
* and editing settings for multiple configuration selection.
*
* Default implementation returns true.
*
* @return true if the tab supports multiple configurations, false otherwise
* @since 5.7
*/
public boolean canSupportMultiCfg() {
return true;
}
/**
* Returns true if this tab is the one currently selected in the UI.
*
* @return true if this tab is the one selected in the UI, false otherwise.
* @since 5.7
*/
public boolean isTabSelected() {
if (page instanceof ICPropertyProvider2)
return ((ICPropertyProvider2) page).getSelectedTab() == this;
return false;
}
/** /**
* Added to avoid usage PixelConverter class. * Added to avoid usage PixelConverter class.
* @param control * @param control
@ -678,7 +716,16 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
} else { } else {
pageBook.showPage(userdata); pageBook.showPage(userdata);
} }
if (page != null) { setButtonVisible(visible);
}
/**
* Utility method to show/hide the 'Apply' and 'Restore Defaults' buttons
* @param visible - true or false
* @since 5.7
*/
protected void setButtonVisible(boolean visible) {
if (page != null && isTabSelected()) {
Button b = page.getAButton(); Button b = page.getAButton();
if (b != null) if (b != null)
b.setVisible(visible); b.setVisible(visible);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation, QNX Software Systems, and others. * Copyright (c) 2007, 2013 Intel Corporation, QNX Software Systems, and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,6 +11,7 @@
* Andrew Gvozdev * Andrew Gvozdev
* QNX Software Systems - [271628] NPE in configs for project that failed to convert * QNX Software Systems - [271628] NPE in configs for project that failed to convert
* James Blackburn (Broadcom Corp.) * James Blackburn (Broadcom Corp.)
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.newui; package org.eclipse.cdt.ui.newui;
@ -124,7 +125,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
public abstract class AbstractPage extends PropertyPage public abstract class AbstractPage extends PropertyPage
implements implements
IPreferencePageContainer, // dynamic pages IPreferencePageContainer, // dynamic pages
ICPropertyProvider // utility methods for tabs ICPropertyProvider2 // utility methods for tabs
{ {
private static ICResourceDescription resd = null; private static ICResourceDescription resd = null;
private static ICConfigurationDescription[] cfgDescs = null; private static ICConfigurationDescription[] cfgDescs = null;
@ -1365,4 +1366,12 @@ implements
} }
} }
/**
* @since 5.7
*/
@Override
public ICPropertyTab getSelectedTab() {
return currentTab;
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation and others. * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Intel Corporation - initial API and implementation * Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.newui; package org.eclipse.cdt.ui.newui;
@ -302,6 +303,11 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
updateButtons(); updateButtons();
} }
@Override
public boolean canSupportMultiCfg() {
return false;
}
protected abstract ICExclusionPatternPathEntry[] getEntries(ICResourceDescription cfgd); protected abstract ICExclusionPatternPathEntry[] getEntries(ICResourceDescription cfgd);
protected abstract void setEntries (ICResourceDescription cfgd, ICExclusionPatternPathEntry[] data); protected abstract void setEntries (ICResourceDescription cfgd, ICExclusionPatternPathEntry[] data);
protected abstract ICExclusionPatternPathEntry newEntry(IPath p, IPath[] ex, boolean workspacePath); protected abstract ICExclusionPatternPathEntry newEntry(IPath p, IPath[] ex, boolean workspacePath);

View file

@ -0,0 +1,28 @@
/*******************************************************************************
* Copyright (c) 2013 Freescale Semiconductor 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:
* Serge Beauchamp (Freescale Semiconductor) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
/**
* Interface provides an additional method to the CDT model property page.
*
* @see ICPropertyProvider
* @since 5.7
*/
public interface ICPropertyProvider2 extends ICPropertyProvider {
/**
* Return the selected tab, or null if the select tab isn't initialized
* @return the select tab in the page
*/
ICPropertyTab getSelectedTab();
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2009 Intel Corporation and others. * Copyright (c) 2007, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation * Intel Corporation - initial API and implementation
* IBM Corporation * IBM Corporation
* James Blackburn (Broadcom Corp.) * James Blackburn (Broadcom Corp.)
* Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.newui; package org.eclipse.cdt.ui.newui;
@ -194,6 +195,11 @@ public class RefsTab extends AbstractCPropertyTab {
} }
} }
@Override
public boolean canSupportMultiCfg() {
return false;
}
/** /**
* Persist the checked configurations * Persist the checked configurations
*/ */