Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Beauchamp2013-09-25 16:08:47 +0000
committerAndrew Gvozdev2013-10-03 15:47:10 +0000
commit02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9 (patch)
tree0befedd7dc1644e1b0701a359eea7f2e8fffee49 /core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui
parent15b11f611afe73f06b297ab51fd4bf4fcbfa69b1 (diff)
downloadorg.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.tar.gz
org.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.tar.xz
org.eclipse.cdt-02b96302a7fdbb6fc95a4a5e114eff29d6b7f0c9.zip
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>
Diffstat (limited to 'core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java59
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java28
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java8
5 files changed, 106 insertions, 10 deletions
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 ddd9791406d..df4c821d6bb 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
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -561,16 +562,29 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
}
break;
case ICPropertyTab.UPDATE:
- if (canBeVisible()) configChanged((ICResourceDescription)data);
+ if (canSupportMultiCfg() || !page.isMultiCfg()) {
+ if (canBeVisible()) {
+ setButtonVisible(true);
+ configChanged((ICResourceDescription)data);
+ }
+ }
+ else
+ setAllVisible(false, null);
break;
case ICPropertyTab.DISPOSE:
dispose();
break;
case ICPropertyTab.VISIBLE:
- if (canBeVisible())
- setVisible(data != null);
+ if (canSupportMultiCfg() || !page.isMultiCfg()) {
+ if (canBeVisible()) {
+ setVisible(data != null);
+ setButtonVisible(data != null);
+ }
+ else
+ setVisible(false);
+ }
else
- setVisible(false);
+ setAllVisible(false, null);
break;
case ICPropertyTab.SET_ICON:
icon = (Image)data;
@@ -588,6 +602,30 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
}
/**
+ * 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.
* @param control
* @return FontMetrics
@@ -678,7 +716,16 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
} else {
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();
if (b != null)
b.setVisible(visible);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
index 58279739ce8..19ab697da28 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
* Andrew Gvozdev
* QNX Software Systems - [271628] NPE in configs for project that failed to convert
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -124,7 +125,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
public abstract class AbstractPage extends PropertyPage
implements
IPreferencePageContainer, // dynamic pages
- ICPropertyProvider // utility methods for tabs
+ ICPropertyProvider2 // utility methods for tabs
{
private static ICResourceDescription resd = null;
private static ICConfigurationDescription[] cfgDescs = null;
@@ -1365,4 +1366,12 @@ implements
}
}
+ /**
+ * @since 5.7
+ */
+ @Override
+ public ICPropertyTab getSelectedTab() {
+ return currentTab;
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
index 810020d4ba1..ca17cbfdeee 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/CLocationTab.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@@ -302,6 +303,11 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
updateButtons();
}
+ @Override
+ public boolean canSupportMultiCfg() {
+ return false;
+ }
+
protected abstract ICExclusionPatternPathEntry[] getEntries(ICResourceDescription cfgd);
protected abstract void setEntries (ICResourceDescription cfgd, ICExclusionPatternPathEntry[] data);
protected abstract ICExclusionPatternPathEntry newEntry(IPath p, IPath[] ex, boolean workspacePath);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java
new file mode 100644
index 00000000000..a1497b15ee3
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyProvider2.java
@@ -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();
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
index df8c516ea44..b45d1d0e60b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/RefsTab.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Intel Corporation - initial API and implementation
* IBM Corporation
* James Blackburn (Broadcom Corp.)
+ * Serge Beauchamp (Freescale Semiconductor) - Bug 406545
*******************************************************************************/
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
*/

Back to the top